diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp')
7 files changed, 48 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesProvider.java index 62c63954a9..e8fd432458 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesProvider.java @@ -19,12 +19,16 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; -/** - * A target that provides the execution-time dynamic libraries of a C++ rule. - */ +/** A target that provides the execution-time dynamic libraries of a C++ rule. */ @Immutable +@AutoCodec public final class CcExecutionDynamicLibrariesProvider implements TransitiveInfoProvider { + public static final ObjectCodec<CcExecutionDynamicLibrariesProvider> CODEC = + new CcExecutionDynamicLibrariesProvider_AutoCodec(); + public static final CcExecutionDynamicLibrariesProvider EMPTY = new CcExecutionDynamicLibrariesProvider( NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER)); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcNativeLibraryProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcNativeLibraryProvider.java index 93ebdca56e..e8f757fc71 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcNativeLibraryProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcNativeLibraryProvider.java @@ -17,13 +17,18 @@ package com.google.devtools.build.lib.rules.cpp; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; /** * A target that provides native libraries in the transitive closure of its deps that are needed for * executing C++ code. */ @Immutable +@AutoCodec public final class CcNativeLibraryProvider implements TransitiveInfoProvider { + public static final ObjectCodec<CcNativeLibraryProvider> CODEC = + new CcNativeLibraryProvider_AutoCodec(); private final NestedSet<LinkerInput> transitiveCcNativeLibraries; diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppDebugFileProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppDebugFileProvider.java index a626de1c63..4afbd08be9 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppDebugFileProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppDebugFileProvider.java @@ -17,19 +17,25 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; /** * A target that provides .dwo files which can be combined into a .dwp packaging step. See * https://gcc.gnu.org/wiki/DebugFission for details. */ @Immutable +@AutoCodec public final class CppDebugFileProvider implements TransitiveInfoProvider { + public static final ObjectCodec<CppDebugFileProvider> CODEC = + new CppDebugFileProvider_AutoCodec(); private final NestedSet<Artifact> transitiveDwoFiles; private final NestedSet<Artifact> transitivePicDwoFiles; - public CppDebugFileProvider(NestedSet<Artifact> transitiveDwoFiles, - NestedSet<Artifact> transitivePicDwoFiles) { + @AutoCodec.Instantiator + public CppDebugFileProvider( + NestedSet<Artifact> transitiveDwoFiles, NestedSet<Artifact> transitivePicDwoFiles) { this.transitiveDwoFiles = transitiveDwoFiles; this.transitivePicDwoFiles = transitivePicDwoFiles; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRunfilesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRunfilesProvider.java index 30f7bc9e11..e5f48e04df 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRunfilesProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppRunfilesProvider.java @@ -19,18 +19,23 @@ import com.google.devtools.build.lib.analysis.Runfiles; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.TransitiveInfoProvider; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; /** * Runfiles provider for C++ targets. * - * <p>Contains two {@link Runfiles} objects: one for the eventual statically linked binary and - * one for the one that uses shared libraries. Data dependencies are present in both. + * <p>Contains two {@link Runfiles} objects: one for the eventual statically linked binary and one + * for the one that uses shared libraries. Data dependencies are present in both. */ @Immutable +@AutoCodec public final class CppRunfilesProvider implements TransitiveInfoProvider { + public static final ObjectCodec<CppRunfilesProvider> CODEC = new CppRunfilesProvider_AutoCodec(); private final Runfiles staticRunfiles; private final Runfiles sharedRunfiles; + @AutoCodec.Instantiator public CppRunfilesProvider(Runfiles staticRunfiles, Runfiles sharedRunfiles) { this.staticRunfiles = staticRunfiles; this.sharedRunfiles = sharedRunfiles; diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java index 3d07e1b89c..5df286db32 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInput.java @@ -15,12 +15,15 @@ package com.google.devtools.build.lib.rules.cpp; import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec.Strategy; /** - * Something that appears on the command line of the linker. Since we sometimes expand archive - * files to their constituent object files, we need to keep information whether a certain file - * contains embedded objects and if so, the list of the object files themselves. + * Something that appears on the command line of the linker. Since we sometimes expand archive files + * to their constituent object files, we need to keep information whether a certain file contains + * embedded objects and if so, the list of the object files themselves. */ +@AutoCodec(strategy = Strategy.POLYMORPHIC) public interface LinkerInput { /** diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java index 8039c7b87f..8432cdd30e 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/LinkerInputs.java @@ -34,10 +34,15 @@ public abstract class LinkerInputs { * object file. */ @ThreadSafety.Immutable + @AutoCodec public static class SimpleLinkerInput implements LinkerInput { + public static final ObjectCodec<SimpleLinkerInput> CODEC = + new LinkerInputs_SimpleLinkerInput_AutoCodec(); + private final Artifact artifact; private final ArtifactCategory category; + @AutoCodec.Instantiator public SimpleLinkerInput(Artifact artifact, ArtifactCategory category) { String basename = artifact.getFilename(); switch (category) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/TransitiveLipoInfoProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/TransitiveLipoInfoProvider.java index 1ecdba41d9..650f3eda53 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/TransitiveLipoInfoProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/TransitiveLipoInfoProvider.java @@ -19,17 +19,22 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; /** * A target that can contribute profiling information to LIPO C++ compilations. * - * <p>This is used in the LIPO context collector tree to collect data from the transitive - * closure of the :lipo_context_collector target. It is eventually passed to the configured - * targets in the target configuration through {@link LipoContextProvider}. + * <p>This is used in the LIPO context collector tree to collect data from the transitive closure of + * the :lipo_context_collector target. It is eventually passed to the configured targets in the + * target configuration through {@link LipoContextProvider}. */ @Immutable +@AutoCodec public final class TransitiveLipoInfoProvider implements TransitiveInfoProvider { - + public static final ObjectCodec<TransitiveLipoInfoProvider> CODEC = + new TransitiveLipoInfoProvider_AutoCodec(); + public static final String LIPO_CONTEXT_COLLECTOR = ":lipo_context_collector"; public static final TransitiveLipoInfoProvider EMPTY = new TransitiveLipoInfoProvider( @@ -37,6 +42,7 @@ public final class TransitiveLipoInfoProvider implements TransitiveInfoProvider private final NestedSet<IncludeScannable> includeScannables; + @AutoCodec.Instantiator public TransitiveLipoInfoProvider(NestedSet<IncludeScannable> includeScannables) { this.includeScannables = includeScannables; } |