diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java index 3e30b3f3131d06..32089427d92e68 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/config/CoreOptions.java @@ -342,14 +342,30 @@ public String getTypeDescription() { documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, effectTags = {OptionEffectTag.ACTION_COMMAND_LINES}, help = - "Specifies the set of environment variables available to actions. " - + "Variables can be either specified by name, in which case the value will be " - + "taken from the invocation environment, or by the name=value pair which sets " - + "the value independent of the invocation environment. This option can be used " - + "multiple times; for options given for the same variable, the latest wins, options " - + "for different variables accumulate.") + "Specifies the set of environment variables available to actions with target" + + " configuration. Variables can be either specified by name, in which case the" + + " value will be taken from the invocation environment, or by the name=value pair" + + " which sets the value independent of the invocation environment. This option can" + + " be used multiple times; for options given for the same variable, the latest" + + " wins, options for different variables accumulate.") public List> actionEnvironment; + @Option( + name = "host_action_env", + converter = Converters.OptionalAssignmentConverter.class, + allowMultiple = true, + defaultValue = "null", + documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS, + effectTags = {OptionEffectTag.ACTION_COMMAND_LINES}, + help = + "Specifies the set of environment variables available to actions with host or execution" + + " configurations. Variables can be either specified by name, in which case the" + + " value will be taken from the invocation environment, or by the name=value pair" + + " which sets the value independent of the invocation environment. This option can" + + " be used multiple times; for options given for the same variable, the latest" + + " wins, options for different variables accumulate.") + public List> hostActionEnvironment; + @Option( name = "repo_env", converter = Converters.OptionalAssignmentConverter.class, @@ -957,6 +973,9 @@ public FragmentOptions getHost() { host.hostCpu = hostCpu; host.hostCompilationMode = hostCompilationMode; + // Pass host action environment variables + host.actionEnvironment = hostActionEnvironment; + return host; }