Skip to content

Commit

Permalink
Convert e.printStackTrace to rule error in cc_library
Browse files Browse the repository at this point in the history
    Tiny cleanup.

    RELNOTES: None.
    PiperOrigin-RevId: 257586398
  • Loading branch information
Luca Di Grazia committed Sep 4, 2022
1 parent dc82c82 commit aa3dd95
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public static void init(
if (ruleContext.hasErrors()) {
return;
}
Iterable<CcInfo> ccInfosFromDeps = AnalysisUtils.getProviders(deps, CcInfo.PROVIDER);
CcCompilationHelper compilationHelper =
new CcCompilationHelper(
ruleContext,
Expand All @@ -162,7 +161,7 @@ public static void init(
.addPublicHeaders(common.getHeaders())
.setCodeCoverageEnabled(CcCompilationHelper.isCodeCoverageEnabled(ruleContext))
.addCcCompilationContexts(
Streams.stream(ccInfosFromDeps)
Streams.stream(AnalysisUtils.getProviders(deps, CcInfo.PROVIDER))
.map(CcInfo::getCcCompilationContext)
.collect(ImmutableList.toImmutableList()))
.addCcCompilationContexts(
Expand Down Expand Up @@ -444,6 +443,11 @@ public static void init(
LibraryToLink.getDynamicLibrariesForRuntime(
/* linkingStatically= */ false, libraryToLinks));

@SuppressWarnings("unchecked")
CppDebugFileProvider cppDebugFileProvider =
CcCompilationHelper.buildCppDebugFileProvider(
compilationInfo.getCcCompilationOutputs(),
(List<TransitiveInfoCollection>) ruleContext.getPrerequisites("deps", Mode.TARGET));
Map<String, NestedSet<Artifact>> currentOutputGroups =
CcCompilationHelper.buildOutputGroupsForEmittingCompileProviders(
compilationInfo.getCcCompilationOutputs(),
Expand All @@ -455,14 +459,12 @@ public static void init(
CcSkylarkApiProvider.maybeAdd(ruleContext, targetBuilder);
targetBuilder
.setFilesToBuild(filesToBuild)
.addProvider(cppDebugFileProvider)
.addProvider(ccNativeLibraryProvider)
.addNativeDeclaredProvider(
CcInfo.builder()
.setCcCompilationContext(compilationInfo.getCcCompilationContext())
.setCcLinkingContext(ccLinkingContext)
.setCcDebugInfoContext(
CppHelper.mergeCcDebugInfoContexts(
compilationInfo.getCcCompilationOutputs(), ccInfosFromDeps))
.build())
.addOutputGroups(
CcCommon.mergeOutputGroups(ImmutableList.of(currentOutputGroups, outputGroups.build())))
Expand Down

0 comments on commit aa3dd95

Please sign in to comment.