diff --git a/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParams.java b/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParams.java index 9d3321bd10fd6b..ec9dcde9b5049d 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParams.java +++ b/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParams.java @@ -15,11 +15,8 @@ import com.google.auto.value.AutoValue; import com.google.auto.value.extension.memoized.Memoized; -import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedSet; -import com.google.devtools.build.lib.actions.Artifact.ArtifactExpander; import com.google.devtools.build.lib.cmdline.Label; -import com.google.devtools.build.lib.events.EventHandler; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.Instantiator; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization; import com.google.devtools.build.lib.util.Fingerprint; @@ -27,10 +24,8 @@ import com.google.devtools.build.lib.vfs.PathFragment; import com.google.devtools.build.lib.vfs.Root; import com.google.devtools.build.lib.vfs.RootedPath; -import java.io.IOException; import java.util.Objects; import javax.annotation.Nullable; -import net.starlark.java.syntax.Location; /** * Parameters of a filesystem traversal requested by a Fileset rule. @@ -284,8 +279,7 @@ static DirectTraversal getDirectTraversal( * directory (when FilesetEntry.srcdir is specified) or traversal of a single file (when * FilesetEntry.files is specified). See {@link DirectTraversal} for more detail. * - *

The returned value is non-null if and only if {@link #getNestedArtifact} is null and {@link - * #additionalLinks} is null. + *

The returned value is non-null if and only if {@link #getNestedArtifact} is null. */ @Nullable DirectTraversal getDirectTraversal(); @@ -295,36 +289,11 @@ static DirectTraversal getDirectTraversal( * *

A nested traversal is the traversal of another Fileset referenced by FilesetEntry.srcdir. * - *

The value is non-null when {@link #getDirectTraversal} is absent and - * {@link #additionalLinks} is null. + *

The value is non-null when {@link #getDirectTraversal} is absent. */ @Nullable Artifact getNestedArtifact(); - /** - * Returns a {@link LinkSupplier} to add a customized collection of links. - * - *

The value is non-null when {@link #getDirectTraversal} is absent and - * {@link #getNestedArtifact} is null. - */ - @Nullable - LinkSupplier additionalLinks(); - /** Adds the fingerprint of this traversal object. */ void fingerprint(Fingerprint fp); - - /** - * A {@link LinkSupplier} returns a collection of {@link FilesetOutputSymlink} to include in the - * Fileset. - */ - interface LinkSupplier { - ImmutableList getLinks( - EventHandler handler, - Location location, - ArtifactExpander artifactExpander, - MetadataProvider metadataProvider) - throws IOException; - - void fingerprint(Fingerprint fp); - } } diff --git a/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParamsFactory.java b/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParamsFactory.java index 30a6b444c28150..1477c6d1f2f3b8 100644 --- a/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParamsFactory.java +++ b/src/main/java/com/google/devtools/build/lib/actions/FilesetTraversalParamsFactory.java @@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.Ordering; import com.google.devtools.build.lib.actions.FilesetTraversalParams.DirectTraversalRoot; -import com.google.devtools.build.lib.actions.FilesetTraversalParams.LinkSupplier; import com.google.devtools.build.lib.actions.FilesetTraversalParams.PackageBoundaryMode; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; @@ -145,27 +144,6 @@ public static FilesetTraversalParams nestedTraversal( return NestedTraversalParams.getNestedTraversal(ownerLabel, artifact, destPath, excludes); } - /** - * Creates traversal request parameters for a FilesetEntry returning a customized list of links. - * - * @param ownerLabel the rule that created this object - * @param linkSupplier the {@link LinkSupplier} returning a custom list of links. - * @param destPath path in the Fileset's output directory that will be the root of files coming - * from the nested Fileset - * @param excludes optional; set of files directly below (not in a subdirectory of) the nested - * Fileset that should be excluded from the outer Fileset - */ - public static FilesetTraversalParams knownTraversal( - Label ownerLabel, - LinkSupplier linkSupplier, - PathFragment destPath, - @Nullable Set excludes) { - return KnownLinksTraversalParams.getKnownLinksTraversal(ownerLabel, linkSupplier, destPath, - excludes); - } - - - private static ImmutableSortedSet getOrderedExcludes(@Nullable Set excludes) { // Order the set for the sake of deterministic fingerprinting. return excludes == null @@ -180,11 +158,6 @@ public Artifact getNestedArtifact() { return null; } - @Override - public LinkSupplier additionalLinks() { - return null; - } - @Memoized @Override public abstract int hashCode(); @@ -231,11 +204,6 @@ public DirectTraversal getDirectTraversal() { return null; } - @Override - public LinkSupplier additionalLinks() { - return null; - } - @Memoized @Override public abstract int hashCode(); @@ -265,46 +233,4 @@ static NestedTraversalParams getNestedTraversal( ownerLabelForErrorMessages, destPath, getOrderedExcludes(excludes), nestedArtifact); } } - - @AutoValue - abstract static class KnownLinksTraversalParams implements FilesetTraversalParams { - @Override - public DirectTraversal getDirectTraversal() { - return null; - } - - @Override - public Artifact getNestedArtifact() { - return null; - } - - @Memoized - @Override - public abstract int hashCode(); - - @Memoized - protected byte[] getFingerprint() { - Fingerprint fp = new Fingerprint(); - fp.addPath(getDestPath()); - if (!getExcludedFiles().isEmpty()) { - fp.addStrings(getExcludedFiles()); - } - additionalLinks().fingerprint(fp); - return fp.digestAndReset(); - } - - @Override - public void fingerprint(Fingerprint fp) { - fp.addBytes(getFingerprint()); - } - - static KnownLinksTraversalParams getKnownLinksTraversal( - Label ownerLabelForErrorMessages, - LinkSupplier additionalLinks, - PathFragment destPath, - @Nullable Set excludes) { - return new AutoValue_FilesetTraversalParamsFactory_KnownLinksTraversalParams( - ownerLabelForErrorMessages, destPath, getOrderedExcludes(excludes), additionalLinks); - } - } }