Skip to content

Commit

Permalink
Delete dead code.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 511796738
Change-Id: I5fedd292d26379bda0b6cf669c5deda0037f2470
  • Loading branch information
tjgq authored and copybara-github committed Feb 23, 2023
1 parent e2597ca commit 22ae3a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@

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;
import com.google.devtools.build.lib.vfs.Path;
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.
Expand Down Expand Up @@ -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.
*
* <p>The returned value is non-null if and only if {@link #getNestedArtifact} is null and {@link
* #additionalLinks} is null.
* <p>The returned value is non-null if and only if {@link #getNestedArtifact} is null.
*/
@Nullable
DirectTraversal getDirectTraversal();
Expand All @@ -295,36 +289,11 @@ static DirectTraversal getDirectTraversal(
*
* <p>A nested traversal is the traversal of another Fileset referenced by FilesetEntry.srcdir.
*
* <p>The value is non-null when {@link #getDirectTraversal} is absent and
* {@link #additionalLinks} is null.
* <p>The value is non-null when {@link #getDirectTraversal} is absent.
*/
@Nullable
Artifact getNestedArtifact();

/**
* Returns a {@link LinkSupplier} to add a customized collection of links.
*
* <p>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<FilesetOutputSymlink> getLinks(
EventHandler handler,
Location location,
ArtifactExpander artifactExpander,
MetadataProvider metadataProvider)
throws IOException;

void fingerprint(Fingerprint fp);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> excludes) {
return KnownLinksTraversalParams.getKnownLinksTraversal(ownerLabel, linkSupplier, destPath,
excludes);
}



private static ImmutableSortedSet<String> getOrderedExcludes(@Nullable Set<String> excludes) {
// Order the set for the sake of deterministic fingerprinting.
return excludes == null
Expand All @@ -180,11 +158,6 @@ public Artifact getNestedArtifact() {
return null;
}

@Override
public LinkSupplier additionalLinks() {
return null;
}

@Memoized
@Override
public abstract int hashCode();
Expand Down Expand Up @@ -231,11 +204,6 @@ public DirectTraversal getDirectTraversal() {
return null;
}

@Override
public LinkSupplier additionalLinks() {
return null;
}

@Memoized
@Override
public abstract int hashCode();
Expand Down Expand Up @@ -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<String> excludes) {
return new AutoValue_FilesetTraversalParamsFactory_KnownLinksTraversalParams(
ownerLabelForErrorMessages, destPath, getOrderedExcludes(excludes), additionalLinks);
}
}
}

0 comments on commit 22ae3a6

Please sign in to comment.