Skip to content

Commit

Permalink
Create a build setting to allow forcing a Swift target to Apple with …
Browse files Browse the repository at this point in the history
…bazel transitions. (bazelbuild#515)

PiperOrigin-RevId: 339779917
(cherry picked from commit e4ad1cc)

Co-authored-by: Googler <noreply@google.com>
  • Loading branch information
keith and Googler committed Oct 30, 2020
1 parent 3b11994 commit fde7216
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions swift/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ bool_setting(
build_setting_default = False,
)

# Configuration setting for forcing generation of Apple targets.
# NOTE: this is only intended for use with transitions that want to force
# building of an Apple target when building for Linux.
bool_setting(
name = "force_apple_target",
build_setting_default = False,
)

# Allows a user to override the default Swift driver during a build, if the
# toolchain is using the default.
label_flag(
Expand Down
1 change: 1 addition & 0 deletions swift/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ bzl_library(
"@bazel_skylib//lib:dicts",
"@bazel_skylib//lib:partial",
"@bazel_skylib//lib:paths",
"@bazel_skylib//rules:common_settings",
"@bazel_tools//tools/cpp:toolchain_utils.bzl",
],
)
Expand Down
4 changes: 2 additions & 2 deletions swift/internal/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def swift_toolchain_driver_attrs():
return {
"swift_executable": attr.label(
allow_single_file = True,
cfg = "host",
cfg = "exec",
doc = """\
A replacement Swift driver executable.
Expand All @@ -337,7 +337,7 @@ that it is invoked in the correct mode (i.e., `swift`, `swiftc`,
),
"_default_swift_executable": attr.label(
allow_files = True,
cfg = "host",
cfg = "exec",
default = Label(
"@build_bazel_rules_swift//swift:default_swift_executable",
),
Expand Down

0 comments on commit fde7216

Please sign in to comment.