Fix a bug where toolchain prefix was not properly generated.
FIXES:
"""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 @@ def _find_cpp_toolchain(ctx):
# 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
