Repository navigation
nested: indirect consumer builds a cc_binary with its own C++ toolchain (part of #12601) - #12823
Conversation
|
Review: changes requested
🤖 Generated with Claude Code |
…in (part of #12601) The indirect-consumer fixture gains own_cc, a module behind rules_dx in the module graph that registers the consumer's C++ toolchain. Flag off, toolchain resolution selects it and //:main builds with it; flag on, rules_dx's llvm toolchain wins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
… PATH (part of #12601) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
…12601) rules_dx registered @local_config_apple_cc_toolchains//:all, whose toolchains_on gate is a single_version_override patch that consumers do not apply, so on macOS rules_dx's Xcode toolchain beat a consumer's own C++ toolchain. rules_dx now registers its own toolchain() wrappers around @apple_support//toolchain with //config:toolchains_on in target_settings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
…n on macOS (part of #12601) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
|
Fixed: PR converted to draft until nested_record is green on all platforms. macos_arm64 flag-off test now expects apple_support's own registration (it precedes own_cc in module order and a consumer cannot gate it; rules_dx wrappers only gate rules_dx's registration) and skips the cc_binary build there; unverified until CI runs. host_libc_glibc.patch /usr/bin/sw_vers change is kept: run 43830488003 failed on macOS with sw_vers not found without PATH. Nested tests not run locally. |
68a7303 to
0c45af3
Compare
|
Review: changes requested
Merge only after nested_record is green on all three platforms. 🤖 Generated with Claude Code |
… its own C++ toolchain wins on macOS (part of #12601) bazel_tools depends on apple_support, so apple_support's own register_toolchains("@local_config_apple_cc_toolchains//:all") sorts ahead of mid's deps in BFS order and wins on macOS. The fixture now passes --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1 next to BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1, so flag off selects @@own_cc+//:cc and builds the cc_binary with it on every platform; flag on on macOS selects @apple_support//toolchain only through rules_dx's gated //cc/private/toolchain/apple wrappers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
|
Review follow-up (head 1a35455): 1/3. The root cause is Bazel 9.3.1's embedded 🤖 Generated with Claude Code |
…t of #12601) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic
Part of #12601.
tools/testing/nested_bazel_harness_test.rs: the indirect-consumer fixture (root -> mid -> rules_dx, then mid -> own_cc) registers the consumer's own C++ toolchain inown_cc, which sits behind rules_dx in the module graph. The fixture passes--repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1and--repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1. Flag off://:proberesolves@@own_cc+//:ccon every platform, andbazel build //:main(acc_binary) produces the fake compiler'sown_ccoutput. Flag on:@@llvm+//toolchain:on Linux/Windows;@@apple_support+//toolchain:on macOS.cc/private/toolchain/apple/BUILD.bazel,MODULE.bazel: rules_dx registers gated//cc/private/toolchain/apple:allwrappers around@apple_support//toolchaininstead of@local_config_apple_cc_toolchains//:all, which is only gated by a root-onlysingle_version_overridepatch.patches/rules_py/host_libc_glibc.patch: calls/usr/bin/sw_vers. Run 43830488003 failed on macos_arm64 atrules_py+/uv/private/host/repository.bzl:28:55: index out of range (index is 1, but sequence has 1 elements)(sw_versnot on the nested PATH).macOS root cause: Bazel 9.3.1's
bazel_toolsdepends onapple_support. That puts apple_support's ownregister_toolchains("@local_config_apple_cc_toolchains//:all")ahead of mid's deps in BFS order, and no rules_dx change can gate it. WithBAZEL_NO_APPLE_CPP_TOOLCHAIN=1that repo is empty. So on macOS the flag-on@@apple_support+//toolchain:selection can only come through the rules_dx wrappers, which verifies them.Evidence: nested_record run 43839479309 (linux_x86_64, macos_arm64, windows_x86_64) green for head 1a35455.
tools/testing/nested_cache/{harness.txt,harness.MODULE.bazel.lock,indirect.MODULE.bazel.lock}refreshed from it withnested_cache_update --from(three hosts). Earlier run 43832836171 was green on linux_x86_64 and windows_x86_64 and failed on macos_arm64 (flag off resolved@@apple_support+//toolchain:toolchain).Not run locally:
//tools/testing:nested_bazel_harness_test(nested Bazel; CI runs it). Built locally;tools/dx checkon//tools/testing:nested_bazel_harness_test //tools/testing:toolchain_gate_testtypecheck and format are ok.Remaining for #12601:
starter-consumergreen on macos_arm64 (4 shards) and windows (6 of 8 shards); windows shard 0 fails//cc/private/toolchain:identity_msvcandhermetic-macosfails a probe fetch. Both are on main before this PR; their cause is not yet attributed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Xut2hzwNN9Q3DFZx18pNic