Skip to content

Commit e885ebc

Browse files
committed
Add custom macOS Swift toolchain support
This allows you to pass `--define=SWIFT_CUSTOM_TOOLCHAIN=toolchain.id` to specify a custom swift toolchain like the ones downloaded from https://swift.org/download/#snapshots to use.
1 parent e7d8ec5 commit e885ebc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

swift/internal/xcode_swift_toolchain.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,10 @@ def _xcode_swift_toolchain_impl(ctx):
481481

482482
# Configure the action registrars that automatically prepend xcrunwrapper to registered actions.
483483
env = _xcode_env(xcode_config, platform)
484+
custom_toolchain = ctx.var.get("SWIFT_CUSTOM_TOOLCHAIN")
485+
if custom_toolchain:
486+
env["TOOLCHAINS"] = custom_toolchain
487+
484488
execution_requirements = {"requires-darwin": ""}
485489
bazel_xcode_wrapper = ctx.executable._bazel_xcode_wrapper
486490
action_registrars = struct(

0 commit comments

Comments
 (0)