CcToolchainProvider does not subclass ToolchainInfo.

Bownstream bazel tests: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1931 (all failures are also in https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1930, the nightly).

PiperOrigin-RevId: 359497882
Change-Id: Ib8a3725251c1187233f9324522c4ef8602448b50
This commit is contained in:
Googler 2021-02-25 05:12:49 -08:00 committed by Copybara-Service
parent a3d7068939
commit d5d830baaf
1 changed files with 6 additions and 3 deletions

View File

@ -63,9 +63,12 @@ Returns the current `CcToolchainInfo`.
# 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 "//cc:toolchain_type" in ctx.toolchains:
return ctx.toolchains["//cc:toolchain_type"]
fail("In order to use find_cc_toolchain, your rule has to depend on C++ toolchain. See find_cc_toolchain.bzl docs for details.")
if not "//cc:toolchain_type" in ctx.toolchains:
fail("In order to use find_cc_toolchain, your rule has to depend on C++ toolchain. See find_cc_toolchain.bzl docs for details.")
toolchain_info = ctx.toolchains["//cc:toolchain_type"]
if hasattr(toolchain_info, "cc_provider_in_toolchain") and hasattr(toolchain_info, "cc"):
return toolchain_info.cc
return toolchain_info
# Fall back to the legacy implicit attribute lookup.
if hasattr(ctx.attr, "_cc_toolchain"):