aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CcLinkingHelper.java23
1 files changed, 12 insertions, 11 deletions
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 6a9bab624d..a1fe50ba50 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
@@ -521,21 +521,16 @@ public final class CcLinkingHelper {
.build();
}
- Runfiles cppStaticRunfiles = collectCppRunfiles(ccLinkingOutputs, true);
- Runfiles cppSharedRunfiles = collectCppRunfiles(ccLinkingOutputs, false);
-
- // By very careful when adding new providers here - it can potentially affect a lot of rules.
- // We should consider merging most of these providers into a single provider.
- TransitiveInfoProviderMapBuilder providers =
- new TransitiveInfoProviderMapBuilder()
- .put(new CcRunfilesInfo(cppStaticRunfiles, cppSharedRunfiles));
-
Map<String, NestedSet<Artifact>> outputGroups = new TreeMap<>();
if (shouldAddLinkerOutputArtifacts(ruleContext, ccOutputs)) {
addLinkerOutputArtifacts(outputGroups, ccOutputs);
}
+ // Be very careful when adding new providers here - it can potentially affect a lot of rules.
+ // We should consider merging most of these providers into a single provider.
+ TransitiveInfoProviderMapBuilder providers = new TransitiveInfoProviderMapBuilder();
+
// TODO(bazel-team): Maybe we can infer these from other data at the places where they are
// used.
if (emitCcNativeLibrariesProvider) {
@@ -544,6 +539,13 @@ public final class CcLinkingHelper {
providers.put(
collectExecutionDynamicLibraryArtifacts(ccLinkingOutputs.getExecutionDynamicLibraries()));
+ Runfiles cppStaticRunfiles = collectCppRunfiles(ccLinkingOutputs, true);
+ Runfiles cppSharedRunfiles = collectCppRunfiles(ccLinkingOutputs, false);
+
+ CcLinkingInfo.Builder ccLinkingInfoBuilder = CcLinkingInfo.Builder.create();
+ ccLinkingInfoBuilder.setCcRunfilesInfo(
+ new CcRunfilesInfo(cppStaticRunfiles, cppSharedRunfiles));
+
CppConfiguration cppConfiguration = ruleContext.getFragment(CppConfiguration.class);
boolean forcePic = cppConfiguration.forcePic();
if (emitCcSpecificLinkParamsProvider) {
@@ -551,12 +553,11 @@ public final class CcLinkingHelper {
new CcSpecificLinkParamsProvider(
createCcLinkParamsStore(ccLinkingOutputs, ccCompilationContextInfo, forcePic)));
} else {
- CcLinkingInfo.Builder ccLinkingInfoBuilder = CcLinkingInfo.Builder.create();
ccLinkingInfoBuilder.setCcLinkParamsInfo(
new CcLinkParamsInfo(
createCcLinkParamsStore(ccLinkingOutputs, ccCompilationContextInfo, forcePic)));
- providers.put(ccLinkingInfoBuilder.build());
}
+ providers.put(ccLinkingInfoBuilder.build());
return new LinkingInfo(
providers.build(), outputGroups, ccLinkingOutputs, originalLinkingOutputs);
}