@@ -33,6 +33,12 @@ bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
3333bazel_dep (name = "rules_rust" , version = "0.69.0" )
3434bazel_dep (name = "rules_swift" , version = "4.0.0-rc4" )
3535bazel_dep (name = "swift-syntax" , version = "602.0.0.bcr.2" )
36+ # `apple_support` is a transitive dep of `rules_swift`, but we depend on it
37+ # directly so we can `use_repo` `local_config_xcode` (see below). This lets
38+ # `xcode_swift_toolchain`'s `system_sdk` selects — which are keyed on the
39+ # exact Xcode version string from `xcode_locator.m` (e.g.
40+ # `xcode_26_6_0_17F113`) — resolve on macOS.
41+ bazel_dep (name = "apple_support" , version = "2.6.1" )
3642
3743bazel_dep (name = "zstd" , version = "1.5.7.bcr.1" )
3844
@@ -270,6 +276,23 @@ register_toolchains(
270276 "@swift_toolchain//:swift_toolchain_exec_ubuntu24.04" ,
271277)
272278
279+ # On macOS, `xcode_swift_toolchain` (auto-registered by rules_swift at
280+ # `@rules_swift//swift/toolchains:xcode-toolchain-*`) pulls in
281+ # `@system_sdk//:{all_modules,implicit_modules}`, whose targets are
282+ # `alias(..., select({":xcode_<version>": ...}))` keyed on the exact
283+ # Xcode version string produced by `@bazel_tools//tools/osx:xcode_locator.m`
284+ # (e.g. `xcode_26_6_0_17F113`). Bazel's built-in `@bazel_tools//tools/osx:host_xcodes`
285+ # reports a shorter version without the build number, so no `config_setting`
286+ # matches and the select fails with
287+ # "configurable attribute doesn't match this configuration".
288+ #
289+ # `apple_support`'s `@local_config_xcode//:host_xcodes` uses the SAME
290+ # `xcode_locator.m` as rules_swift's `system_sdk` extension, so its version
291+ # strings agree with the config_setting keys. Wire it up here and select it
292+ # on macOS via `--xcode_version_config` in `.bazelrc`.
293+ xcode_configure = use_extension ("@apple_support//xcode:xcode_configure.bzl" , "xcode_configure_extension" )
294+ use_repo (xcode_configure , "local_config_xcode" )
295+
273296node = use_extension ("@rules_nodejs//nodejs:extensions.bzl" , "node" )
274297node .toolchain (
275298 name = "nodejs" ,
0 commit comments