Skip to content

Commit ed81c15

Browse files
keithGoogler
andauthored
Create a build setting to allow forcing a Swift target to Apple with bazel transitions. (#515)
PiperOrigin-RevId: 339779917 (cherry picked from commit e4ad1cc) Co-authored-by: Googler <[email protected]>
1 parent 410d8ed commit ed81c15

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

swift/BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ bool_setting(
5555
build_setting_default = False,
5656
)
5757

58+
# Configuration setting for forcing generation of Apple targets.
59+
# NOTE: this is only intended for use with transitions that want to force
60+
# building of an Apple target when building for Linux.
61+
bool_setting(
62+
name = "force_apple_target",
63+
build_setting_default = False,
64+
)
65+
5866
# Allows a user to override the default Swift driver during a build, if the
5967
# toolchain is using the default.
6068
label_flag(

swift/internal/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ bzl_library(
347347
"@bazel_skylib//lib:dicts",
348348
"@bazel_skylib//lib:partial",
349349
"@bazel_skylib//lib:paths",
350+
"@bazel_skylib//rules:common_settings",
350351
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
351352
],
352353
)

swift/internal/attrs.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def swift_toolchain_driver_attrs():
325325
return {
326326
"swift_executable": attr.label(
327327
allow_single_file = True,
328-
cfg = "host",
328+
cfg = "exec",
329329
doc = """\
330330
A replacement Swift driver executable.
331331
@@ -337,7 +337,7 @@ that it is invoked in the correct mode (i.e., `swift`, `swiftc`,
337337
),
338338
"_default_swift_executable": attr.label(
339339
allow_files = True,
340-
cfg = "host",
340+
cfg = "exec",
341341
default = Label(
342342
"@build_bazel_rules_swift//swift:default_swift_executable",
343343
),

0 commit comments

Comments
 (0)