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.
Closes #51.
Presently, BAL can only be configured using a JSON library file. This causes several problems with the authoring of automated tests within host integrations:
So add a new setting,
"library_json"
. This allows hosts to query for the current internal BAL library viasettings()
, and then mutate it and update BAL via a re-initialize()
.The JSON must be passed from/to the manager in serialised form, since the settings dictionary must be coerced to/from a (C++)
InfoDictionary
, which is a simple key-value map, rather than an arbitrarily nested dictionary.In addition, calculated
"variables"
(e.g."bal_library_dir_url"
) cannot be provided when the library is given as a JSON string, since they are based on the location of thelibrary_path
.If both
library_path
andlibrary_json
are provided, thenlibrary_json
takes precedence. This allows a JSON library file to be provided initially, then the library mutated during test cases.Recall that the OpenAssetIO
initialize
method can accept partial settings updates, meaning the manager retains any previous settings that are not explicitly overridden in the new settings dict. However, this does not apply to the speciallibrary_json
setting here. This is a bit of an abuse for convenience. E.g. if we re-initialize with an empty settings dict, the initialization process falls back to using the previously-setlibrary_path
(if available) and resets the library to match the file.This compromise is somewhat justified by analogy to current behaviour when BAL is re-initialised after entities have been published. In this case the new entities only exist in memory, and are lost when re-initialising, since the library JSON file is re-read and overwrites any changes. This is similar to how the
library_json
changes are lost by default when re-initializing.