summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Smiley <keithbsmiley@gmail.com>2023-09-19 14:16:37 -0700
committerGitHub <noreply@github.com>2023-09-19 14:16:37 -0700
commit9556931e91c95a05ec8772f8e81be37fbd1388a7 (patch)
tree8f738b7ff613e5f9aa31ca868e86b24f35c1892c
parente6dff3c3b29f4a1be37e22a8da8c5aa1f1eec1d0 (diff)
downloadbazelbuild-apple_support-9556931e91c95a05ec8772f8e81be37fbd1388a7.tar.gz
Enable use_default_shell_env everywhere (#261)
Now that bazel 7.x has https://bazel.build/reference/command-line-reference#flag--incompatible_merge_fixed_and_default_shell_env enabled by default, we can set `use_default_shell_env = True` moving forward. This makes actions respect `--action_env=FOO` which can be useful for things like `TOOLCHAINS`, `ZERO_AR_DATE`, `TMPDIR`, etc. Previously these were ignored.
-rw-r--r--lib/apple_support.bzl7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/apple_support.bzl b/lib/apple_support.bzl
index dcd2c9f..d1cab11 100644
--- a/lib/apple_support.bzl
+++ b/lib/apple_support.bzl
@@ -23,6 +23,10 @@ _XCODE_PATH_RESOLVE_LEVEL = struct(
args_and_files = "args_and_files",
)
+# This is a proxy for being on bazel 7.x which has
+# --incompatible_merge_fixed_and_default_shell_env enabled by default
+_USE_DEFAULT_SHELL_ENV = not hasattr(apple_common, "apple_crosstool_transition")
+
_XCODE_PROCESSOR__ARGS = r"""#!/bin/bash
set -eu
@@ -189,6 +193,9 @@ def _kwargs_for_apple_platform(
if original_env:
merged_env.update(original_env)
+ if "use_default_shell_env" not in processed_args:
+ processed_args["use_default_shell_env"] = _USE_DEFAULT_SHELL_ENV
+
# Add the environment variables required for DEVELOPER_DIR and SDKROOT last to avoid clients
# overriding these values.
merged_env.update(apple_common.apple_host_system_env(xcode_config))