From aa3dd95c76d2d0078fdc7b5eb459e4bc0b61106e Mon Sep 17 00:00:00 2001 From: Luca Di Grazia Date: Sun, 4 Sep 2022 19:29:46 +0200 Subject: [PATCH] Convert e.printStackTrace to rule error in cc_library Tiny cleanup. RELNOTES: None. PiperOrigin-RevId: 257586398 --- .../devtools/build/lib/rules/cpp/CcLibrary.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java index 1f15172da52..1b799bc5e25 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibrary.java @@ -145,7 +145,6 @@ public static void init( if (ruleContext.hasErrors()) { return; } - Iterable ccInfosFromDeps = AnalysisUtils.getProviders(deps, CcInfo.PROVIDER); CcCompilationHelper compilationHelper = new CcCompilationHelper( ruleContext, @@ -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( @@ -444,6 +443,11 @@ public static void init( LibraryToLink.getDynamicLibrariesForRuntime( /* linkingStatically= */ false, libraryToLinks)); + @SuppressWarnings("unchecked") + CppDebugFileProvider cppDebugFileProvider = + CcCompilationHelper.buildCppDebugFileProvider( + compilationInfo.getCcCompilationOutputs(), + (List) ruleContext.getPrerequisites("deps", Mode.TARGET)); Map> currentOutputGroups = CcCompilationHelper.buildOutputGroupsForEmittingCompileProviders( compilationInfo.getCcCompilationOutputs(), @@ -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())))