aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java
diff options
context:
space:
mode:
authorGravatar cpeyser <cpeyser@google.com>2018-02-14 12:47:23 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-14 12:48:40 -0800
commit03e27585a10f7f5bc9327d64405efc39666e0342 (patch)
treeaf186ade6c87015c4e154b0b49261fa291d7ec42 /src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java
parent19f05009065d4d94fc49b306557d7fb2c7b03587 (diff)
@AutoCodec for CcLinkParamsInfo.
PiperOrigin-RevId: 185728950
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java
index f0ec5882e7..5aa25f6f16 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkParamsStore.java
@@ -16,16 +16,19 @@ package com.google.devtools.build.lib.rules.cpp;
import com.google.common.base.Preconditions;
import com.google.devtools.build.lib.rules.cpp.CcLinkParams.Builder;
+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.skyframe.serialization.autocodec.AutoCodec.Strategy;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.VisibleForSerialization;
/**
* A cache of C link parameters.
*
- * <p>The cache holds instances of {@link CcLinkParams} for combinations of
- * linkingStatically and linkShared. If a requested value is not available in
- * the cache, it is computed and then stored.
+ * <p>The cache holds instances of {@link CcLinkParams} for combinations of linkingStatically and
+ * linkShared. If a requested value is not available in the cache, it is computed and then stored.
*
- * <p>Typically this class is used on targets that may be linked in as C
- * libraries as in the following example:
+ * <p>Typically this class is used on targets that may be linked in as C libraries as in the
+ * following example:
*
* <pre>
* class SomeTarget implements CcLinkParamsInfo {
@@ -44,7 +47,9 @@ import com.google.devtools.build.lib.rules.cpp.CcLinkParams.Builder;
* }
* </pre>
*/
+@AutoCodec(strategy = Strategy.POLYMORPHIC)
public abstract class CcLinkParamsStore {
+ public static final ObjectCodec<CcLinkParamsStore> CODEC = new CcLinkParamsStore_AutoCodec();
private CcLinkParams staticSharedParams;
private CcLinkParams staticNoSharedParams;
@@ -108,14 +113,18 @@ public abstract class CcLinkParamsStore {
protected abstract void collect(CcLinkParams.Builder builder, boolean linkingStatically,
boolean linkShared);
- /**
- * An empty CcLinkParamStore.
- */
- public static final CcLinkParamsStore EMPTY = new CcLinkParamsStore() {
+ @AutoCodec
+ @VisibleForSerialization
+ static class EmptyCcLinkParamsStore extends CcLinkParamsStore {
+ public static final ObjectCodec<EmptyCcLinkParamsStore> CODEC =
+ new CcLinkParamsStore_EmptyCcLinkParamsStore_AutoCodec();
@Override
protected void collect(Builder builder, boolean linkingStatically, boolean linkShared) {}
- };
+ }
+
+ /** An empty CcLinkParamStore. */
+ public static final CcLinkParamsStore EMPTY = new EmptyCcLinkParamsStore();
/**
* An implementation class for the CcLinkParamsStore.