Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit e4ad1cc

Browse files
Googlerswiple-rules-gardener
Googler
authored andcommitted
Create a build setting to allow forcing a Swift target to Apple with bazel transitions.
PiperOrigin-RevId: 339779917
1 parent ef51377 commit e4ad1cc

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
@@ -49,6 +49,14 @@ bool_setting(
4949
build_setting_default = False,
5050
)
5151

52+
# Configuration setting for forcing generation of Apple targets.
53+
# NOTE: this is only intended for use with transitions that want to force
54+
# building of an Apple target when building for Linux.
55+
bool_setting(
56+
name = "force_apple_target",
57+
build_setting_default = False,
58+
)
59+
5260
# Allows a user to override the default Swift driver during a build, if the
5361
# toolchain is using the default.
5462
label_flag(

swift/internal/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ bzl_library(
9090
"@bazel_skylib//lib:dicts",
9191
"@bazel_skylib//lib:partial",
9292
"@bazel_skylib//lib:paths",
93+
"@bazel_skylib//rules:common_settings",
9394
],
9495
)
9596

swift/internal/attrs.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def swift_toolchain_driver_attrs():
328328
return {
329329
"swift_executable": attr.label(
330330
allow_single_file = True,
331-
cfg = "host",
331+
cfg = "exec",
332332
doc = """\
333333
A replacement Swift driver executable.
334334
@@ -340,7 +340,7 @@ that it is invoked in the correct mode (i.e., `swift`, `swiftc`,
340340
),
341341
"_default_swift_executable": attr.label(
342342
allow_files = True,
343-
cfg = "host",
343+
cfg = "exec",
344344
default = Label(
345345
"@build_bazel_rules_swift//swift:default_swift_executable",
346346
),

0 commit comments

Comments
 (0)