diff options
author | 2018-06-08 12:51:58 -0700 | |
---|---|---|
committer | 2018-06-08 12:53:15 -0700 | |
commit | 45b308a62f42c2c0bcfe79dcd4046c4025a31059 (patch) | |
tree | 176fc0a10fa37906864e952d833966298ccab727 /src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java | |
parent | c44a87b0736c671e07e62f8b09c8e61775543ded (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/ArtifactFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java | 11 |
1 files changed, 5 insertions, 6 deletions
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 6913091c73..fbf3ec00d3 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 @@ -53,11 +53,11 @@ class ArtifactFunction implements SkyFunction { @Override public SkyValue compute(SkyKey skyKey, Environment env) throws ArtifactFunctionException, InterruptedException { - ArtifactSkyKey artifactSkyKey = (ArtifactSkyKey) skyKey.argument(); - Artifact artifact = artifactSkyKey.getArtifact(); + Artifact artifact = ArtifactSkyKey.artifact(skyKey); + boolean isMandatory = ArtifactSkyKey.isMandatory(skyKey); if (artifact.isSourceArtifact()) { try { - return createSourceValue(artifact, artifactSkyKey.isMandatory(), env); + return createSourceValue(artifact, isMandatory, env); } catch (MissingInputFileException e) { // The error is not necessarily truly transient, but we mark it as such because we have // the above side effect of posting an event to the EventBus. Importantly, that event @@ -279,8 +279,7 @@ class ArtifactFunction implements SkyFunction { throws InterruptedException { // This artifact aggregates other artifacts. Keep track of them so callers can find them. ImmutableList.Builder<Pair<Artifact, FileArtifactValue>> inputs = ImmutableList.builder(); - for (Map.Entry<SkyKey, SkyValue> entry : - env.getValues(ArtifactSkyKey.mandatoryKeys(action.getInputs())).entrySet()) { + for (Map.Entry<SkyKey, SkyValue> entry : env.getValues(action.getInputs()).entrySet()) { Artifact input = ArtifactSkyKey.artifact(entry.getKey()); SkyValue inputValue = entry.getValue(); Preconditions.checkNotNull(inputValue, "%s has null dep %s", artifact, input); @@ -316,7 +315,7 @@ class ArtifactFunction implements SkyFunction { @Override public String extractTag(SkyKey skyKey) { - return Label.print(((ArtifactSkyKey) skyKey.argument()).getArtifact().getOwner()); + return Label.print(ArtifactSkyKey.artifact(skyKey).getOwner()); } @VisibleForTesting |