Add --incompatible_use_cc_configure_from_rules_cc
In this cl only add the flag. Installing the calls to
__do_not_use_fail_with_incompatible_use_cc_configure_from_rules_cc will be done
in a followup cl.
Progress towards https://github.com/bazelbuild/bazel/issues/10134.
RELNOTES: None.
PiperOrigin-RevId: 280649623
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
index fa7c2eb..c8c308f 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ToolchainResolutionFunction.java
@@ -24,6 +24,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
import com.google.common.collect.Table;
import com.google.devtools.build.lib.analysis.PlatformConfiguration;
import com.google.devtools.build.lib.analysis.PlatformOptions;
@@ -521,10 +522,24 @@
/** Exception used when a toolchain type is required but no matching toolchain is found. */
static final class UnresolvedToolchainsException extends ToolchainException {
UnresolvedToolchainsException(List<Label> missingToolchainTypes) {
- super(
- String.format(
- "no matching toolchains found for types %s",
- missingToolchainTypes.stream().map(Label::toString).collect(joining(", "))));
+ super(getMessage(missingToolchainTypes));
+ }
+
+ private static String getMessage(List<Label> missingToolchainTypes) {
+ if (missingToolchainTypes.size() == 1
+ && Iterables.getOnlyElement(missingToolchainTypes)
+ .toString()
+ .equals("@bazel_tools//tools/cpp:toolchain_type")) {
+ return "No matching toolchains found for types @bazel_tools//tools/cpp:toolchain_type. "
+ + "Maybe --incompatible_use_cc_configure_from_rules_cc has been flipped and there "
+ + "is no default C++ toolchain added in the WORKSPACE file? See "
+ + "https://github.com/bazelbuild/bazel/issues/10134 for details and migration "
+ + "instructions.";
+ }
+
+ return String.format(
+ "no matching toolchains found for types %s",
+ missingToolchainTypes.stream().map(Label::toString).collect(joining(", ")));
}
}