aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
diff options
context:
space:
mode:
authorGravatar janakr <janakr@google.com>2018-06-08 12:51:58 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-06-08 12:53:15 -0700
commit45b308a62f42c2c0bcfe79dcd4046c4025a31059 (patch)
tree176fc0a10fa37906864e952d833966298ccab727 /src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
parentc44a87b0736c671e07e62f8b09c8e61775543ded (diff)
Make Artifact#equals take the owner into account for derived artifacts.
Derived artifacts' owners are important because they are used to determine the artifact's generating action. Source artifacts' owners are not used in this way, so I left them alone. This allows us to get rid of most uses of ArtifactSkyKey. We may be able to delete it entirely in a follow-up. PiperOrigin-RevId: 199836436
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index acc97e046f..bdff840056 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -50,6 +50,7 @@ import com.google.devtools.build.lib.actions.Actions;
import com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander;
+import com.google.devtools.build.lib.actions.Artifact.OwnerlessArtifactWrapper;
import com.google.devtools.build.lib.actions.ArtifactPrefixConflictException;
import com.google.devtools.build.lib.actions.CachedActionEvent;
import com.google.devtools.build.lib.actions.EnvironmentalExecException;
@@ -141,7 +142,8 @@ public final class SkyframeActionExecutor {
// We don't want to execute the action again on the second entry to the SkyFunction.
// In both cases, we store the already-computed ActionExecutionValue to avoid having to compute it
// again.
- private ConcurrentMap<Artifact, Pair<ActionLookupData, FutureTask<ActionExecutionValue>>>
+ private ConcurrentMap<
+ OwnerlessArtifactWrapper, Pair<ActionLookupData, FutureTask<ActionExecutionValue>>>
buildActionMap;
// Errors found when examining all actions in the graph are stored here, so that they can be
@@ -388,13 +390,16 @@ public final class SkyframeActionExecutor {
}
boolean probeActionExecution(Action action) {
- return buildActionMap.containsKey(action.getPrimaryOutput());
+ return buildActionMap.containsKey(new OwnerlessArtifactWrapper(action.getPrimaryOutput()));
}
private boolean actionReallyExecuted(Action action, ActionLookupData actionLookupData) {
Pair<ActionLookupData, ?> cachedRun =
Preconditions.checkNotNull(
- buildActionMap.get(action.getPrimaryOutput()), "%s %s", action, actionLookupData);
+ buildActionMap.get(new OwnerlessArtifactWrapper(action.getPrimaryOutput())),
+ "%s %s",
+ action,
+ actionLookupData);
return actionLookupData.equals(cachedRun.getFirst());
}
@@ -434,7 +439,8 @@ public final class SkyframeActionExecutor {
actionLookupData));
// Check to see if another action is already executing/has executed this value.
Pair<ActionLookupData, FutureTask<ActionExecutionValue>> oldAction =
- buildActionMap.putIfAbsent(primaryOutput, Pair.of(actionLookupData, actionTask));
+ buildActionMap.putIfAbsent(
+ new OwnerlessArtifactWrapper(primaryOutput), Pair.of(actionLookupData, actionTask));
// true if this is a non-shared action or it's shared and to be executed.
boolean isPrimaryActionForTheValue = oldAction == null;
@@ -445,7 +451,10 @@ public final class SkyframeActionExecutor {
actionTask = oldAction.second;
}
try {
- return actionTask.get();
+ ActionExecutionValue value = actionTask.get();
+ return isPrimaryActionForTheValue
+ ? value
+ : value.transformForSharedAction(action.getOutputs());
} catch (ExecutionException e) {
Throwables.propagateIfPossible(e.getCause(),
ActionExecutionException.class, InterruptedException.class);