Skip to content

Commit

Permalink
Remove OutputMetadataStore.getTreeArtifactChildren().
Browse files Browse the repository at this point in the history
It was only a thin wrapper around .getTreeArtifactValue().

RELNOTES: None.
PiperOrigin-RevId: 690648081
Change-Id: I4b84ebc1a381ca8298dff2652ec60e00911294e0
  • Loading branch information
lberki authored and copybara-github committed Oct 28, 2024
1 parent 6d0a834 commit 5107b62
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ private TestAttemptResult runTestAttempt(
ImmutableSet<? extends ActionInput> expandedCoverageDir =
actionExecutionContext
.getOutputMetadataStore()
.getTreeArtifactChildren(
(SpecialArtifact) testAction.getCoverageDirectoryTreeArtifact());
.getTreeArtifactValue((SpecialArtifact) testAction.getCoverageDirectoryTreeArtifact())
.getChildren();
ImmutableSet<ActionInput> coverageSpawnMetadata =
ImmutableSet.<ActionInput>builder()
.addAll(expandedCoverageDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,8 @@ public void finalizeAction(Action action, OutputMetadataStore outputMetadataStor
}

if (output.isTreeArtifact()) {
var children = outputMetadataStore.getTreeArtifactChildren((SpecialArtifact) output);
var children =
outputMetadataStore.getTreeArtifactValue((SpecialArtifact) output).getChildren();
for (var file : children) {
if (remoteOutputChecker.shouldDownloadOutput(file)) {
outputsToDownload.add(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ public void finalizeAction(Action action, OutputMetadataStore outputMetadataStor

if (output.isTreeArtifact()) {
// TODO(chiwang): Use TreeArtifactLocator
var children = outputMetadataStore.getTreeArtifactChildren((SpecialArtifact) output);
var children =
outputMetadataStore.getTreeArtifactValue((SpecialArtifact) output).getChildren();
for (var child : children) {
addArtifact(outputMetadataStore, execRoot, outputPath, request, child);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void createsTreeArtifactValueFromFilesystem() throws Exception {
assertThat(tree.getMetadata()).isEqualTo(treeMetadata);
assertThat(tree.getChildValues())
.containsExactly(child1, child1Metadata, child2, child2Metadata);
assertThat(store.getTreeArtifactChildren(treeArtifact)).isEqualTo(tree.getChildren());
assertThat(store.getTreeArtifactValue(treeArtifact)).isEqualTo(tree);
assertThat(store.getAllArtifactData()).isEmpty();
assertThat(chmodCalls).isEmpty();
}
Expand Down Expand Up @@ -390,7 +390,7 @@ public void injectRemoteTreeArtifactMetadata() throws Exception {
assertThat(store.getAllTreeArtifactData().get(treeArtifact)).isEqualTo(tree);
assertThat(chmodCalls).isEmpty();

assertThat(store.getTreeArtifactChildren(treeArtifact)).isEqualTo(tree.getChildren());
assertThat(store.getTreeArtifactValue(treeArtifact)).isEqualTo(tree);

// Make sure that all children are transferred properly into the ActionExecutionValue. If any
// child is missing, getExistingFileArtifactValue will throw.
Expand Down Expand Up @@ -699,7 +699,7 @@ public void outputTreeArtifactNotPreviouslyInjectedInExecutionMode() throws Exce
assertThat(tree.getMetadata()).isEqualTo(treeMetadata);
assertThat(tree.getChildValues())
.containsExactly(child1, child1Metadata, child2, child2Metadata);
assertThat(store.getTreeArtifactChildren(treeArtifact)).isEqualTo(tree.getChildren());
assertThat(store.getTreeArtifactValue(treeArtifact)).isEqualTo(tree);
assertThat(store.getAllArtifactData()).isEmpty();
assertThat(chmodCalls)
.containsExactly(
Expand All @@ -713,15 +713,6 @@ public void outputTreeArtifactNotPreviouslyInjectedInExecutionMode() throws Exce
0555);
}

@Test
public void getTreeArtifactChildren_noData_returnsEmptySet() {
SpecialArtifact treeArtifact =
ActionsTestUtil.createTreeArtifactWithGeneratingAction(
outputRoot, PathFragment.create("tree"));
ActionOutputMetadataStore store = createStore(/* outputs= */ ImmutableSet.of(treeArtifact));
assertThat(store.getTreeArtifactChildren(treeArtifact)).isEmpty();
}

@Test
public void enteringExecutionModeClearsCachedOutputs() throws Exception {
Artifact artifact =
Expand Down

0 comments on commit 5107b62

Please sign in to comment.