summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Roberts <ryan.roberts@arm.com>2024-02-02 12:44:41 +0000
committerRyan Roberts <ryan.roberts@arm.com>2024-02-02 12:44:41 +0000
commit7ae91a697efef932da8cc4808552dd646a3bb702 (patch)
tree199afe077253b2d7bc91da87ebb03dee258899c6
parente3750169739d9c3dc402dae2d9c87418d9d0f812 (diff)
config: Allow btvars to be used as rtvar default values
This allows a single parameter to be specified that can be used at both build-time and run-time. A btvar is defined and set as normal. And a corresponding rtvar is defined with its default value set to the btvar macro. The user can still override the rtvar at runtime if they want. Example: buildex: btvars: MYPROP: type: string value: null build: mycomponent: params: myprop: ${btvar:MYPROP} run: rtvars: MYPROP: type: string value: ${btvar:MYPROP} params: -C myprop: ${rtvar:MYPROP} Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
-rw-r--r--documentation/userguide/configmodel.rst2
-rw-r--r--shrinkwrap/utils/config.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/documentation/userguide/configmodel.rst b/documentation/userguide/configmodel.rst
index 019a888..b50e4b1 100644
--- a/documentation/userguide/configmodel.rst
+++ b/documentation/userguide/configmodel.rst
@@ -129,7 +129,7 @@ macro scope
``${param:builddir}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts} Directory in which the component should be built, if the component's build system supports separation of source and build trees.
``${param:configdir}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts} Directory containing the config store. This MUST only be used for resolving files that already exist in the store.
``${param:jobs}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts} Maximum number of low level parallel jobs specified on the command line. To be passed to (e.g.) make as ``-j${param:jobs}``.
-``${btvar:<name>}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts} Build-time variables. The variable names, along with default values are declared in buildex.btvars, and the user may override the value on the command line.
+``${btvar:<name>}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts}, run.rtvars Build-time variables. The variable names, along with default values are declared in buildex.btvars, and the user may override the value on the command line.
``${param:join_equal}`` build.<component>.{prebuild, build, postbuild, clean} String containing all of the component's parameters (from its params dictionary), concatenated as ``key=value`` pairs.
``${param:join_space}`` build.<component>.{prebuild, build, postbuild, clean} String containing all of the component's parameters (from its params dictionary), concatenated as ``key value`` pairs.
``${artifact:<name>}`` build.<component>.{params, prebuild, build, postbuild, clean, artifacts}, build.btvars Build path of an artifact declared by another component. Usage of these macros determine the component build dependency graph.
diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py
index 0de5ff3..d55086c 100644
--- a/shrinkwrap/utils/config.py
+++ b/shrinkwrap/utils/config.py
@@ -653,6 +653,8 @@ def resolver(config, rtvars={}, clivars={}):
},
'artifact': {k: v['dst']
for k, v in config['artifacts'].items()},
+ 'btvar': {k: v['value']
+ for k, v in config['buildex']['btvars'].items()},
}
for k in run['rtvars']:
v = run['rtvars'][k]