Add some more codecs to execution-phase SkyKeys.
PiperOrigin-RevId: 185883201
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionValue.java
index b8feb28..8ba11ee 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionTemplateExpansionValue.java
@@ -21,6 +21,8 @@
import com.google.devtools.build.lib.actions.ActionLookupValue;
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;
/**
@@ -34,14 +36,17 @@
super(actionKeyContext, ImmutableList.copyOf(expandedActions), removeActionsAfterEvaluation);
}
- private static final Interner<ActionTemplateExpansionKey> interner =
- BlazeInterners.newWeakInterner();
-
static ActionTemplateExpansionKey key(ActionLookupKey actionLookupKey, int actionIndex) {
- return interner.intern(new ActionTemplateExpansionKey(actionLookupKey, actionIndex));
+ return ActionTemplateExpansionKey.of(actionLookupKey, actionIndex);
}
+ @AutoCodec
static final class ActionTemplateExpansionKey extends ActionLookupKey {
+ static final ObjectCodec<ActionTemplateExpansionKey> CODEC =
+ new ActionTemplateExpansionValue_ActionTemplateExpansionKey_AutoCodec();
+ private static final Interner<ActionTemplateExpansionKey> interner =
+ BlazeInterners.newWeakInterner();
+
private final ActionLookupKey actionLookupKey;
private final int actionIndex;
@@ -50,6 +55,12 @@
this.actionIndex = actionIndex;
}
+ @AutoCodec.VisibleForSerialization
+ @AutoCodec.Instantiator
+ static ActionTemplateExpansionKey of(ActionLookupKey actionLookupKey, int actionIndex) {
+ return interner.intern(new ActionTemplateExpansionKey(actionLookupKey, actionIndex));
+ }
+
@Override
public SkyFunctionName functionName() {
return SkyFunctions.ACTION_TEMPLATE_EXPANSION;
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetKey.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetKey.java
index 8eee478..ab1655f 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetKey.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetKey.java
@@ -171,7 +171,7 @@
System.identityHashCode(this));
}
- private static class HostConfiguredTargetKey extends ConfiguredTargetKey {
+ static class HostConfiguredTargetKey extends ConfiguredTargetKey {
public static final ObjectCodec<ConfiguredTargetKey> CODEC = ConfiguredTargetKey.CODEC;
private HostConfiguredTargetKey(
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java
index fd9bace..aa35490 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/CoverageReportValue.java
@@ -18,6 +18,8 @@
import com.google.devtools.build.lib.actions.ActionAnalysisMetadata;
import com.google.devtools.build.lib.actions.ActionKeyContext;
import com.google.devtools.build.lib.actions.ActionLookupValue;
+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;
/**
@@ -26,7 +28,7 @@
public class CoverageReportValue extends ActionLookupValue {
// There should only ever be one CoverageReportValue value in the graph.
- public static final CoverageReportKey COVERAGE_REPORT_KEY = new CoverageReportKey();
+ public static final CoverageReportKey COVERAGE_REPORT_KEY = CoverageReportKey.INSTANCE;
CoverageReportValue(
ActionKeyContext actionKeyContext,
@@ -35,7 +37,12 @@
super(actionKeyContext, coverageReportActions, removeActionsAfterEvaluation);
}
+ @AutoCodec(strategy = AutoCodec.Strategy.SINGLETON)
static class CoverageReportKey extends ActionLookupKey {
+ static final CoverageReportKey INSTANCE = new CoverageReportKey();
+ static final ObjectCodec<CoverageReportKey> CODEC =
+ new CoverageReportValue_CoverageReportKey_AutoCodec();
+
private CoverageReportKey() {}
@Override
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
index 6d02ed3..9765dd1 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetCompletionValue.java
@@ -18,6 +18,8 @@
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext;
+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 com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
@@ -60,8 +62,15 @@
});
}
+ /** {@link SkyKey} for {@link TargetCompletionValue}. */
+ @AutoCodec
@AutoValue
- abstract static class TargetCompletionKey implements SkyKey {
+ @AutoCodec.VisibleForSerialization
+ public abstract static class TargetCompletionKey implements SkyKey {
+ public static final ObjectCodec<TargetCompletionKey> CODEC =
+ new TargetCompletionValue_TargetCompletionKey_AutoCodec();
+
+ @AutoCodec.Instantiator
public static TargetCompletionKey create(
ConfiguredTargetKey configuredTargetKey,
TopLevelArtifactContext topLevelArtifactContext,
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusValue.java
index 1b69592..be64706 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/WorkspaceStatusValue.java
@@ -17,7 +17,10 @@
import com.google.devtools.build.lib.actions.ActionLookupValue;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.WorkspaceStatusAction;
+import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec;
+import com.google.devtools.build.lib.skyframe.serialization.SingletonCodec;
import com.google.devtools.build.skyframe.SkyFunctionName;
+import com.google.devtools.build.skyframe.SkyKey;
/**
* Value that stores the workspace status artifacts and their generating action. There should be
@@ -30,7 +33,7 @@
private final Artifact volatileArtifact;
// There should only ever be one BuildInfo value in the graph.
- public static final BuildInfoKey BUILD_INFO_KEY = new BuildInfoKey();
+ public static final BuildInfoKey BUILD_INFO_KEY = BuildInfoKey.INSTANCE;
WorkspaceStatusValue(
ActionKeyContext actionKeyContext,
@@ -51,7 +54,12 @@
return volatileArtifact;
}
- static class BuildInfoKey extends ActionLookupKey {
+ /** {@link SkyKey} for {@link WorkspaceStatusValue}. */
+ public static class BuildInfoKey extends ActionLookupKey {
+ private static final BuildInfoKey INSTANCE = new BuildInfoKey();
+ public static final ObjectCodec<BuildInfoKey> CODEC =
+ SingletonCodec.of(INSTANCE, "build_info_key");
+
private BuildInfoKey() {}
@Override