aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
diff options
context:
space:
mode:
authorGravatar Lukacs Berki <lberki@google.com>2015-02-26 09:19:15 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-26 09:19:15 +0000
commit70d1ea0fb1d7a9296b0ecffdeebe1f3d2c35b0b3 (patch)
tree9f26cba39ecb17f97b61ad3a2ddf232ac5ee692d /src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
parent5e2647085a2d8358d168c59acd9f1c346eaf3cd1 (diff)
Make it possible for SpawnActions to run unconditionally.
-- MOS_MIGRATED_REVID=87231498
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
index 2b566374d9..daac95e5ce 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java
@@ -85,6 +85,7 @@ public class SpawnAction extends AbstractAction {
private final CommandLine argv;
+ private final boolean executeUnconditionally;
private final String progressMessage;
private final String mnemonic;
// entries are (directory for remote execution, Artifact)
@@ -125,7 +126,7 @@ public class SpawnAction extends AbstractAction {
this(owner, inputs, outputs,
resourceSet, argv, ImmutableMap.copyOf(environment),
ImmutableMap.<String, String>of(), progressMessage,
- ImmutableMap.<PathFragment, Artifact>of(), mnemonic, null);
+ ImmutableMap.<PathFragment, Artifact>of(), mnemonic, false, null);
}
/**
@@ -160,6 +161,7 @@ public class SpawnAction extends AbstractAction {
String progressMessage,
ImmutableMap<PathFragment, Artifact> inputManifests,
String mnemonic,
+ boolean executeUnconditionally,
ExtraActionInfoSupplier<?> extraActionInfoSupplier) {
super(owner, inputs, outputs);
this.resourceSet = resourceSet;
@@ -169,6 +171,7 @@ public class SpawnAction extends AbstractAction {
this.progressMessage = progressMessage;
this.inputManifests = inputManifests;
this.mnemonic = mnemonic;
+ this.executeUnconditionally = executeUnconditionally;
this.extraActionInfoSupplier = extraActionInfoSupplier;
}
@@ -202,6 +205,16 @@ public class SpawnAction extends AbstractAction {
return argv.isShellCommand();
}
+ @Override
+ public boolean isVolatile() {
+ return executeUnconditionally;
+ }
+
+ @Override
+ public boolean executeUnconditionally() {
+ return executeUnconditionally;
+ }
+
/**
* Executes the action without handling ExecException errors.
*
@@ -415,6 +428,7 @@ public class SpawnAction extends AbstractAction {
private ImmutableMap<String, String> executionInfo = ImmutableMap.of();
private boolean isShellCommand = false;
private boolean useDefaultShellEnvironment = false;
+ private boolean executeUnconditionally;
private PathFragment executable;
// executableArgs does not include the executable itself.
private List<String> executableArgs;
@@ -513,7 +527,8 @@ public class SpawnAction extends AbstractAction {
actions.add(0, new SpawnAction(owner, actualInputs, ImmutableList.copyOf(outputs),
resourceSet, actualCommandLine, environment, executionInfo, progressMessage,
- ImmutableMap.copyOf(inputManifests), mnemonic, extraActionInfoSupplier));
+ ImmutableMap.copyOf(inputManifests), mnemonic, executeUnconditionally,
+ extraActionInfoSupplier));
return actions.toArray(new Action[actions.size()]);
}
@@ -596,6 +611,21 @@ public class SpawnAction extends AbstractAction {
}
/**
+ * Makes the action always execute, even if none of its inputs have changed.
+ *
+ * <p>Only use this when absolutely necessary, since this is a performance hit and we'd like to
+ * get rid of this mechanism eventually. You'll eventually be able to declare a Skyframe
+ * dependency on the build ID, which would accomplish the same thing.
+ */
+ public Builder executeUnconditionally() {
+ // This should really be implemented by declaring a Skyframe dependency on the build ID
+ // instead, however, we can't just do that yet from within actions, so we need to go through
+ // Action.executeUnconditionally() which in turn is called by ActionCacheChecker.
+ this.executeUnconditionally = true;
+ return this;
+ }
+
+ /**
* Sets the executable path; the path is interpreted relative to the
* execution root.
*