aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java17
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java26
3 files changed, 48 insertions, 11 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 5c7d633da8..f099d7635c 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -254,8 +254,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
*/
@Nullable
private AllInputs collectInputs(Action action, Environment env) throws InterruptedException {
- Iterable<Artifact> allKnownInputs = Iterables.concat(
- action.getInputs(), action.getRunfilesSupplier().getArtifacts());
+ Iterable<Artifact> allKnownInputs = action.getInputs();
if (action.inputsDiscovered()) {
return new AllInputs(allKnownInputs);
}
@@ -677,11 +676,15 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
// We have to cache the "digest" of the aggregating value itself,
// because the action cache checker may want it.
inputArtifactData.put(input, aggregatingValue.getSelfData());
- ImmutableList.Builder<Artifact> expansionBuilder = ImmutableList.builder();
- for (Pair<Artifact, FileArtifactValue> pair : aggregatingValue.getInputs()) {
- expansionBuilder.add(pair.first);
+ // Runfiles artifacts are not expanded into the action's inputs but their metadata is
+ // available from the action file cache.
+ if (!(value instanceof RunfilesArtifactValue)) {
+ ImmutableList.Builder<Artifact> expansionBuilder = ImmutableList.builder();
+ for (Pair<Artifact, FileArtifactValue> pair : aggregatingValue.getInputs()) {
+ expansionBuilder.add(pair.first);
+ }
+ expandedArtifacts.put(input, expansionBuilder.build());
}
- expandedArtifacts.put(input, expansionBuilder.build());
} else if (value instanceof TreeArtifactValue) {
TreeArtifactValue treeValue = (TreeArtifactValue) value;
expandedArtifacts.put(input, ImmutableSet.<Artifact>copyOf(treeValue.getChildren()));
@@ -706,7 +709,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
actionFailures++;
// Prefer a catastrophic exception as the one we propagate.
if (firstActionExecutionException == null
- || !firstActionExecutionException.isCatastrophe() && e.isCatastrophe()) {
+ || (!firstActionExecutionException.isCatastrophe() && e.isCatastrophe())) {
firstActionExecutionException = e;
}
rootCauses.addTransitive(e.getRootCauses());
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
index 5cef0fc2c6..199916674d 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java
@@ -290,16 +290,24 @@ class ArtifactFunction implements SkyFunction {
}
inputs.add(Pair.of(input, (FileArtifactValue) inputValue));
}
- return new AggregatingArtifactValue(inputs.build(), value);
+ return (action.getActionType() == MiddlemanType.AGGREGATING_MIDDLEMAN)
+ ? new AggregatingArtifactValue(inputs.build(), value)
+ : new RunfilesArtifactValue(inputs.build(), value);
}
/**
* Returns whether this value needs to contain the data of all its inputs. Currently only tests to
- * see if the action is an aggregating middleman action. However, may include runfiles middleman
- * actions and Fileset artifacts in the future.
+ * see if the action is an aggregating or runfiles middleman action. However, may include Fileset
+ * artifacts in the future.
*/
private static boolean isAggregatingValue(ActionAnalysisMetadata action) {
- return action.getActionType() == MiddlemanType.AGGREGATING_MIDDLEMAN;
+ switch (action.getActionType()) {
+ case AGGREGATING_MIDDLEMAN:
+ case RUNFILES_MIDDLEMAN:
+ return true;
+ default:
+ return false;
+ }
}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java
new file mode 100644
index 0000000000..8969a2cbc6
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java
@@ -0,0 +1,26 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package com.google.devtools.build.lib.skyframe;
+
+import com.google.common.collect.ImmutableList;
+import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.util.Pair;
+
+/** The artifacts behind a runfiles middleman. */
+class RunfilesArtifactValue extends AggregatingArtifactValue {
+ RunfilesArtifactValue(
+ ImmutableList<Pair<Artifact, FileArtifactValue>> inputs, FileArtifactValue selfData) {
+ super(inputs, selfData);
+ }
+}