Fix a bug where toolchain prefix was not properly generated. FIXES: #13810 PiperOrigin-RevId: 389853136
diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl index 7da7993..b7f430b 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_helper.bzl
@@ -14,6 +14,8 @@ """Utility functions for C++ rules.""" +load(":common/objc/semantics.bzl", "semantics") + CcInfo = _builtins.toplevel.CcInfo cc_common = _builtins.toplevel.cc_common @@ -72,9 +74,9 @@ # Check the incompatible flag for toolchain resolution. if hasattr(cc_common, "is_cc_toolchain_resolution_enabled_do_not_use") and cc_common.is_cc_toolchain_resolution_enabled_do_not_use(ctx = ctx): - if not "@//tools/cpp:toolchain_type" in ctx.toolchains: + if not "@" + semantics.get_repo() + "//tools/cpp:toolchain_type" in ctx.toolchains: fail("In order to use find_cpp_toolchain, you must include the '//tools/cpp:toolchain_type' in the toolchains argument to your rule.") - toolchain_info = ctx.toolchains["@//tools/cpp:toolchain_type"] + toolchain_info = ctx.toolchains["@" + semantics.get_repo() + "//tools/cpp:toolchain_type"] if hasattr(toolchain_info, "cc_provider_in_toolchain") and hasattr(toolchain_info, "cc"): return toolchain_info.cc return toolchain_info