Skip to content

Commit

Permalink
Delete non-interning, non-singleton @AutoCodec.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 407710469
  • Loading branch information
Googler authored and copybara-github committed Nov 5, 2021
1 parent 2dd6566 commit c2a9395
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@ interface StringChunk {

/** A plain text chunk of a string (containing no variables). */
@Immutable
@AutoCodec
@VisibleForSerialization
static class StringLiteralChunk implements StringChunk, Serializable {
private static class StringLiteralChunk implements StringChunk {
private final String text;

@VisibleForSerialization
StringLiteralChunk(String text) {
this.text = text;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
import com.google.devtools.build.lib.rules.proto.ProtoSourceFileExcludeList;
import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData;
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.FileType;
import com.google.devtools.build.lib.vfs.PathFragment;
import java.io.Serializable;
Expand Down Expand Up @@ -110,7 +111,7 @@ private static LabelLateBoundDefault<ProtoConfiguration> getProtoToolchainLabel(

private static final String J2OBJC_PROTO_TOOLCHAIN_ATTR = ":j2objc_proto_toolchain";

@AutoCodec @AutoCodec.VisibleForSerialization
@SerializationConstant @AutoCodec.VisibleForSerialization
static final LabelLateBoundDefault<?> DEAD_CODE_REPORT =
LabelLateBoundDefault.fromTargetConfiguration(
J2ObjcConfiguration.class,
Expand Down Expand Up @@ -689,7 +690,8 @@ private static List<? extends J2ObjcMappingFileProvider> getJ2ObjCMappings(RuleC
}

private static void addJ2ObjCMappingsForAttribute(
ImmutableList.Builder<J2ObjcMappingFileProvider> builder, RuleContext context,
ImmutableList.Builder<J2ObjcMappingFileProvider> builder,
RuleContext context,
String attributeName) {
if (context.attributes().has(attributeName, BuildType.LABEL_LIST)) {
for (TransitiveInfoCollection dependencyInfoDatum : context.getPrerequisites(attributeName)) {
Expand All @@ -716,16 +718,14 @@ private static Artifact j2ObjcOutputArchiveSourceMappingFile(RuleContext ruleCon
}

private static Artifact j2ObjcSourceJarTranslatedSourceTreeArtifact(RuleContext ruleContext) {
PathFragment rootRelativePath = ruleContext
.getUniqueDirectory("_j2objc/src_jar_files")
.getRelative("source_files");
PathFragment rootRelativePath =
ruleContext.getUniqueDirectory("_j2objc/src_jar_files").getRelative("source_files");
return ruleContext.getTreeArtifact(rootRelativePath, ruleContext.getBinOrGenfilesDirectory());
}

/**
* Returns a unique path fragment for j2objc headers. The slightly shorter path is
* useful for very large app builds, which otherwise may have command lines that are
* too long to be executable.
* Returns a unique path fragment for j2objc headers. The slightly shorter path is useful for very
* large app builds, which otherwise may have command lines that are too long to be executable.
*/
private static String j2objcHeaderBase(RuleContext ruleContext) {
boolean shorterPath =
Expand All @@ -750,9 +750,8 @@ private static J2ObjcSource javaJ2ObjcSource(
ImmutableList<Artifact> javaSourceJarFiles) {
PathFragment objcFileRootRelativePath =
ruleContext.getUniqueDirectory(j2objcHeaderBase(ruleContext));
PathFragment objcFileRootExecPath = ruleContext
.getBinFragment()
.getRelative(objcFileRootRelativePath);
PathFragment objcFileRootExecPath =
ruleContext.getBinFragment().getRelative(objcFileRootRelativePath);

// Note that these are mutable lists so that we can add the translated file info below.
List<Artifact> objcSrcs =
Expand Down Expand Up @@ -817,8 +816,9 @@ private static List<Artifact> getOutputObjcFiles(
String suffix) {
List<Artifact> objcSources = new ArrayList<>();
for (Artifact javaSrc : javaSrcs) {
objcSources.add(ruleContext.getRelatedArtifact(
objcFileRootRelativePath.getRelative(javaSrc.getExecPath()), suffix));
objcSources.add(
ruleContext.getRelatedArtifact(
objcFileRootRelativePath.getRelative(javaSrc.getExecPath()), suffix));
}
return objcSources;
}
Expand Down

0 comments on commit c2a9395

Please sign in to comment.