Skip to content

Commit 8c191d8

Browse files
fmeumcopybara-github
authored andcommitted
Flip --incompatible_merge_fixed_and_default_shell_env
Fixes #5980 Closes #19317 RELNOTES[INC]: --incompatible_merge_fixed_and_default_shell_env is flipped to true. See #19317 for details. Closes #19318. PiperOrigin-RevId: 560669897 Change-Id: I7c7e3267e55deca3b889796293930a33b77b2d91
1 parent 788d00e commit 8c191d8

File tree

4 files changed

+41
-7
lines changed

4 files changed

+41
-7
lines changed

src/main/java/com/google/devtools/build/lib/packages/semantics/BuildLanguageOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ public final class BuildLanguageOptions extends OptionsBase {
670670

671671
@Option(
672672
name = "incompatible_merge_fixed_and_default_shell_env",
673-
defaultValue = "false",
673+
defaultValue = "true",
674674
documentationCategory = OptionDocumentationCategory.STARLARK_SEMANTICS,
675675
effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS},
676676
metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE},
@@ -871,7 +871,7 @@ public StarlarkSemantics toStarlarkSemantics() {
871871
public static final String INCOMPATIBLE_DISABLE_STARLARK_HOST_TRANSITIONS =
872872
"-incompatible_disable_starlark_host_transitions";
873873
public static final String INCOMPATIBLE_MERGE_FIXED_AND_DEFAULT_SHELL_ENV =
874-
"-experimental_merge_fixed_and_default_shell_env";
874+
"+experimental_merge_fixed_and_default_shell_env";
875875
public static final String INCOMPATIBLE_OBJC_PROVIDER_REMOVE_LINKING_INFO =
876876
"-incompatible_objc_provider_remove_linking_info";
877877

src/main/java/com/google/devtools/build/lib/starlarkbuildapi/StarlarkActionFactoryApi.java

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,16 @@ void symlink(
417417
defaultValue = "False",
418418
named = true,
419419
positional = false,
420-
doc = "Whether the action should use the built in shell environment or not."),
420+
doc =
421+
"Whether the action should use the default shell environment, which consists of a"
422+
+ " few OS-dependent variables as well as variables set via <a"
423+
+ " href=\"/reference/command-line-reference#flag--action_env\"><code>"
424+
+ "--action_env</code></a>.<p>If both <code>use_default_shell_env</code> and"
425+
+ " <code>env</code> are set to <code>True</code>, values set in"
426+
+ " <code>env</code> will overwrite the default shell environment if <a "
427+
+ "href=\"/reference/command-line-reference#flag--incompatible_merge_fixed_and_default_shell_env\"><code>--incompatible_merge_fixed_and_default_shell_env</code></a>"
428+
+ " is enabled (default). If the flag is not enabled, <code>env</code> is"
429+
+ " ignored."),
421430
@Param(
422431
name = "env",
423432
allowedTypes = {
@@ -427,7 +436,14 @@ void symlink(
427436
defaultValue = "None",
428437
named = true,
429438
positional = false,
430-
doc = "Sets the dictionary of environment variables."),
439+
doc =
440+
"Sets the dictionary of environment variables.<p>If both"
441+
+ " <code>use_default_shell_env</code> and <code>env</code> are set to"
442+
+ " <code>True</code>, values set in <code>env</code> will overwrite the"
443+
+ " default shell environment if <a "
444+
+ "href=\"/reference/command-line-reference#flag--incompatible_merge_fixed_and_default_shell_env\"><code>--incompatible_merge_fixed_and_default_shell_env</code></a>"
445+
+ " is enabled (default). If the flag is not enabled, <code>env</code> is"
446+
+ " ignored."),
431447
@Param(
432448
name = "execution_requirements",
433449
allowedTypes = {
@@ -664,7 +680,16 @@ void run(
664680
defaultValue = "False",
665681
named = true,
666682
positional = false,
667-
doc = "Whether the action should use the built in shell environment or not."),
683+
doc =
684+
"Whether the action should use the default shell environment, which consists of a"
685+
+ " few OS-dependent variables as well as variables set via <a"
686+
+ " href=\"/reference/command-line-reference#flag--action_env\"><code>"
687+
+ "--action_env</code></a>.<p>If both <code>use_default_shell_env</code> and"
688+
+ " <code>env</code> are set to <code>True</code>, values set in"
689+
+ " <code>env</code> will overwrite the default shell environment if <a "
690+
+ "href=\"/reference/command-line-reference#flag--incompatible_merge_fixed_and_default_shell_env\"><code>--incompatible_merge_fixed_and_default_shell_env</code></a>"
691+
+ " is enabled (default). If the flag is not enabled, <code>env</code> is"
692+
+ " ignored."),
668693
@Param(
669694
name = "env",
670695
allowedTypes = {
@@ -674,7 +699,14 @@ void run(
674699
defaultValue = "None",
675700
named = true,
676701
positional = false,
677-
doc = "Sets the dictionary of environment variables."),
702+
doc =
703+
"Sets the dictionary of environment variables.<p>If both"
704+
+ " <code>use_default_shell_env</code> and <code>env</code> are set to"
705+
+ " <code>True</code>, values set in <code>env</code> will overwrite the"
706+
+ " default shell environment if <a "
707+
+ "href=\"/reference/command-line-reference#flag--incompatible_merge_fixed_and_default_shell_env\"><code>--incompatible_merge_fixed_and_default_shell_env</code></a>"
708+
+ " is enabled (default). If the flag is not enabled, <code>env</code> is"
709+
+ " ignored."),
678710
@Param(
679711
name = "execution_requirements",
680712
allowedTypes = {

src/test/java/com/google/devtools/build/lib/packages/semantics/ConsistencyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ private static BuildLanguageOptions buildRandomOptions(Random rand) throws Excep
142142
"--incompatible_disallow_struct_provider_syntax=" + rand.nextBoolean(),
143143
"--incompatible_do_not_split_linking_cmdline=" + rand.nextBoolean(),
144144
"--incompatible_java_common_parameters=" + rand.nextBoolean(),
145+
"--incompatible_merge_fixed_and_default_shell_env=" + rand.nextBoolean(),
145146
"--incompatible_new_actions_api=" + rand.nextBoolean(),
146147
"--incompatible_no_attr_license=" + rand.nextBoolean(),
147148
"--incompatible_no_implicit_file_export=" + rand.nextBoolean(),
@@ -190,6 +191,8 @@ private static StarlarkSemantics buildRandomSemantics(Random rand) {
190191
BuildLanguageOptions.INCOMPATIBLE_DISALLOW_STRUCT_PROVIDER_SYNTAX, rand.nextBoolean())
191192
.setBool(BuildLanguageOptions.INCOMPATIBLE_DO_NOT_SPLIT_LINKING_CMDLINE, rand.nextBoolean())
192193
.setBool(BuildLanguageOptions.INCOMPATIBLE_JAVA_COMMON_PARAMETERS, rand.nextBoolean())
194+
.setBool(
195+
BuildLanguageOptions.INCOMPATIBLE_MERGE_FIXED_AND_DEFAULT_SHELL_ENV, rand.nextBoolean())
193196
.setBool(BuildLanguageOptions.INCOMPATIBLE_NEW_ACTIONS_API, rand.nextBoolean())
194197
.setBool(BuildLanguageOptions.INCOMPATIBLE_NO_ATTR_LICENSE, rand.nextBoolean())
195198
.setBool(BuildLanguageOptions.INCOMPATIBLE_NO_IMPLICIT_FILE_EXPORT, rand.nextBoolean())

src/test/shell/integration/action_env_test.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ function test_use_default_shell_env_and_fixed_env {
253253

254254
ACTION_AND_CLIENT_INHERITED=client CLIENT_INHERITED=client \
255255
bazel build \
256-
--incompatible_merge_fixed_and_default_shell_env \
257256
--action_env=ACTION_AND_CLIENT_FIXED=client \
258257
--action_env=ACTION_AND_CLIENT_INHERITED \
259258
--action_env=CLIENT_FIXED=client \

0 commit comments

Comments
 (0)