Create a clearer distinction between normal tree artifact children and action template expansion outputs.
Two different factory methods are used: createTreeOutput for normal tree artifact children and createTemplateExpansionOutput for template expansion outputs. Additional documentation and validation is added for action templates to ensure that implementations follow the contract.
After this, I plan to add a method on TreeFileArtifact to distinguish between the two so that various places can properly treat these two different tree file artifact types differently instead of always having to handle both possibilities.
A lot of tests needed to be cleaned up, but the only test that needed a major overhaul was TreeArtifactBuildTest since it was generally declaring the outputs before creating the action.
RELNOTES: None.
PiperOrigin-RevId: 312128057
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java
index 1cb1ef0..a7a0bdb 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteCache.java
@@ -39,7 +39,6 @@
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.devtools.build.lib.actions.ActionInput;
-import com.google.devtools.build.lib.actions.ActionInputHelper;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.Artifact.SpecialArtifact;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
@@ -619,7 +618,7 @@
ImmutableMap.builderWithExpectedSize(directory.files.size());
for (FileMetadata file : directory.files()) {
TreeFileArtifact child =
- ActionInputHelper.treeFileArtifact(parent, file.path().relativeTo(parent.getPath()));
+ TreeFileArtifact.createTreeOutput(parent, file.path().relativeTo(parent.getPath()));
RemoteFileArtifactValue value =
new RemoteFileArtifactValue(
DigestUtil.toBinaryDigest(file.digest()),