Skip to content

Commit

Permalink
chore: make it possible to override run_binary#use_default_shell_env (#…
Browse files Browse the repository at this point in the history
…762)

Still not documented as public API. We think this leads to non-hermeticity and could cause cache misses, so it must be used with care.

Part of aspect-build/rules_js#1303
  • Loading branch information
alexeagle authored Feb 21, 2024
1 parent c1a01d2 commit 1c98ca9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/private/run_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Possible fixes:
mnemonic = ctx.attr.mnemonic if ctx.attr.mnemonic else None,
progress_message = ctx.attr.progress_message if ctx.attr.progress_message else None,
execution_requirements = ctx.attr.execution_requirements if ctx.attr.execution_requirements else None,
use_default_shell_env = False,
use_default_shell_env = ctx.attr.use_default_shell_env,
env = dicts.add(ctx.configuration.default_shell_env, envs),
input_manifests = tool_input_mfs,
)
Expand Down Expand Up @@ -104,6 +104,7 @@ _run_binary = rule(
"mnemonic": attr.string(),
"progress_message": attr.string(),
"execution_requirements": attr.string_dict(),
"use_default_shell_env": attr.bool(),
}, **STAMP_ATTRS),
)

Expand Down
3 changes: 3 additions & 0 deletions lib/tests/run_binary_expansions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ run_binary(
},
progress_message = "doing some work to make %{output}",
tool = ":expansions_sh",
# May introduce non-determinism; use with care!
# See e.g. https://github.com/bazelbuild/bazel/issues/4912
use_default_shell_env = True,
)

diff_test(
Expand Down

0 comments on commit 1c98ca9

Please sign in to comment.