Skip to content

Commit

Permalink
refactor: always set use_default_shell_env on generated lifecycle hoo…
Browse files Browse the repository at this point in the history
…k js_run_binary (aspect-build#1581)
  • Loading branch information
gregmagolan authored and jbedard committed May 16, 2024
1 parent c6f2562 commit e8ba0f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
8 changes: 3 additions & 5 deletions npm/private/npm_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ _LINK_JS_PACKAGE_LIFECYCLE_TMPL = """\
execution_requirements = {lifecycle_hooks_execution_requirements},
mnemonic = "NpmLifecycleHook",
progress_message = "Running lifecycle hooks on npm package {package}@{version}",
env = {lifecycle_hooks_env},{maybe_use_default_shell_env}
env = {lifecycle_hooks_env},
use_default_shell_env = {use_default_shell_env},
)
# post-lifecycle npm_package
Expand Down Expand Up @@ -793,10 +794,7 @@ def _npm_import_links_rule_impl(rctx):
virtual_store_root = utils.virtual_store_root,
maybe_bins = maybe_bins,
dev = rctx.attr.dev,
# Insert nothing when `lifecycle_hooks_use_default_shell_env` is None to remain backwards-compatible
# with bazel-lib `run_binary` before `use_default_shell_env` was added.
# TODO(2.0): remove support for old bazel-lib without `run_binary(use_default_shell_env)`
maybe_use_default_shell_env = "\n use_default_shell_env = True," if rctx.attr.lifecycle_hooks_use_default_shell_env else "",
use_default_shell_env = rctx.attr.lifecycle_hooks_use_default_shell_env,
)

npm_link_package_bzl = [
Expand Down
1 change: 1 addition & 0 deletions npm/private/test/snapshots/bzlmod/fsevents_links_defs.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions npm/private/test/snapshots/wksp/fsevents_links_defs.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8ba0f9

Please sign in to comment.