Skip to content

Commit bb0f38b

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Move the C++ toolchain into its own execution group so that it does not have to be bound by the same constraints as the execution platform selected for the Swift toolchain.
PiperOrigin-RevId: 745988579
1 parent 1beb560 commit bb0f38b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

swift/toolchains/xcode_swift_toolchain.bzl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ toolchain, see `doc/rules.md`.
2222
load("@bazel_skylib//lib:dicts.bzl", "dicts")
2323
load("@bazel_skylib//lib:paths.bzl", "paths")
2424
load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
25-
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain", "use_cpp_toolchain")
25+
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "CPP_TOOLCHAIN_TYPE", "use_cpp_toolchain")
2626
load(
2727
"@build_bazel_rules_swift//swift:providers.bzl",
2828
"SwiftFeatureAllowlistInfo",
@@ -629,7 +629,7 @@ def _entry_point_linkopts_provider(*, entry_point_name):
629629
def _xcode_swift_toolchain_impl(ctx):
630630
cpp_fragment = ctx.fragments.cpp
631631
apple_toolchain = apple_common.apple_toolchain()
632-
cc_toolchain = find_cpp_toolchain(ctx)
632+
cc_toolchain = ctx.exec_groups["default"].toolchains[CPP_TOOLCHAIN_TYPE].cc
633633

634634
target_triple = target_triples.normalize_for_swift(
635635
target_triples.parse(cc_toolchain.target_gnu_system_name),
@@ -919,10 +919,17 @@ for incremental compilation using a persistent mode.
919919
},
920920
),
921921
doc = "Represents a Swift compiler toolchain provided by Xcode.",
922+
exec_groups = {
923+
# An execution group that has no specific platform requirements. This
924+
# ensures that the execution platform of this Swift toolchain does not
925+
# unnecessarily constrain the execution platform of the C++ toolchain.
926+
"default": exec_group(
927+
toolchains = use_cpp_toolchain(),
928+
),
929+
},
922930
fragments = [
923931
"cpp",
924932
"objc",
925933
],
926-
toolchains = use_cpp_toolchain(),
927934
implementation = _xcode_swift_toolchain_impl,
928935
)

0 commit comments

Comments
 (0)