aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/extra
diff options
context:
space:
mode:
authorGravatar Brian Silverman <bsilver16384@gmail.com>2016-01-21 11:52:07 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-01-21 16:22:11 +0000
commit45ca8d3873ffe0059de2bb5597667adb2781f625 (patch)
treeb916a4a60b48b077eceb8d7dc76da4b7a03b570b /src/main/java/com/google/devtools/build/lib/rules/extra
parent0338a35cbd1d55e24a97958da39e76615fe670aa (diff)
Fix extra_actions with sandboxing.
The ExtraAction code assumed that it didn't need to list the runfiles of its tools when running locally, but this isn't true with sandboxing. I don't think fixing this will negatively affect anybody's performance because they probably don't have any runfiles because they currently can't use them, unless they're running actions remotely in which case this change has no effect. -- Change-Id: Ibeb3db9d31321912a7163d1bce0edf5f6288ea3e Reviewed-on: https://bazel-review.googlesource.com/#/c/2520/ MOS_MIGRATED_REVID=112670586
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/extra')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
index 88e51e8a03..2e0f25bf6d 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java
@@ -27,8 +27,6 @@ import com.google.devtools.build.lib.actions.ActionExecutionException;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.ArtifactResolver;
import com.google.devtools.build.lib.actions.DelegateSpawn;
-import com.google.devtools.build.lib.actions.ExecException;
-import com.google.devtools.build.lib.actions.Executor;
import com.google.devtools.build.lib.actions.PackageRootResolutionException;
import com.google.devtools.build.lib.actions.PackageRootResolver;
import com.google.devtools.build.lib.actions.Spawn;
@@ -133,16 +131,13 @@ public final class ExtraAction extends SpawnAction {
public Collection<Artifact> discoverInputs(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
Preconditions.checkState(discoversInputs(), this);
- if (getContext(actionExecutionContext.getExecutor()).isRemotable(getMnemonic(),
- isRemotable())) {
- // If we're running remotely, we need to update our inputs to take account of any additional
- // inputs the shadowed action may need to do its work.
- if (shadowedAction.discoversInputs() && shadowedAction instanceof AbstractAction) {
- Iterable<Artifact> additionalInputs =
- ((AbstractAction) shadowedAction).getInputFilesForExtraAction(actionExecutionContext);
- updateInputs(createInputs(additionalInputs, extraActionInputs));
- return ImmutableSet.copyOf(additionalInputs);
- }
+ // We need to update our inputs to take account of any additional
+ // inputs the shadowed action may need to do its work.
+ if (shadowedAction.discoversInputs() && shadowedAction instanceof AbstractAction) {
+ Iterable<Artifact> additionalInputs =
+ ((AbstractAction) shadowedAction).getInputFilesForExtraAction(actionExecutionContext);
+ updateInputs(createInputs(additionalInputs, extraActionInputs));
+ return ImmutableSet.copyOf(additionalInputs);
}
return null;
}
@@ -192,19 +187,9 @@ public final class ExtraAction extends SpawnAction {
@Override
public void execute(ActionExecutionContext actionExecutionContext)
throws ActionExecutionException, InterruptedException {
- Executor executor = actionExecutionContext.getExecutor();
-
// PHASE 2: execution of extra_action.
- if (getContext(executor).isRemotable(getMnemonic(), isRemotable())) {
- try {
- getContext(executor).exec(getExtraActionSpawn(), actionExecutionContext);
- } catch (ExecException e) {
- throw e.toActionExecutionException(this);
- }
- } else {
- super.execute(actionExecutionContext);
- }
+ super.execute(actionExecutionContext);
// PHASE 3: create dummy output.
// If the user didn't specify output, we need to create dummy output
@@ -231,7 +216,8 @@ public final class ExtraAction extends SpawnAction {
* before the SpawnAction so should not be listed as one of its outputs.
*/
// TODO(bazel-team): Add more tests that execute this code path!
- private Spawn getExtraActionSpawn() {
+ @Override
+ public Spawn getSpawn() {
final Spawn base = super.getSpawn();
return new DelegateSpawn(base) {
@Override public ImmutableMap<PathFragment, Artifact> getRunfilesManifests() {