Fix obtaining C++ toolchains
Expose a single public method getToolchain(RuleContext) from CppHelper. Before several methods public methods were exposed and those were hard to follow. The new method covers both cases C++ toolchain resolution enabled or disabled.
Add toolchain to StarlarkCcCommonTest. Because the new method only uses toolchains (not legacy attributes) when toolchain resolution is enabled.
This is a preparation to remove incompatible_enable_cc_toolchain_resolution.
PiperOrigin-RevId: 584856533
Change-Id: I6dec785e000b20d4aa26be93686fd5fdbad8ff76
diff --git a/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java b/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
index 11ad7fa..49b7511 100644
--- a/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
+++ b/src/test/java/com/google/devtools/build/lib/testutil/TestConstants.java
@@ -123,9 +123,10 @@
/** The output file path prefix for tool file dependencies. */
public static final String TOOLS_REPOSITORY_PATH_PREFIX = "external/bazel_tools/";
- public static final String RULES_CC_REPOSITORY_SCRATCH = "rules_cc_workspace/";
/** The directory in which rules_cc repo resides in execroot. */
public static final String RULES_CC_REPOSITORY_EXECROOT = "external/" + RulesCcRepoName.CANONICAL_REPO_NAME + "/";
+ /* Prefix for loads from rules_cc */
+ public static final String RULES_CC = "@rules_cc//cc";
/** The repo/package rules_python is rooted at. If empty, builtin rules are used. */
public static final String RULES_PYTHON_PACKAGE_ROOT = "";