Skip to content

Commit

Permalink
Make action_env work for rustc actions (#1022)
Browse files Browse the repository at this point in the history
Currently, action_env is not passed through to rustc actions, which means that variables like `DEVELOPER_DIR` needed in some cases on macOS cannot be passed through. This PR passes action_env through to rustc actions.

Similar to existing code at https://github.com/bazelbuild/rules_rust/blob/e2f0fccda912daac686b533ad77c5bc5d2f2ddb7/cargo/cargo_build_script.bzl#L68
  • Loading branch information
djmarcin authored Nov 19, 2021
1 parent 77cffb0 commit 53b1de6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rust/private/rustc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def rustc_compile_action(
stamp = stamp,
)

args, env = construct_arguments(
args, env_from_args = construct_arguments(
ctx = ctx,
attr = attr,
file = ctx.file,
Expand All @@ -749,6 +749,9 @@ def rustc_compile_action(
stamp = stamp,
)

env = dict(ctx.configuration.default_shell_env)
env.update(env_from_args)

if hasattr(attr, "version") and attr.version != "0.0.0":
formatted_version = " v{}".format(attr.version)
else:
Expand Down

0 comments on commit 53b1de6

Please sign in to comment.