Skip to content

Commit

Permalink
Add macOS CC toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Sep 11, 2023
1 parent 8e3023c commit e1402a4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -389,16 +389,25 @@ def _create_xcode_toolchain(repository_ctx):
SWIFT_FEATURE_MODULE_MAP_NO_PRIVATE_HEADERS,
]

path_to_swiftc = repository_ctx.which("swiftc")
toolchain_root = path_to_swiftc.dirname

repository_ctx.file(
"BUILD",
"""
load("@bazel_tools//tools/cpp:unix_cc_toolchain_config.bzl", "cc_toolchain_config")
load(
"@build_bazel_rules_swift//swift/internal:xcode_swift_toolchain.bzl",
"xcode_swift_toolchain",
)
package(default_visibility = ["//visibility:public"])
alias(
name = "current_swift_cc_toolchain",
actual = "@local_config_apple_cc//:toolchain"
)
xcode_swift_toolchain(
name = "toolchain",
features = [{feature_list}],
Expand All @@ -408,6 +417,7 @@ xcode_swift_toolchain(
'"{}"'.format(feature)
for feature in feature_values
]),
toolchain_root = toolchain_root,
),
)

Expand Down
2 changes: 1 addition & 1 deletion swift/internal/swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ configuration options that are applied to targets on a per-package basis.
allow_single_file = True,
),
"_cc_toolchain": attr.label(
default = Label("@build_bazel_rules_swift_local_config//:current_swift_cc_toolchain"),
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
doc = """\
The C++ toolchain from which other tools needed by the Swift toolchain (such as
`clang` and `ar`) will be retrieved.
Expand Down

0 comments on commit e1402a4

Please sign in to comment.