build icon indicating copy to clipboard operation
build copied to clipboard

[engine] support per target env vars setup.

Open grafikrobot opened this issue 7 years ago • 3 comments

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 ENVIRON per 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 ENVIRON variable is set for the duration of the action invocation.

grafikrobot avatar Sep 26 '18 07:09 grafikrobot

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 ENVIRON per 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 multi : THREADING=ON ; flags xxx.yyy ENVIRON multi : THREADING ON ;

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 ENVIRON variable is set for the duration of the action invocation.

In Christ, Steven Watanabe

swatanabe avatar Sep 26 '18 16:09 swatanabe

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.

grafikrobot avatar Sep 26 '18 16:09 grafikrobot

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.

stale[bot] avatar Jun 26 '21 03:06 stale[bot]