Add minimum_os_version attribute to Swift rules#1691
Open
jpsim wants to merge 2 commits into
Open
Conversation
Adds a `minimum_os_version` string attribute on `swift_binary`, `swift_library`, `swift_test`, `swift_compiler_plugin`, `swift_overlay`, and `swift_proto_library`. On Apple/Xcode toolchains, when set, the value is used to construct the OS component of the target triple passed to `swiftc` (for example, `apple-macos13.0`). When unset, the target triple from the selected platform configuration is used unchanged. Also exposes `minimum_os_version` on `swift_common.compile` and adds a `target_triples.with_os_version` helper for constructing versioned triples. This is a simpler alternative to bazelbuild#1645, which depended on upstream Bazel work to expose `XcodeSdkVariantInfo` via `xcode_sdk_variant` rules. That work has stalled while the Xcode rules migrate out of Bazel core into apple_support, so this change overrides the OS version directly in the Xcode toolchain without depending on new Bazel providers. Refs: * bazelbuild#1645 * cgrindel/rules_swift_package_manager#892 * bazelbuild/bazel#21991 * bazelbuild/bazel#28028
luispadron
approved these changes
Apr 21, 2026
Contributor
Author
|
The failures on "last green" ci jobs are unrelated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
minimum_os_versionstring attribute onswift_binary,swift_library,swift_test,swift_compiler_plugin,swift_overlay, andswift_proto_library. On Apple/Xcode toolchains, when set, the value is used to construct the OS component of the target triple passed toswiftc(for example,apple-macos13.0). When unset, the target triple from the selected platform configuration is used unchanged.Also exposes
minimum_os_versiononswift_common.compileand adds atarget_triples.with_os_versionhelper for constructing versioned triples.This is a simpler alternative to #1645, which depended on upstream Bazel work to expose
XcodeSdkVariantInfoviaxcode_sdk_variantrules. That work has stalled while the Xcode rules migrate out of Bazel core into apple_support, so this change overrides the OS version directly in the Xcode toolchain without depending on new Bazel providers.Refs:
minimum_os_versionin Swift rules #1645swift-composable-architecturebuild failed ifminimum_os_version >= 17.0cgrindel/rules_swift_package_manager#892*_sdk_minimum_osattributes toxcode_versionandXcodePropertiesbazel#21991