diff options
author | 2018-05-28 06:33:47 -0700 | |
---|---|---|
committer | 2018-05-28 06:35:40 -0700 | |
commit | 382089e97bf2812d69977948311d4ccc8fd60528 (patch) | |
tree | ba3739a326abd264685d4ea3849b15bfbe647af6 /src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java | |
parent | 768f1818bea462a359f45034003f3b9756901116 (diff) |
CommandHelper: do not look up shell's path
The CommandHelper no longer looks up the shell
interpreter's path itself. Instead its ctor takes
the path as an argument.
This change will allow incrementally migrating
rules that use CommandHelper to start depending on
the shell toolchain.
Shell-using rules today only use the
ShellConfiguration config fragment to look up the
shell's path. In the future, more and more rules
will also retrieve the active shell toolchain, and
be able to:
1. use the auto-detected local shell interpreter's
location, especially when it's not the default
/bin/bash
2. use define different shell toolchains
(different interpreter paths) for remote builds
3. gracefully fail the build if the machine has no
shell installed but the action graph included a
shell action
See https://github.com/bazelbuild/bazel/issues/4319
Change-Id: I4da4e77e7d1fe57e8e4f5eb8820d03a840915e20
Closes #5283.
Change-Id: I4da4e77e7d1fe57e8e4f5eb8820d03a840915e20
PiperOrigin-RevId: 198298315
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java b/src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java index 85b743144d..4f7fd5becc 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/extra/ExtraActionSpec.java @@ -44,6 +44,7 @@ import java.util.Map; */ @Immutable public final class ExtraActionSpec implements TransitiveInfoProvider { + private final PathFragment shExecutable; private final ImmutableList<Artifact> resolvedTools; private final RunfilesSupplier runfilesSupplier; private final ImmutableList<Artifact> resolvedData; @@ -54,6 +55,7 @@ public final class ExtraActionSpec implements TransitiveInfoProvider { private final Label label; public ExtraActionSpec( + PathFragment shExecutable, Iterable<Artifact> resolvedTools, RunfilesSupplier runfilesSupplier, Iterable<Artifact> resolvedData, @@ -62,6 +64,7 @@ public final class ExtraActionSpec implements TransitiveInfoProvider { Label label, Map<String, String> executionInfo, boolean requiresActionOutput) { + this.shExecutable = shExecutable; this.resolvedTools = ImmutableList.copyOf(resolvedTools); this.runfilesSupplier = runfilesSupplier; this.resolvedData = ImmutableList.copyOf(resolvedData); @@ -132,8 +135,13 @@ public final class ExtraActionSpec implements TransitiveInfoProvider { actionToShadow.getPrimaryOutput().getExecPath().getBaseName() + "." + actionToShadow.getKey(owningRule.getActionKeyContext()); - List<String> argv = commandHelper.buildCommandLine(command, extraActionInputs, - "." + actionUniquifier + ".extra_action_script.sh", executionInfo); + List<String> argv = + commandHelper.buildCommandLine( + shExecutable, + command, + extraActionInputs, + "." + actionUniquifier + ".extra_action_script.sh", + executionInfo); String commandMessage = String.format("Executing extra_action %s on %s", label, ownerLabel); owningRule.registerAction( |