Releases: bazelbuild/rules_swift
2.0.0-rc1
What's Changed
Breaking Changes
- The
swift_module=
tag oncc_library
targets no longer does anything, and theswift_c_module
rule was removed: #1191 and #1224- Use the new
swift_interop_hint
aspect hint instead - There were also some changes to how the
apple_common.Objc
provider is handled (e.g. d68b214)
- Use the new
- The deprecated swift proto library rules were removed: #1193
- The Bzlmod
module.compatibility_level
was increased: #1214- If you ruleset can support both pre-2.0 and post-2.0 rules_swift, please set
bazel_dep.max_compatibility_level = 2
instead of bumping your minimum supported version of rules_swift
- If you ruleset can support both pre-2.0 and post-2.0 rules_swift, please set
- The
swift.disable_system_index
feature is now enabled by default: #1252 - Removed
swift.emit_symbol_graph
feature: #1229- Use the new
swift_symbol_graph_extract
rule
- Use the new
- Removed the
swift.use_response_files
feature: #1275 - Removed the
swift.bundled_xctests
feature: #1272 - Removed the implicit output from swift_library: #1260
- Moved
swift_usage_aspect
andSwiftUsageInfo
from rules_swift into rules_apple: #1223 - Manually specifying the
-index-store-path
flag while also using theswift.index_while_building
is no longer supported: #1248 - It is now an error to specify both
swiftinterface
andswiftmodule
inswift_import
: #1253
Deprecations
- Moved rules and other build definitions into their own public files and deprecated the umbrella
swift.bzl
andproto.bzl
files: #1231, #1236, and #1255- Please update your
load
statements as theswift.bzl
file will be removed in the next major release
- Please update your
Other changes
- Added support for symbol graph extraction with the
swift_symbol_graph_extract
rule: #772, #1195, #1246, #1270, and #1271 - Added support for the
fdo_instrument_order_file
feature: #1251 - Added the
swift.add_target_name_to_output
feature, which allows multiple targets in a package to produce the same module name in the same build: #1098 and #1217 - Added the
swift.thin_lto
andswift.full_lto
features to enable LTO: #1208 - Added the
swift.propagate_generated_module_map
feature to propagate the generated module map: #1212 - Added the
swift.headers_always_action_inputs
feature which causes all headers to always be included as inputs toSwiftCompile
actions, even when using explicit modules: #1249 - Added an API to compile a
.swiftinterface
file into a.swiftmodule
: #1250 - Added an XCTest observer to
swift_test
targets that generates a JUnit-style XML log at the path in theXML_OUTPUT_PATH
environment variable defined by Bazel: #1222, #1242, #1263, and #1273 - Added a
discover_tests
attribute toswift_test
: #1259, #1266, #1273, and #1274 - Added a mechanism to provide a list of protocol names for constant value extraction: #1170
- Added a
swift_common.get_toolchain
helper function: #1226, #1257, and #1258 resource_set
is now defined forSwiftCompile
actions: #1241- Swift compiler sandboxing is now disabled when using Xcode 15.3+, which fixes nested sandboxing errors: #1206
- We now correctly add
.swiftmodule
directories to the search path: #1245 - We now correctly calculate the minimum supported OS when calculating the target triple for 'arm64-apple-ios-simulator' targets: #1247
- The new driver is now used on Xcode 14+ since it contains the fixes in swiftlang/swift-driver#1036: #1268
- Removed some no-longer-relevant "supports X" features: #1267
- Fixed LLDB expr evaluation for
swift_{binary,test}
targets only containing Swift in theirsrcs
: #1269
This release is compatible with Bazel 6.x LTS, 7.x LTS, and 8.x rolling releases.
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "2.0.0-rc1", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "4ed76051139b7b95fb7e4884e6728af8b7ac77e7c80589a7c9f8f6dd106e53c9",
url = "https://github.com/bazelbuild/rules_swift/releases/download/2.0.0-rc1/rules_swift.2.0.0-rc1.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.18.0
What's Changed
- Remove unnecessary uses of
ctx.resolve_tools
(Thanks, @tjgq!) - Update apple_support to 1.15.1 (Thanks, @luispadron!)
- Update
swift_import
docs and add warning (Thanks, @luispadron!) - Add
swift_proto_library_group
rule (Thanks, @AttilaTheFun!)
This release is compatible with Bazel 6.x LTS, 7.x LTS, and 8.x rolling releases.
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.18.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "bb01097c7c7a1407f8ad49a1a0b1960655cf823c26ad2782d0b7d15b323838e2",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.18.0/rules_swift.1.18.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
Full Changelog: 1.17.0...1.18.0
1.17.0
What's Changed
- Replace instances of
to_json()
method withjson.encode(...)
(Thanks, @c-mita!) - Add
swift.emit_swiftdoc
andswift.emit_swiftsourceinfo
features to control Bazel tracking the .swiftdoc and .swiftsourceinfo files (Thanks, @chiragramani!) - Add
swift.emit_private_swiftinterface
feature to control emitting .private.swiftinterface files (Thanks, @luispadron!) - Add the
swift_proto_library
rules (Thanks, @AttilaTheFun!)
This release is compatible with 6.x LTS, 7.x LTS, and bazel 8.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.17.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "9bc9dc949062405412404c0f07f7323ba310f3f91f42af414ac27e338ba7bb8c",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.17.0/rules_swift.1.17.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.16.0
What's Changed
- Add the
swift_library_group
rule - Add the
always_include_developer_search_paths
attribute toswift_library
This release is compatible with 6.x LTS, 7.x LTS, and bazel 8.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.16.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "7aabe3bbef8d2e07c9ee07acb386f0a257bd2f76ea8e21005688b506dc8da67b",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.16.0/rules_swift.1.16.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.15.1
What's Changed
- Fix bazel @ HEAD incompatibility edge case
This release is compatible with 6.x LTS, 7.x LTS, and bazel 8.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.15.1", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "e2eee463839483dfe1b05ce406a4f2fb3fd748ddcaa311cc8768fa7f041af0ff",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.15.1/rules_swift.1.15.1.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.15.0
What's Changed
- Add
swift.treat_warnings_as_errors
feature - Add support for removed swift fragment for bazel @ HEAD
- Improve error for invalid triples
This release is compatible with 6.x LTS, 7.x LTS, and bazel 8.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.15.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "7a9f6b16ef71d54485b1f7a0c8d58815461c4d5ba356c0108b8dbe92d354ff7b",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.15.0/rules_swift.1.15.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.14.0
What's Changed
- Fix clang discovery when compiler isn't named
clang
- Update
swift_test
to fail if it doesn't execute any tests, thanks @jszumski! - Add
--@build_bazel_rules_swift//swift:copt
and--@build_bazel_rules_swift//swift:exec_copt
flags to replace--swiftcopt
and--host_swiftcopt
in the future (--host_swiftcopt
is already removed from bazel @ HEAD). The easiest migration path is to use--flag_alias=swiftcopt=@build_bazel_rules_swift//swift:copt --flag_alias=host_swiftcopt=@build_bazel_rules_swift//swift:exec_copt
- Fix bazel @ HEAD support removing linking info from the objc provider
This release is compatible with 5.x LTS, 6.x LTS, 7.x LTS, and bazel 8.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.14.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "9b0064197e3b6c123cf7cbd377ad5071ac020cbd208fcc23dbc9f3928baf4fa2",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.14.0/rules_swift.1.14.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.13.0
What's Changed
- Fixed "name 'visibility' is not defined" error on Bazel 5 by @jesses-canva in #1117
- Limited
--cxxopt='-std=c++14'
to Linux builds by @thii in #1122 - Add SwiftGRPCInfo provider by @AttilaTheFun in #1121
This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.13.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "28a66ff5d97500f0304f4e8945d936fe0584e0d5b7a6f83258298007a93190ba",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.13.0/rules_swift.1.13.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.12.0
What's Changed
- Add support for universal compiler plugins to improve cache hits when using macros. An example can be found in the docs
- Enable use_default_shell_env everywhere when using bazel 7.x+
- Add macros support on Linux
This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.12.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "abbc41234c37031bc2c561a80fe8a2f8d95efcbbf2a2cb61be0b7201b5dd01a9",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.12.0/rules_swift.1.12.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()
1.11.0
What's Changed
- Add initial Swift Macros support through a new
swift_compiler_plugin
rule andmacros
attribute on other rules. This requires Swift 5.9, an example can be found here in the docs - Add initial visionOS support. See rules_apple for usage.
This release is compatible with 5.x LTS, 6.x LTS, and bazel 7.x rolling releases
MODULE.bazel Snippet
bazel_dep(name = "rules_swift", version = "1.11.0", repo_name = "build_bazel_rules_swift")
Workspace Snippet
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "build_bazel_rules_swift",
sha256 = "f7ab777e1b246cebed185417bffd93135be806e45248c57fd34e0f676bfb1c65",
url = "https://github.com/bazelbuild/rules_swift/releases/download/1.11.0/rules_swift.1.11.0.tar.gz",
)
load(
"@build_bazel_rules_swift//swift:repositories.bzl",
"swift_rules_dependencies",
)
swift_rules_dependencies()
load(
"@build_bazel_rules_swift//swift:extras.bzl",
"swift_rules_extra_dependencies",
)
swift_rules_extra_dependencies()