From e8911d84bc1ce6b24573fd4c497d09e5bb1c9d86 Mon Sep 17 00:00:00 2001 From: Luca Di Grazia Date: Sun, 4 Sep 2022 20:11:22 +0200 Subject: [PATCH] Don't precompute coverage environment in cc_toolchain Instead, compute it for each target separately using its rule context. https://github.com/bazelbuild/bazel/issues/6516 RELNOTES: None PiperOrigin-RevId: 240330179 --- .../com/google/devtools/build/lib/rules/cpp/CcCommon.java | 3 ++- .../devtools/build/lib/rules/cpp/CcToolchainProvider.java | 4 ---- .../build/lib/rules/cpp/CcToolchainProviderHelper.java | 6 +++++- .../com/google/devtools/build/lib/rules/cpp/CppHelper.java | 5 +++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java index 4427e700f79..a82c5a5b672 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcCommon.java @@ -678,7 +678,8 @@ public Artifact getDynamicLibrarySymlink(Artifact library, boolean preserveName) ccToolchain.getSolibDirectory(), library, preserveName, - /* prefixConsumer= */ true); + true, + ruleContext.getConfiguration()); } /** diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java index 23aa991ff21..3fdd39f6d18 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProvider.java @@ -986,9 +986,5 @@ public boolean isHostConfiguration() { public LicensesProvider getLicensesProvider() { return licensesProvider; } - - public PathFragment getDefaultSysroot() { - return toolchainInfo.getDefaultSysroot(); - } } diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java index 26c66e9648c..7c140841637 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderHelper.java @@ -551,7 +551,11 @@ static CcToolchainProvider getCcToolchainProvider( dynamicRuntimeLinkInputs.add(artifact); dynamicRuntimeLinkSymlinksBuilder.add( SolibSymlinkAction.getCppRuntimeSymlink( - ruleContext, artifact, toolchainInfo.getSolibDirectory(), runtimeSolibDirBase)); + ruleContext, + artifact, + toolchainInfo.getSolibDirectory(), + runtimeSolibDirBase, + configuration)); } } if (dynamicRuntimeLinkInputs.isEmpty()) { diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index 5acb1eae1de..daf3b00b576 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -625,14 +625,15 @@ private static List getMiddlemanInternal( symlinkedArtifacts.add( isCppRuntime ? SolibSymlinkAction.getCppRuntimeSymlink( - ruleContext, artifact, solibDir, solibDirOverride) + ruleContext, artifact, solibDir, solibDirOverride, configuration) : SolibSymlinkAction.getDynamicLibrarySymlink( /* actionRegistry= */ ruleContext, /* actionConstructionContext= */ ruleContext, solibDir, artifact, /* preserveName= */ false, - /* prefixConsumer= */ true)); + /* prefixConsumer= */ true, + configuration)); } artifacts = symlinkedArtifacts; purpose += "_with_solib";