Skip to content

Commit

Permalink
Fix non-Apple toolchains
Browse files Browse the repository at this point in the history
Signed-off-by: Brentley Jones <github@brentleyjones.com>
  • Loading branch information
brentleyjones committed Oct 1, 2024
1 parent 8b8193e commit ea8aae6
Showing 1 changed file with 25 additions and 36 deletions.
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

0 comments on commit ea8aae6

Please sign in to comment.