aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/actions/SpawnAction.java34
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/extra/ExtraAction.java1
3 files changed, 34 insertions, 3 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.
*
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java
index 9941edb6e3..848b5103c0 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/genrule/GenRuleAction.java
@@ -48,7 +48,7 @@ public final class GenRuleAction extends SpawnAction {
super(owner, inputs, outputs, GENRULE_RESOURCES,
CommandLine.of(argv, false), environment, executionInfo, progressMessage,
runfilesManifests,
- "Genrule", null);
+ "Genrule", false, null);
}
@Override
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 9be7dc3464..9290fc79a2 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
@@ -85,6 +85,7 @@ public final class ExtraAction extends SpawnAction {
progressMessage,
getManifests(shadowedAction),
mnemonic,
+ false,
null);
this.extraActionInfoFile = extraActionInfoFile;
this.shadowedAction = shadowedAction;