Rename ActionExecutionValue#createSimpleFileArtifactValue and make it an instance method.
The name of the method is misleading because it doesn't create anything new, just gets it from a map. It also asserts that it exists, so rename it to getExistingFileArtifactValue.
Also, make it an instance method. A static method that requires passing in an instance of the class seems awkward.
RELNOTES: None.
PiperOrigin-RevId: 312712401
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
index 76d381b..8017fef 100644
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
+++ b/src/test/java/com/google/devtools/build/lib/skyframe/ArtifactFunctionTest.java
@@ -29,6 +29,7 @@
import com.google.devtools.build.lib.actions.ActionTemplate;
import com.google.devtools.build.lib.actions.Actions;
import com.google.devtools.build.lib.actions.Artifact;
+import com.google.devtools.build.lib.actions.Artifact.DerivedArtifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifactType;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
@@ -313,7 +314,7 @@
@Test
public void actionExecutionValueSerialization() throws Exception {
ActionLookupData dummyData = ActionLookupData.create(ALL_OWNER, 0);
- Artifact.DerivedArtifact artifact1 = createDerivedArtifact("one");
+ DerivedArtifact artifact1 = createDerivedArtifact("one");
FileArtifactValue metadata1 =
ActionMetadataHandler.fileArtifactValueFromArtifact(artifact1, null, null);
SpecialArtifact treeArtifact = createDerivedTreeArtifactOnly("tree");
@@ -326,7 +327,7 @@
TreeArtifactValue.create(
ImmutableMap.of(
treeFileArtifact, FileArtifactValue.createForTesting(treeFileArtifact)));
- Artifact.DerivedArtifact artifact3 = createDerivedArtifact("three");
+ DerivedArtifact artifact3 = createDerivedArtifact("three");
FilesetOutputSymlink filesetOutputSymlink =
FilesetOutputSymlink.createForTesting(
PathFragment.EMPTY_FRAGMENT, PathFragment.EMPTY_FRAGMENT, PathFragment.EMPTY_FRAGMENT);
@@ -355,10 +356,10 @@
ArtifactRoot.asSourceRoot(Root.fromPath(root)), PathFragment.create(path));
}
- private Artifact.DerivedArtifact createDerivedArtifact(String path) {
+ private DerivedArtifact createDerivedArtifact(String path) {
PathFragment execPath = PathFragment.create("out").getRelative(path);
- Artifact.DerivedArtifact output =
- new Artifact.DerivedArtifact(ArtifactRoot.asDerivedRoot(root, "out"), execPath, ALL_OWNER);
+ DerivedArtifact output =
+ new DerivedArtifact(ArtifactRoot.asDerivedRoot(root, "out"), execPath, ALL_OWNER);
actions.add(new DummyAction(NestedSetBuilder.emptySet(Order.STABLE_ORDER), output));
output.setGeneratingActionKey(ActionLookupData.create(ALL_OWNER, actions.size() - 1));
return output;
@@ -367,7 +368,7 @@
private Artifact createMiddlemanArtifact(String path) {
ArtifactRoot middlemanRoot =
ArtifactRoot.middlemanRoot(middlemanPath, middlemanPath.getRelative("out"));
- return new Artifact.DerivedArtifact(
+ return new DerivedArtifact(
middlemanRoot, middlemanRoot.getExecPath().getRelative(path), ALL_OWNER);
}
@@ -433,8 +434,8 @@
}
SkyValue value = result.get(key);
if (value instanceof ActionExecutionValue) {
- return ActionExecutionValue.createSimpleFileArtifactValue(
- (Artifact.DerivedArtifact) artifact, (ActionExecutionValue) value);
+ return ((ActionExecutionValue) value)
+ .getExistingFileArtifactValue((DerivedArtifact) artifact);
}
return value;
}