diff options
author | 2018-01-03 12:20:57 -0800 | |
---|---|---|
committer | 2018-01-03 12:22:55 -0800 | |
commit | ceaed5145f5ad27facd103a79d047cf0e301b4b5 (patch) | |
tree | 86d92a80caa06522c5f21ea971b3b692d3520016 /tools/build_defs/apple | |
parent | e981d20dafc268ff9c1b5e23452e060327a0ace2 (diff) |
Remove usages of `+` on dicts
The `+` operator on dicts is deprecated and will be removed. This change makes
Bazel files compatible with the new behavior.
Fixes #4346.
PiperOrigin-RevId: 180702882
Diffstat (limited to 'tools/build_defs/apple')
-rw-r--r-- | tools/build_defs/apple/shared.bzl | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/build_defs/apple/shared.bzl b/tools/build_defs/apple/shared.bzl index f4c973772a..0e3721f26f 100644 --- a/tools/build_defs/apple/shared.bzl +++ b/tools/build_defs/apple/shared.bzl @@ -58,8 +58,8 @@ def apple_action(ctx, **kw): Call it similar to how you would call ctx.action: apple_action(ctx, outputs=[...], inputs=[...],...) """ - execution_requirements = kw.get("execution_requirements", {}) - execution_requirements += DARWIN_EXECUTION_REQUIREMENTS + execution_requirements = dict(kw.get("execution_requirements", {})) + execution_requirements.update(DARWIN_EXECUTION_REQUIREMENTS) no_sandbox = kw.pop("no_sandbox", False) if no_sandbox: @@ -76,11 +76,13 @@ def xcrun_env(ctx): if hasattr(apple_common, "apple_host_system_env"): xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] - return (apple_common.target_apple_env(xcode_config, platform) + - apple_common.apple_host_system_env(xcode_config)) + env = apple_common.target_apple_env(xcode_config, platform) + env.update(apple_common.apple_host_system_env(xcode_config)) else: - return (ctx.fragments.apple.target_apple_env(platform) + - ctx.fragments.apple.apple_host_system_env()) + env = ctx.fragments.apple.target_apple_env(platform) + env.update(ctx.fragments.apple.apple_host_system_env()) + + return env def xcrun_action(ctx, **kw): @@ -92,7 +94,7 @@ def xcrun_action(ctx, **kw): This method takes the same keyword arguments as ctx.action, however you don't need to specify the executable. """ - env = kw.get("env", {}) - kw["env"] = env + xcrun_env(ctx) + kw["env"] = dict(kw.get("env", {})) + kw["env"].update(xcrun_env(ctx)) apple_action(ctx, executable=ctx.executable._xcrunwrapper, **kw) |