diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java | 7 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionValue.java | 20 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java b/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java index 468fb272cf..635c1b51dd 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/buildinfo/BuildInfoFactory.java @@ -17,6 +17,8 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.ArtifactRoot; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.cmdline.RepositoryName; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.lib.vfs.PathFragment; import java.io.Serializable; @@ -54,7 +56,10 @@ public interface BuildInfoFactory extends Serializable { * Build-info key for lookup from the {@link * com.google.devtools.build.lib.analysis.AnalysisEnvironment}. */ - final class BuildInfoKey implements Serializable { + @AutoCodec + final class BuildInfoKey { + public static final ObjectCodec<BuildInfoKey> CODEC = + new BuildInfoFactory_BuildInfoKey_AutoCodec(); private final String name; public BuildInfoKey(String name) { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionValue.java index 09ce2dbb2e..b96e94b32b 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/BuildInfoCollectionValue.java @@ -22,6 +22,8 @@ import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.concurrent.BlazeInterners; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; import com.google.devtools.build.skyframe.SkyFunctionName; import java.util.Objects; @@ -49,17 +51,19 @@ public class BuildInfoCollectionValue extends ActionLookupValue { return getStringHelper().add("collection", collection).toString(); } - private static final Interner<BuildInfoKeyAndConfig> keyInterner = - BlazeInterners.newWeakInterner(); - public static BuildInfoKeyAndConfig key( BuildInfoFactory.BuildInfoKey key, BuildConfiguration config) { - return keyInterner.intern( - new BuildInfoKeyAndConfig(key, ConfiguredTargetKey.keyFromConfiguration(config).key)); + return BuildInfoKeyAndConfig.create(key, ConfiguredTargetKey.keyFromConfiguration(config).key); } /** Key for BuildInfoCollectionValues. */ + @AutoCodec public static class BuildInfoKeyAndConfig extends ActionLookupKey { + private static final Interner<BuildInfoKeyAndConfig> keyInterner = + BlazeInterners.newWeakInterner(); + public static final ObjectCodec<BuildInfoKeyAndConfig> CODEC = + new BuildInfoCollectionValue_BuildInfoKeyAndConfig_AutoCodec(); + private final BuildInfoFactory.BuildInfoKey infoKey; private final BuildConfigurationValue.Key configKey; @@ -69,6 +73,12 @@ public class BuildInfoCollectionValue extends ActionLookupValue { this.configKey = Preconditions.checkNotNull(configKey, key); } + @AutoCodec.Instantiator + static BuildInfoKeyAndConfig create( + BuildInfoFactory.BuildInfoKey infoKey, BuildConfigurationValue.Key configKey) { + return keyInterner.intern(new BuildInfoKeyAndConfig(infoKey, configKey)); + } + @Override public SkyFunctionName functionName() { return SkyFunctions.BUILD_INFO_COLLECTION; |