Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 25 additions & 36 deletions swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ def _create_linux_toolchain(repository_ctx):
repository_ctx.file(
"BUILD",
"""
load(
"@build_bazel_apple_support//configs:platforms.bzl",
"APPLE_PLATFORMS_CONSTRAINTS",
)
load(
"@build_bazel_rules_swift//swift/toolchains:swift_toolchain.bzl",
"swift_toolchain",
Expand All @@ -258,20 +254,20 @@ swift_toolchain(
version_file = "{version_file}",
)

[
toolchain(
name = "xcode-toolchain-" + arch + "-{cpu}",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:{cpu}",
],
target_compatible_with = APPLE_PLATFORMS_CONSTRAINTS[arch],
toolchain = ":toolchain",
toolchain_type = "{toolchain_type}",
visibility = ["//visibility:public"],
)
for arch in APPLE_PLATFORMS_CONSTRAINTS.keys()
]
toolchain(
name = "linux-swift-toolchain-{cpu}",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:{cpu}",
],
target_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:{cpu}",
],
toolchain = ":toolchain",
toolchain_type = "{toolchain_type}",
visibility = ["//visibility:public"],
)
""".format(
cpu = _normalized_linux_cpu(repository_ctx.os.arch),
feature_list = ", ".join([
Expand Down Expand Up @@ -392,10 +388,6 @@ def _create_windows_toolchain(repository_ctx):
repository_ctx.file(
"BUILD",
"""
load(
"@build_bazel_apple_support//configs:platforms.bzl",
"APPLE_PLATFORMS_CONSTRAINTS",
)
load(
"@build_bazel_rules_swift//swift/toolchains:swift_toolchain.bzl",
"swift_toolchain",
Expand All @@ -416,20 +408,17 @@ swift_toolchain(
xctest_version = "{xctest_version}",
)

[
toolchain(
name = "windows-toolchain-" + arch + "-x86_64",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
target_compatible_with = APPLE_PLATFORMS_CONSTRAINTS[arch],
toolchain = ":toolchain",
toolchain_type = "{toolchain_type}",
visibility = ["//visibility:public"],
)
for arch in APPLE_PLATFORMS_CONSTRAINTS.keys()
]
toolchain(
name = "windows-swift-toolchain-x86_64",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
target_compatible_with = APPLE_PLATFORMS_CONSTRAINTS[arch],
toolchain = ":toolchain",
toolchain_type = "{toolchain_type}",
visibility = ["//visibility:public"],
)
""".format(
features = ", ".join(['"{}"'.format(feature) for feature in enabled_features] + ['"-{}"'.format(feature) for feature in disabled_features]),
root = root,
Expand Down