build
build copied to clipboard
[engine] support per target env vars setup.
We often need to set, or clear, environment variables for invoking target actions. Add an engine feature to be able to set those per target variables:
- Add special
ENVIRONper target variable that is composed of a list of name and value pairs. The value can be an empty string to indicate that the name env variable should be unset. - When the action for a target runs the each name and value in the
ENVIRONvariable is set for the duration of the action invocation.
AMDG
On 09/26/2018 01:36 AM, Rene Rivera wrote:
We often need to set, or clear, environment variables for invoking target actions. Add an engine feature to be able to set those per target variables:
- Add special
ENVIRONper target variable that is composed of a list of name and value pairs. The value can be an empty string to indicate that the name env variable should be unset.
Meaning "name1" "value1" "name2" "value2"
For some uses "name1=value1", "name2=value2" may be more convenient.
In particular, consider interaction with toolset.flags:
Only works with name=value
flags xxx.yyy ENVIRON :
This works either way, but the first appears more clear
to someone reading the code.
flags xxx.yyy ENVIRON
and that set and env print the environment
in NAME=VALUE format, which makes processing
the msvc setup scripts more convenient if we
use NAME=VALUE.
- When the action for a target runs the each name and value in the
ENVIRONvariable is set for the duration of the action invocation.
In Christ, Steven Watanabe
Oh, yes, I can see how NAME=VALUE would be a better syntax. There's less corner cases to deal with in the native code side also. Although it does adds some string manipulations in the engine. But I thinks it's minimal enough for gain in convenience.
Thank you for your contributions. Main development of B2 has moved to https://github.com/bfgroup/b2 This issue has been automatically marked as "transition" to indicate the potential for needing transition to the new B2 development project.