Remove duplicate TreeArtifactValue getSelfData method. It is the same as getMetadata, so no need for two methods. For consistency, rename getSelfData in AggregatingArtifactValue to getMetadata as well. RELNOTES: None. PiperOrigin-RevId: 317159082
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 f7002e3..0324815 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
@@ -1076,7 +1076,7 @@ treeValue.getChildValues().entrySet()) { inputData.putWithNoDepOwner(child.getKey(), child.getValue()); } - inputData.putWithNoDepOwner(input, treeValue.getSelfData()); + inputData.putWithNoDepOwner(input, treeValue.getMetadata()); } else if (retrievedMetadata instanceof ActionExecutionValue) { inputData.putWithNoDepOwner( input, ((ActionExecutionValue) retrievedMetadata).getExistingFileArtifactValue(input));
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java index 5f1d89e..a8d054f 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionInputMapHelper.java
@@ -72,9 +72,9 @@ inputMap, /*depOwner=*/ key); } - // We have to cache the "digest" of the aggregating value itself, - // because the action cache checker may want it. - inputMap.put(key, aggregatingValue.getSelfData(), /*depOwner=*/ key); + // We have to cache the "digest" of the aggregating value itself, because the action cache + // checker may want it. + inputMap.put(key, aggregatingValue.getMetadata(), /*depOwner=*/ key); // While not obvious at all this code exists to ensure that we don't expand the // .runfiles/MANIFEST file into the inputs. The reason for that being that the MANIFEST // file contains absolute paths that don't work with remote execution. @@ -171,6 +171,6 @@ } expandedArtifacts.put(treeArtifact, children.build()); // Again, we cache the "digest" of the value for cache checking. - inputMap.put(treeArtifact, value.getSelfData(), depOwner); + inputMap.put(treeArtifact, value.getMetadata(), depOwner); } }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/AggregatingArtifactValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/AggregatingArtifactValue.java index 4b9c55b..1cbc73a 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/AggregatingArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/AggregatingArtifactValue.java
@@ -23,17 +23,17 @@ /** Value for aggregating artifacts, which must be expanded to a set of other artifacts. */ class AggregatingArtifactValue implements SkyValue { - private final FileArtifactValue selfData; private final ImmutableList<Pair<Artifact, FileArtifactValue>> fileInputs; private final ImmutableList<Pair<Artifact, TreeArtifactValue>> directoryInputs; + private final FileArtifactValue metadata; AggregatingArtifactValue( ImmutableList<Pair<Artifact, FileArtifactValue>> fileInputs, ImmutableList<Pair<Artifact, TreeArtifactValue>> directoryInputs, - FileArtifactValue selfData) { + FileArtifactValue metadata) { this.fileInputs = Preconditions.checkNotNull(fileInputs); this.directoryInputs = Preconditions.checkNotNull(directoryInputs); - this.selfData = Preconditions.checkNotNull(selfData); + this.metadata = Preconditions.checkNotNull(metadata); } /** Returns the none tree artifacts that this artifact expands to, together with their data. */ @@ -50,8 +50,8 @@ } /** Returns the data of the artifact for this value, as computed by the action cache checker. */ - FileArtifactValue getSelfData() { - return selfData; + FileArtifactValue getMetadata() { + return metadata; } @SuppressWarnings("EqualsGetClass") // RunfilesArtifactValue not equal to Aggregating. @@ -64,13 +64,13 @@ return false; } AggregatingArtifactValue that = (AggregatingArtifactValue) o; - return selfData.equals(that.selfData) + return metadata.equals(that.metadata) && fileInputs.equals(that.fileInputs) && directoryInputs.equals(that.directoryInputs); } @Override public int hashCode() { - return 31 * 31 * directoryInputs.hashCode() + 31 * fileInputs.hashCode() + selfData.hashCode(); + return 31 * 31 * directoryInputs.hashCode() + 31 * fileInputs.hashCode() + metadata.hashCode(); } }
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 index ebb4acf..5d78d76 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/RunfilesArtifactValue.java
@@ -19,11 +19,11 @@ import com.google.devtools.build.lib.util.Pair; /** The artifacts behind a runfiles middleman. */ -class RunfilesArtifactValue extends AggregatingArtifactValue { +final class RunfilesArtifactValue extends AggregatingArtifactValue { RunfilesArtifactValue( ImmutableList<Pair<Artifact, FileArtifactValue>> fileInputs, ImmutableList<Pair<Artifact, TreeArtifactValue>> directoryInputs, - FileArtifactValue selfData) { - super(fileInputs, directoryInputs, selfData); + FileArtifactValue metadata) { + super(fileInputs, directoryInputs, metadata); } }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java index 258a96c..9587c22 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/TreeArtifactValue.java
@@ -96,12 +96,8 @@ entirelyRemote); } - FileArtifactValue getSelfData() { - return FileArtifactValue.createProxy(digest); - } - FileArtifactValue getMetadata() { - return getSelfData(); + return FileArtifactValue.createProxy(digest); } ImmutableSet<PathFragment> getChildPaths() { @@ -176,11 +172,6 @@ private static TreeArtifactValue createMarker(String toStringRepresentation) { return new TreeArtifactValue(null, ImmutableSortedMap.of(), /*entirelyRemote=*/ false) { @Override - FileArtifactValue getSelfData() { - throw new UnsupportedOperationException(toString()); - } - - @Override public ImmutableSet<TreeFileArtifact> getChildren() { throw new UnsupportedOperationException(toString()); }