Skip to content

Commit bc48968

Browse files
committed
Swift: Build incompatible OS diagnostic on all platforms.
1 parent 04a7ff7 commit bc48968

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

swift/BUILD.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ pkg_filegroup(
8585
":swift-test-sdk-arch",
8686
":resource-dir-arch",
8787
] + select({
88-
"@platforms//os:linux": [
89-
":incompatible-os",
90-
],
9188
"@platforms//os:macos": [
9289
":xcode-autobuilder",
9390
],
91+
"//conditions:default": [
92+
":incompatible-os",
93+
],
9494
}),
9595
visibility = ["//visibility:public"],
9696
)

swift/logging/SwiftLogging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#include <filesystem>
44
#include <stdlib.h>
55
#include <optional>
6+
#ifdef _WIN32
7+
#include <process.h>
8+
#else
69
#include <unistd.h>
10+
#endif
711
#include "absl/strings/str_cat.h"
812

913
#define LEVEL_REGEX_PATTERN "trace|debug|info|warning|error|critical|no_logs"

swift/rules.bzl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ def _wrap_cc(rule, kwargs):
1010
# temporary, before we do universal merging
1111
"-universal_binaries",
1212
])
13-
_add_args(kwargs, "target_compatible_with", select({
14-
"@platforms//os:linux": [],
15-
"@platforms//os:macos": [],
16-
"//conditions:default": ["@platforms//:incompatible"],
17-
}))
13+
if "target_compatible_with" not in kwargs:
14+
# Restrict to Linux or macOS by default, but allow overriding
15+
_add_args(kwargs, "target_compatible_with", select({
16+
"@platforms//os:linux": [],
17+
"@platforms//os:macos": [],
18+
"//conditions:default": ["@platforms//:incompatible"],
19+
}))
1820
rule(**kwargs)
1921

2022
def swift_cc_binary(**kwargs):

swift/tools/autobuilder-diagnostics/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ swift_cc_binary(
77
deps = [
88
"//swift/logging",
99
],
10+
# No restrictions (Windows allowed)
11+
target_compatible_with = [],
1012
)

0 commit comments

Comments
 (0)