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.

PiperOrigin-RevId: 339779917
  • Loading branch information
Googler authored and swiple-rules-gardener committed Oct 30, 2020
1 parent ef51377 commit e4ad1cc
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 @@ -49,6 +49,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 @@ -90,6 +90,7 @@ bzl_library(
"@bazel_skylib//lib:dicts",
"@bazel_skylib//lib:partial",
"@bazel_skylib//lib:paths",
"@bazel_skylib//rules:common_settings",
],
)

Expand Down
4 changes: 2 additions & 2 deletions swift/internal/attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,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 @@ -340,7 +340,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

1 comment on commit e4ad1cc

@keith
Copy link
Member

@keith keith commented on e4ad1cc Oct 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.