Allow extending profiles and merging their contents. #592
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows profiles to contain the following:
The
Context
class then loads that base profile and merges the contents of the profiles (last value for a given key wins). When saving the context, the changes are saved in the correct files by keeping a lookup table which stores the file that each parameter was loaded from.The use case I have for this is that we have many users, each with a separate profile. Most users just want to set a custom
whitelist
orblacklist
and use default values from another profile for thecmake_args
etc. With this PR, a lot of copied and pasted YAML code can be removed.I do not know if this is something that is wanted in this project. If yes, I can add unit tests for the added functionality or refactor the changes if there is a nicer way to implement it (the
key_origins
feels a bit hacky).Edit:
extends
might not be a good name as it is similar toextend_path
. Also, I couldn't get the unit tests to work on my machine, so the CI build might fail.