Remove error code for archived artifacts feature used when discarding orphaned
artifacts.
Change the method exposing information about archived artifact to include the
`ArchivedTreeArtifact` itself rather than just a boolean if it's present.
Add a `remove` method to `TreeArtifactValue.MultiBuilder` to allow deleting
tree artifacts from the builder after adding entries for them.
PiperOrigin-RevId: 333207607
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 093b840..e02e068 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
@@ -99,6 +99,17 @@
}
/**
+ * Removes all of collected data for a given tree artifact.
+ *
+ * <p>No-op if there is no data for a given tree artifact.
+ */
+ public MultiBuilder remove(SpecialArtifact treeArtifact) {
+ checkArgument(treeArtifact.isTreeArtifact(), "Not a tree artifact: %s", treeArtifact);
+ map.remove(treeArtifact);
+ return this;
+ }
+
+ /**
* For each unique parent seen by this builder, passes the aggregated metadata to {@link
* TreeArtifactInjector#injectTree}.
*/
@@ -189,8 +200,11 @@
}
@VisibleForTesting
- public boolean hasArchivedArtifactForTesting() {
- return archivedRepresentation != null;
+ @Nullable
+ public ArchivedTreeArtifact getArchivedArtifactForTesting() {
+ return archivedRepresentation != null
+ ? archivedRepresentation.archivedTreeFileArtifact()
+ : null;
}
ImmutableMap<TreeFileArtifact, FileArtifactValue> getChildValues() {