Skip to content

Commit

Permalink
Refactor FilesetManifest to be an inner class of FilesetOutputTree.
Browse files Browse the repository at this point in the history
The only way to construct a `FilesetManifest` now is to go through the `FilesetOutputTree`. This ensures a consistent way of consuming the symlinks in a fileset and makes followup optimizations easier.

This change is just moving code around and does not change behavior.

PiperOrigin-RevId: 681876046
Change-Id: I3060d14a4b87b0dbb769d99b1be4274358626f3c
  • Loading branch information
justinhorvitz authored and copybara-github committed Oct 3, 2024
1 parent b43d9a6 commit a55dc56
Show file tree
Hide file tree
Showing 19 changed files with 614 additions and 629 deletions.
15 changes: 11 additions & 4 deletions src/main/java/com/google/devtools/build/lib/actions/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ java_library(
"ExecException.java",
"Executor.java",
"FailAction.java",
"FilesetManifest.java",
"FilesetTraversalParams.java",
"FilesetTraversalParamsFactory.java",
"ForbiddenActionInputException.java",
"FullSpawnMetrics.java",
"HasDigest.java",
"InputFileErrorException.java",
Expand Down Expand Up @@ -154,7 +152,6 @@ java_library(
":commandline_item",
":execution_requirements",
":file_metadata",
":fileset_output_symlink",
":fileset_output_tree",
":localhost_capacity",
":middleman_type",
Expand Down Expand Up @@ -205,7 +202,6 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:ospathpolicy",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//src/main/java/com/google/devtools/common/options",
"//src/main/java/net/starlark/java/eval",
Expand Down Expand Up @@ -403,7 +399,13 @@ java_library(
name = "fileset_output_tree",
srcs = ["FilesetOutputTree.java"],
deps = [
":file_metadata",
":fileset_output_symlink",
":forbidden_action_input_exception",
"//src/main/java/com/google/devtools/build/lib/vfs",
"//src/main/java/com/google/devtools/build/lib/vfs:pathfragment",
"//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
"//third_party:flogger",
"//third_party:guava",
],
)
Expand All @@ -421,6 +423,11 @@ java_library(
],
)

java_library(
name = "forbidden_action_input_exception",
srcs = ["ForbiddenActionInputException.java"],
)

java_library(
name = "runfiles_metadata",
srcs = ["RunfilesArtifactValue.java"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import static com.google.common.base.Preconditions.checkState;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Maps;
import com.google.devtools.build.lib.actions.Artifact.ArchivedTreeArtifact;
import com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact;
import com.google.devtools.build.lib.actions.FilesetManifest.RelativeSymlinkBehaviorWithoutError;
import com.google.devtools.build.lib.actions.FilesetOutputTree.FilesetManifest;
import com.google.devtools.build.lib.actions.FilesetOutputTree.RelativeSymlinkBehaviorWithoutError;
import com.google.devtools.build.lib.bugreport.BugReport;
import com.google.devtools.build.lib.bugreport.BugReporter;
import com.google.devtools.build.lib.skyframe.TreeArtifactValue;
Expand Down Expand Up @@ -174,10 +174,9 @@ public void visitArtifacts(Iterable<Artifact> artifacts, ArtifactReceiver receiv
}

private void visitFileset(Artifact filesetArtifact, ArtifactReceiver receiver) {
ImmutableList<FilesetOutputSymlink> links = filesets.get(filesetArtifact).symlinks();
FilesetOutputTree filesetOutput = filesets.get(filesetArtifact);
FilesetManifest filesetManifest =
FilesetManifest.constructFilesetManifestWithoutError(
links,
filesetOutput.constructFilesetManifestWithoutError(
PathFragment.EMPTY_FRAGMENT,
fullyResolveFilesetLinks
? RelativeSymlinkBehaviorWithoutError.RESOLVE_FULLY
Expand Down

This file was deleted.

Loading

0 comments on commit a55dc56

Please sign in to comment.