diff options
author | laszlocsomor <laszlocsomor@google.com> | 2018-04-23 01:15:01 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-23 01:16:27 -0700 |
commit | 84d3097537f045a78baaebc3c6f2ffef4d814cb5 (patch) | |
tree | 6c90c6ea794b916c57d696e0487ee0a7f4c8d014 /src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java | |
parent | d91974e8c55a1670e332920fa51512cb237d4f9e (diff) |
SpawnAction.setShellCommand: expect shell path
SpawnAction.setShellCommand(String) now expects
the shell interpreter's path as an argument. This
change enables two things:
- rules can report an error if the shell is
missing
- SpawnAction no longer has to know about a
default shell
The new ShToolchain class will later also be
responsible for retrieving the active shell
toolchain (added in https://github.com/bazelbuild/bazel/commit/81ed3add408adb20bddbc3ba1818c65806738dc5).
This change brings Bazel closer to not depend on
the shell unless it has to (e.g. to run shell
scripts).
See https://github.com/bazelbuild/bazel/issues/4319
RELNOTES: none
PiperOrigin-RevId: 193885943
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java index 416a62a5a0..4f09dde901 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java @@ -30,6 +30,7 @@ import com.google.devtools.build.lib.analysis.CommandHelper; import com.google.devtools.build.lib.analysis.FilesToRunProvider; import com.google.devtools.build.lib.analysis.PseudoAction; import com.google.devtools.build.lib.analysis.RuleContext; +import com.google.devtools.build.lib.analysis.ShToolchain; import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext; import com.google.devtools.build.lib.analysis.actions.FileWriteAction; import com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction; @@ -654,10 +655,11 @@ public class SkylarkActionFactory implements SkylarkValue { Artifact helperScript = CommandHelper.shellCommandHelperScriptMaybe( ruleContext, command, helperScriptSuffix, executionInfo); + PathFragment shExecutable = ShToolchain.getPathOrError(ruleContext); if (helperScript == null) { - builder.setShellCommand(command); + builder.setShellCommand(shExecutable, command); } else { - builder.setShellCommand(helperScript.getExecPathString()); + builder.setShellCommand(shExecutable, helperScript.getExecPathString()); builder.addInput(helperScript); FilesToRunProvider provider = context.getExecutableRunfiles(helperScript); if (provider != null) { |