aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar plf <plf@google.com>2018-04-04 04:05:43 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-04-04 04:06:56 -0700
commit95acd8b0c9f82a28a3d49731bed87bb81dd822f4 (patch)
tree6dd6b1095849b7aa9ec59359dd624799559aebbb /src/main/java/com/google/devtools/build
parent1dcd8f0f12bb582cc449381f8245f943121031fb (diff)
C++: Migrate CcExecutionDynamicLibrary to new provider style
RELNOTES:none PiperOrigin-RevId: 191574019
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesInfo.java (renamed from src/main/java/com/google/devtools/build/lib/rules/cpp/CcExecutionDynamicLibrariesProvider.java)25
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java13
3 files changed, 30 insertions, 19 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
index b06003c89a..0b227a8712 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcBinary.java
@@ -896,9 +896,8 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory {
.setFilesToBuild(filesToBuild)
.addNativeDeclaredProvider(ccCompilationContextInfo)
.addProvider(TransitiveLipoInfoProvider.class, transitiveLipoInfo)
- .addProvider(
- CcExecutionDynamicLibrariesProvider.class,
- new CcExecutionDynamicLibrariesProvider(
+ .addNativeDeclaredProvider(
+ new CcExecutionDynamicLibrariesInfo(
collectExecutionDynamicLibraryArtifacts(
ruleContext, linkingOutputs.getExecutionDynamicLibraries())))
.addProvider(
@@ -933,11 +932,11 @@ public abstract class CcBinary implements RuleConfiguredTargetFactory {
return NestedSetBuilder.wrap(Order.STABLE_ORDER, artifacts);
}
- Iterable<CcExecutionDynamicLibrariesProvider> deps = ruleContext
- .getPrerequisites("deps", Mode.TARGET, CcExecutionDynamicLibrariesProvider.class);
+ Iterable<CcExecutionDynamicLibrariesInfo> deps =
+ ruleContext.getPrerequisites("deps", Mode.TARGET, CcExecutionDynamicLibrariesInfo.PROVIDER);
NestedSetBuilder<Artifact> builder = NestedSetBuilder.stableOrder();
- for (CcExecutionDynamicLibrariesProvider dep : deps) {
+ for (CcExecutionDynamicLibrariesInfo dep : deps) {
builder.addTransitive(dep.getExecutionDynamicLibraryArtifacts());
}
return builder.build();
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/CcExecutionDynamicLibrariesInfo.java
index 6ae1acf65e..253803e8f6 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/CcExecutionDynamicLibrariesInfo.java
@@ -14,24 +14,37 @@
package com.google.devtools.build.lib.rules.cpp;
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.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.packages.NativeInfo;
+import com.google.devtools.build.lib.packages.NativeProvider;
import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
+import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
/** A target that provides the execution-time dynamic libraries of a C++ rule. */
@Immutable
@AutoCodec
-public final class CcExecutionDynamicLibrariesProvider implements TransitiveInfoProvider {
- public static final CcExecutionDynamicLibrariesProvider EMPTY =
- new CcExecutionDynamicLibrariesProvider(
- NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER));
+@SkylarkModule(
+ name = "cc_execution_dynamic_libraries_info ",
+ documented = false,
+ category = SkylarkModuleCategory.PROVIDER,
+ doc = "."
+)
+public final class CcExecutionDynamicLibrariesInfo extends NativeInfo {
+ public static final NativeProvider<CcExecutionDynamicLibrariesInfo> PROVIDER =
+ new NativeProvider<CcExecutionDynamicLibrariesInfo>(
+ CcExecutionDynamicLibrariesInfo.class, "CcExecutionDynamicLibrariesInfo") {};
+
+ public static final CcExecutionDynamicLibrariesInfo EMPTY =
+ new CcExecutionDynamicLibrariesInfo(NestedSetBuilder.<Artifact>emptySet(Order.STABLE_ORDER));
private final NestedSet<Artifact> ccExecutionDynamicLibraries;
- public CcExecutionDynamicLibrariesProvider(NestedSet<Artifact> ccExecutionDynamicLibraries) {
+ public CcExecutionDynamicLibrariesInfo(NestedSet<Artifact> ccExecutionDynamicLibraries) {
+ super(PROVIDER);
this.ccExecutionDynamicLibraries = ccExecutionDynamicLibraries;
}
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
index a764e8752e..48205f4ae1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
@@ -542,7 +542,6 @@ public final class CcLinkingHelper {
providers.add(new CcNativeLibraryProvider(collectNativeCcLibraries(ccLinkingOutputs)));
}
providers.put(
- CcExecutionDynamicLibrariesProvider.class,
collectExecutionDynamicLibraryArtifacts(ccLinkingOutputs.getExecutionDynamicLibraries()));
CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
@@ -672,22 +671,22 @@ public final class CcLinkingHelper {
return result.build();
}
- private CcExecutionDynamicLibrariesProvider collectExecutionDynamicLibraryArtifacts(
+ private CcExecutionDynamicLibrariesInfo collectExecutionDynamicLibraryArtifacts(
List<LibraryToLink> executionDynamicLibraries) {
Iterable<Artifact> artifacts = LinkerInputs.toLibraryArtifacts(executionDynamicLibraries);
if (!Iterables.isEmpty(artifacts)) {
- return new CcExecutionDynamicLibrariesProvider(
+ return new CcExecutionDynamicLibrariesInfo(
NestedSetBuilder.wrap(Order.STABLE_ORDER, artifacts));
}
NestedSetBuilder<Artifact> builder = NestedSetBuilder.stableOrder();
- for (CcExecutionDynamicLibrariesProvider dep :
- AnalysisUtils.getProviders(deps, CcExecutionDynamicLibrariesProvider.class)) {
+ for (CcExecutionDynamicLibrariesInfo dep :
+ AnalysisUtils.getProviders(deps, CcExecutionDynamicLibrariesInfo.PROVIDER)) {
builder.addTransitive(dep.getExecutionDynamicLibraryArtifacts());
}
return builder.isEmpty()
- ? CcExecutionDynamicLibrariesProvider.EMPTY
- : new CcExecutionDynamicLibrariesProvider(builder.build());
+ ? CcExecutionDynamicLibrariesInfo.EMPTY
+ : new CcExecutionDynamicLibrariesInfo(builder.build());
}
/**