Skip to content

Commit

Permalink
Delete non-interning, non-singleton @AutoCodec.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 410130440
  • Loading branch information
Googler authored and copybara-github committed Nov 16, 2021
1 parent 9e9d7bf commit e5b3536
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.google.common.io.BaseEncoding;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.SerializationConstant;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.vfs.DigestUtils;
import com.google.devtools.build.lib.vfs.FileStatus;
Expand Down Expand Up @@ -177,14 +177,17 @@ protected boolean couldBeModifiedByMetadata(FileArtifactValue lastKnown) {
*/
interface Singleton {}

@AutoCodec public static final FileArtifactValue DEFAULT_MIDDLEMAN = new SingletonMarkerValue();
@SerializationConstant
public static final FileArtifactValue DEFAULT_MIDDLEMAN = new SingletonMarkerValue();
/** Data that marks that a file is not present on the filesystem. */
@AutoCodec public static final FileArtifactValue MISSING_FILE_MARKER = new SingletonMarkerValue();
@SerializationConstant
public static final FileArtifactValue MISSING_FILE_MARKER = new SingletonMarkerValue();
/**
* Represents an omitted file -- we are aware of it but it doesn't exist. All access methods are
* unsupported.
*/
@AutoCodec public static final FileArtifactValue OMITTED_FILE_MARKER = new OmittedFileValue();
@SerializationConstant
public static final FileArtifactValue OMITTED_FILE_MARKER = new OmittedFileValue();

public static FileArtifactValue createForSourceArtifact(Artifact artifact, FileValue fileValue)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.util.Locale;
Expand Down Expand Up @@ -175,7 +174,6 @@ private static ImmutableSortedSet<String> getOrderedExcludes(@Nullable Set<Strin
: ImmutableSortedSet.copyOf(Ordering.natural(), excludes);
}

@AutoCodec
@AutoValue
abstract static class DirectoryTraversalParams implements FilesetTraversalParams {
@Override
Expand Down Expand Up @@ -208,7 +206,8 @@ public void fingerprint(Fingerprint fp) {
fp.addBytes(getFingerprint());
}

static DirectoryTraversalParams getDirectoryTraversalParams(Label ownerLabel,
static DirectoryTraversalParams getDirectoryTraversalParams(
Label ownerLabelForErrorMessages,
DirectTraversalRoot root,
boolean isPackage,
PathFragment destPath,
Expand All @@ -221,22 +220,14 @@ static DirectoryTraversalParams getDirectoryTraversalParams(Label ownerLabel,
DirectTraversal traversal = DirectTraversal.getDirectTraversal(root, isPackage,
symlinkBehaviorMode == SymlinkBehavior.DEREFERENCE, pkgBoundaryMode, strictFilesetOutput,
isRecursive, isGenerated);
return create(ownerLabel, destPath, getOrderedExcludes(excludes), Optional.of(traversal));
}

@AutoCodec.VisibleForSerialization
@AutoCodec.Instantiator
static DirectoryTraversalParams create(
Label ownerLabelForErrorMessages,
PathFragment destPath,
ImmutableSortedSet<String> excludedFiles,
Optional<DirectTraversal> directTraversal) {
return new AutoValue_FilesetTraversalParamsFactory_DirectoryTraversalParams(
ownerLabelForErrorMessages, destPath, excludedFiles, directTraversal);
ownerLabelForErrorMessages,
destPath,
getOrderedExcludes(excludes),
Optional.of(traversal));
}
}

@AutoCodec
@AutoValue
abstract static class NestedTraversalParams implements FilesetTraversalParams {
@Override
Expand Down Expand Up @@ -270,26 +261,15 @@ public void fingerprint(Fingerprint fp) {
}

static NestedTraversalParams getNestedTraversal(
Label ownerLabel,
Label ownerLabelForErrorMessages,
Artifact nestedArtifact,
PathFragment destPath,
@Nullable Set<String> excludes) {
return create(ownerLabel, destPath, getOrderedExcludes(excludes), nestedArtifact);
}

@AutoCodec.VisibleForSerialization
@AutoCodec.Instantiator
static NestedTraversalParams create(
Label ownerLabelForErrorMessages,
PathFragment destPath,
ImmutableSortedSet<String> excludedFiles,
Artifact nestedArtifact) {
return new AutoValue_FilesetTraversalParamsFactory_NestedTraversalParams(
ownerLabelForErrorMessages, destPath, excludedFiles, nestedArtifact);
ownerLabelForErrorMessages, destPath, getOrderedExcludes(excludes), nestedArtifact);
}
}

@AutoCodec
@AutoValue
abstract static class KnownLinksTraversalParams implements FilesetTraversalParams {
@Override
Expand Down Expand Up @@ -323,22 +303,12 @@ public void fingerprint(Fingerprint fp) {
}

static KnownLinksTraversalParams getKnownLinksTraversal(
Label ownerLabel,
Label ownerLabelForErrorMessages,
LinkSupplier additionalLinks,
PathFragment destPath,
@Nullable Set<String> excludes) {
return create(ownerLabel, destPath, getOrderedExcludes(excludes), additionalLinks);
}

@AutoCodec.VisibleForSerialization
@AutoCodec.Instantiator
static KnownLinksTraversalParams create(
Label ownerLabelForErrorMessages,
PathFragment destPath,
ImmutableSortedSet<String> excludedFiles,
LinkSupplier additionalLinks) {
return new AutoValue_FilesetTraversalParamsFactory_KnownLinksTraversalParams(
ownerLabelForErrorMessages, destPath, excludedFiles, additionalLinks);
ownerLabelForErrorMessages, destPath, getOrderedExcludes(excludes), additionalLinks);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import net.starlark.java.syntax.Location;

/** Supports ctx.actions.args() from Starlark. */
@AutoCodec
public class StarlarkCustomCommandLine extends CommandLine {

protected final ImmutableList<Object> arguments;
Expand Down Expand Up @@ -680,9 +679,7 @@ StarlarkCustomCommandLine build(boolean flagPerLine) {
}
}

@AutoCodec.VisibleForSerialization
@AutoCodec.Instantiator
StarlarkCustomCommandLine(ImmutableList<Object> arguments) {
private StarlarkCustomCommandLine(ImmutableList<Object> arguments) {
this.arguments = arguments;
}

Expand Down Expand Up @@ -718,9 +715,7 @@ private static class StarlarkCustomCommandLineWithIndexes extends StarlarkCustom
*/
private final ImmutableList<Integer> argStartIndexes;

@AutoCodec.VisibleForSerialization
@AutoCodec.Instantiator
public StarlarkCustomCommandLineWithIndexes(
StarlarkCustomCommandLineWithIndexes(
ImmutableList<Object> arguments, ImmutableList<Integer> argStartIndexes) {
super(arguments);
this.argStartIndexes = argStartIndexes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.collect.CollectionUtils;
import com.google.devtools.build.lib.concurrent.ThreadSafety;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization;

/** Factory for creating new {@link LinkerInput} objects. */
public abstract class LinkerInputs {
Expand All @@ -31,15 +29,13 @@ public abstract class LinkerInputs {
* object file.
*/
@ThreadSafety.Immutable
@AutoCodec
public static class SimpleLinkerInput implements LinkerInput {
private static class SimpleLinkerInput implements LinkerInput {
private final Artifact artifact;
private final ArtifactCategory category;
private final boolean disableWholeArchive;
private final String libraryIdentifier;

@AutoCodec.Instantiator
public SimpleLinkerInput(
SimpleLinkerInput(
Artifact artifact,
ArtifactCategory category,
boolean disableWholeArchive,
Expand Down Expand Up @@ -175,14 +171,11 @@ public interface LibraryToLink extends LinkerInput {
* library that it links to.
*/
@ThreadSafety.Immutable
@AutoCodec
public static class SolibLibraryToLink implements LibraryToLink {
private static class SolibLibraryToLink implements LibraryToLink {
private final Artifact solibSymlinkArtifact;
private final Artifact libraryArtifact;
private final String libraryIdentifier;

@AutoCodec.Instantiator
@VisibleForSerialization
SolibLibraryToLink(
Artifact solibSymlinkArtifact, Artifact libraryArtifact, String libraryIdentifier) {
Preconditions.checkArgument(
Expand Down Expand Up @@ -272,9 +265,7 @@ public boolean disableWholeArchive() {

/** This class represents a library that may contain object files. */
@ThreadSafety.Immutable
@AutoCodec
@VisibleForSerialization
static class CompoundLibraryToLink implements LibraryToLink {
private static class CompoundLibraryToLink implements LibraryToLink {
private final Artifact libraryArtifact;
private final ArtifactCategory category;
private final String libraryIdentifier;
Expand All @@ -284,28 +275,7 @@ static class CompoundLibraryToLink implements LibraryToLink {
private final boolean mustKeepDebug;
private final boolean disableWholeArchive;

@AutoCodec.Instantiator
@VisibleForSerialization
CompoundLibraryToLink(
Artifact libraryArtifact,
ArtifactCategory category,
String libraryIdentifier,
Iterable<Artifact> objectFiles,
LtoCompilationContext ltoCompilationContext,
ImmutableMap<Artifact, LtoBackendArtifacts> sharedNonLtoBackends,
boolean mustKeepDebug,
boolean disableWholeArchive) {
this.libraryArtifact = libraryArtifact;
this.category = category;
this.libraryIdentifier = libraryIdentifier;
this.objectFiles = objectFiles;
this.ltoCompilationContext = ltoCompilationContext;
this.sharedNonLtoBackends = sharedNonLtoBackends;
this.mustKeepDebug = mustKeepDebug;
this.disableWholeArchive = disableWholeArchive;
}

private CompoundLibraryToLink(
Artifact libraryArtifact,
ArtifactCategory category,
String libraryIdentifier,
Expand Down

0 comments on commit e5b3536

Please sign in to comment.