aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
diff options
context:
space:
mode:
authorGravatar kush <kush@google.com>2018-05-02 14:15:37 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-05-02 14:17:43 -0700
commit2ce45a21dbd6891a3b7ec92e4862ee822b7e8dd1 (patch)
tree0f8c3214dc242151a085d479455fb89fd85503de /src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
parent3687f2abb615d6c788bf0093ca5bf7ba33c60486 (diff)
Use the in-memory metadata in blaze as the source of truth for Fileset mappings
instead of the manifest files. RELNOTES: None PiperOrigin-RevId: 195149880
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java40
1 files changed, 36 insertions, 4 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 77f7254639..aca1c5c8a6 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
@@ -17,6 +17,7 @@ import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
@@ -27,8 +28,10 @@ import com.google.devtools.build.lib.actions.ActionExecutionContext;
import com.google.devtools.build.lib.actions.ActionExecutionException;
import com.google.devtools.build.lib.actions.ActionLookupData;
import com.google.devtools.build.lib.actions.ActionLookupValue;
+import com.google.devtools.build.lib.actions.ActionLookupValue.ActionLookupKey;
import com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.FilesetOutputSymlink;
import com.google.devtools.build.lib.actions.MissingInputFileException;
import com.google.devtools.build.lib.actions.NotifyOnActionCacheHit;
import com.google.devtools.build.lib.actions.PackageRootResolver;
@@ -223,8 +226,7 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
* @throws ActionExecutionFunctionException
*/
@Nullable
- private AllInputs collectInputs(Action action, Environment env)
- throws ActionExecutionFunctionException, InterruptedException {
+ private AllInputs collectInputs(Action action, Environment env) throws InterruptedException {
Iterable<Artifact> allKnownInputs = Iterables.concat(
action.getInputs(), action.getRunfilesSupplier().getArtifacts());
if (action.inputsDiscovered()) {
@@ -373,10 +375,16 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
if (state.token == null) {
// We got a hit from the action cache -- no need to execute.
+ Preconditions.checkState(
+ !(action instanceof SkyframeAwareAction),
+ "Error, we're not re-executing a "
+ + "SkyframeAwareAction which should be re-executed unconditionally. Action: %s",
+ action);
return new ActionExecutionValue(
metadataHandler.getOutputArtifactData(),
metadataHandler.getOutputTreeArtifactData(),
- metadataHandler.getAdditionalOutputData());
+ metadataHandler.getAdditionalOutputData(),
+ /*outputSymlinks=*/ null);
}
// Delete the metadataHandler's cache of the action's outputs, since they are being deleted.
@@ -429,11 +437,35 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
metadataHandler.discardOutputMetadata();
}
+ ImmutableMap.Builder<PathFragment, ImmutableList<FilesetOutputSymlink>> filesetMappings =
+ ImmutableMap.builder();
+ for (Artifact actionInput : action.getInputs()) {
+ if (!actionInput.isFileset()) {
+ continue;
+ }
+
+ ActionLookupKey filesetActionLookupKey = (ActionLookupKey) actionInput.getArtifactOwner();
+ // Index 0 for the Fileset ConfiguredTarget indicates the SkyframeFilesetManifestAction where
+ // we compute the fileset's outputSymlinks.
+ SkyKey filesetActionKey = ActionExecutionValue.key(filesetActionLookupKey, 0);
+ ActionExecutionValue filesetValue = (ActionExecutionValue) env.getValue(filesetActionKey);
+ if (filesetValue == null) {
+ // At this point skyframe does not guarantee that the filesetValue will be ready, since
+ // the current action does not directly depend on the outputs of the
+ // SkyframeFilesetManifestAction whose ActionExecutionValue (filesetValue) is needed here.
+ // TODO(kush): Get rid of this hack by making the outputSymlinks available in the Fileset
+ // artifact, which this action depends on, so its value will be guaranteed to be present.
+ return null;
+ }
+ filesetMappings.put(actionInput.getExecPath(), filesetValue.getOutputSymlinks());
+ }
+
try (ActionExecutionContext actionExecutionContext =
skyframeActionExecutor.getContext(
perActionFileCache,
metadataHandler,
- Collections.unmodifiableMap(state.expandedArtifacts))) {
+ Collections.unmodifiableMap(state.expandedArtifacts),
+ filesetMappings.build())) {
if (!state.hasExecutedAction()) {
state.value =
skyframeActionExecutor.executeAction(