Remove the use of enabled_toolchain_types, prior to it being removed entirely.
Part of the work on
@@ -36,14 +36,13 @@ 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 "@bazel_tools//tools/cpp:toolchain_type" in ctx.toolchains:
return ctx.toolchains["@bazel_tools//tools/cpp:toolchain_type"]
-
- if Label("@bazel_tools//tools/cpp:toolchain_type") in ctx.fragments.platform.enabled_toolchain_types:
- return ctx.toolchains["@bazel_tools//tools/cpp:toolchain_type"]
+ fail("In order to use find_cpp_toolchain, you must include the '@bazel_tools//tools/cpp:toolchain_type' in the toolchains argument to your rule.")
# Fall back to the legacy implicit attribute lookup.
if hasattr(ctx.attr, "_cc_toolchain"):
return ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]
# We didn't find anything.
- fail("In order to use find_cpp_toolchain, you must include the '@bazel_tools//tools/cpp:toolchain_type' in the toolchains argument to your rule.")
+ fail("In order to use find_cpp_toolchain, you must define the '_cc_toolchain' attribute on your rule or aspect.")
