Skip to content

Commit e1402a4

Browse files
committed
Add macOS CC toolchain
1 parent 8e3023c commit e1402a4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

swift/internal/swift_autoconfiguration.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,16 +389,25 @@ def _create_xcode_toolchain(repository_ctx):
389389
SWIFT_FEATURE_MODULE_MAP_NO_PRIVATE_HEADERS,
390390
]
391391

392+
path_to_swiftc = repository_ctx.which("swiftc")
393+
toolchain_root = path_to_swiftc.dirname
394+
392395
repository_ctx.file(
393396
"BUILD",
394397
"""
398+
load("@bazel_tools//tools/cpp:unix_cc_toolchain_config.bzl", "cc_toolchain_config")
395399
load(
396400
"@build_bazel_rules_swift//swift/internal:xcode_swift_toolchain.bzl",
397401
"xcode_swift_toolchain",
398402
)
399403
400404
package(default_visibility = ["//visibility:public"])
401405
406+
alias(
407+
name = "current_swift_cc_toolchain",
408+
actual = "@local_config_apple_cc//:toolchain"
409+
)
410+
402411
xcode_swift_toolchain(
403412
name = "toolchain",
404413
features = [{feature_list}],
@@ -408,6 +417,7 @@ xcode_swift_toolchain(
408417
'"{}"'.format(feature)
409418
for feature in feature_values
410419
]),
420+
toolchain_root = toolchain_root,
411421
),
412422
)
413423

swift/internal/swift_toolchain.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ configuration options that are applied to targets on a per-package basis.
432432
allow_single_file = True,
433433
),
434434
"_cc_toolchain": attr.label(
435-
default = Label("@build_bazel_rules_swift_local_config//:current_swift_cc_toolchain"),
435+
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
436436
doc = """\
437437
The C++ toolchain from which other tools needed by the Swift toolchain (such as
438438
`clang` and `ar`) will be retrieved.

0 commit comments

Comments
 (0)