-
Notifications
You must be signed in to change notification settings - Fork 0
Config Variables
While writing Re target configs, sometimes you need to reference dynamic data only known at build time.
To let you do this, Re provides config variables.
Config variables can be used in most contexts where Re expects a string.
Variables are substituted whenever you include ${[<var-namespace>:]<var-name>}
in your config.
The variable is only accessed when the config value is being processed — so for different places in the config, different variables and variable namespaces may be available.
Re throws a fatal error if a variable could not be resolved.
You may define custom variables inside of a vars
section of re.yml
:
vars:
foo: "bar"
The foo
variable may now be referenced as ${foo}
, or, more explicitly, as ${target:foo}
.
Namespace | Description | Example |
---|---|---|
target |
Variables local to the current target | ${target:path} |
target/<full-target-name> |
Variables local to another target, same contents as target in it |
${target/libhello.tests:type} |
env |
Local environment variables | ${env:ACME_API_TOKEN} |
re |
Re platform variables | ${re:host-arch} |
If the namespace part is omitted, Re will look through all other visible namespaces for the specified variable and fail if the value could not be resolved.
Generally, you may omit the target:
and build:
prefixes when using variables of the current target: that is, ${target:path}
and ${path}
are interchangeable.
Variable | Description |
---|---|
${type} |
The current target’s type |
${path} or ${src-dir}
|
The current target’s source directory |
${artifact—dir} |
The path to this target’s build directory, where the build artifact will eventually appear |
${object—dir} |
The path to this target’s object directory |
${build-artifact} |
The filename (NOT the full path) of this target’s main build artifact (.exe, .a, .dylib) |
${main-artifact} |
The full path to this target’s main build artifact |
${build-root} |
The directory in which re was originally invoked |
${arch} |
The current build architecture (like x86 or arm ) |
${platform} |
The current build platform (windows
|
${host-platform} |
The platform re is running on (windows
|
${configuration} |
The current build configuration (debug , release or other) |
${target/<other-target-name>:*} |
References variables from another target |