-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[6.2][Commands] Allow omitting the target triple for swift sdk configure #8953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
finagolfin
merged 2 commits into
swiftlang:release/6.2
from
swift-everywhere:6.2-sdk-configure
Jul 19, 2025
Merged
[6.2][Commands] Allow omitting the target triple for swift sdk configure #8953
finagolfin
merged 2 commits into
swiftlang:release/6.2
from
swift-everywhere:6.2-sdk-configure
Jul 19, 2025
+424
−210
Conversation
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
…#8856) You can now run `swift sdk configure --sdk-root-path /some/sdk/root sdk-id` without needing to specify the target triple The Android SDK (swiftlang/swift#80788 (comment)) needs to have its `sdkRootPath` configured to point to an external NDK sysroot. But it contains many different target triples, like `armv7-unknown-linux-androideabi33` and `x86_64-unknown-linux-android29`, all of which need to be configured to point to the same sysroot. Following on to swiftlang#8687 and swiftlang/swift-evolution#2888, this PR enables running a single command to configure the entire SDK, like so: ``` swift run swift-sdk configure --sdk-root-path ~/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot swift-6.1-RELEASE-android-24-0.1 ``` This will result in configurations being created for each of the target triples for the SDK ID. <details> ``` % swift run swift-sdk configure --sdk-root-path ~/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot swift-6.1-RELEASE-android-24-0.1 info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android25` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi33` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android26` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi35` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android31` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi29` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android32` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android34` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android27` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi25` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi26` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi24` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android33` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android35` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android29` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android32` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android25` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android24` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi30` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android26` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android33` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi32` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android35` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android34` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android31` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android28` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android27` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android24` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android30` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi28` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `x86_64-unknown-linux-android28` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi27` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android30` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi34` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `armv7-unknown-linux-androideabi31` were successfully updated: sdkRootPath. info: These properties of Swift SDK `swift-6.1-RELEASE-android-24-0.1` for target triple `aarch64-unknown-linux-android29` were successfully updated: sdkRootPath. % ls ~/Library/org.swift.swiftpm/swift-sdks/configuration/ swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android24.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android25.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android26.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android27.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android28.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android29.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android30.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android31.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android32.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android33.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android34.json swift-6.1-RELEASE-android-24-0.1_aarch64-unknown-linux-android35.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi24.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi25.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi26.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi27.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi28.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi29.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi30.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi31.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi32.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi33.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi34.json swift-6.1-RELEASE-android-24-0.1_armv7-unknown-linux-androideabi35.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android24.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android25.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android26.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android27.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android28.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android29.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android30.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android31.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android32.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android33.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android34.json swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android35.json % cat ~/Library/org.swift.swiftpm/swift-sdks/configuration/swift-6.1-RELEASE-android-24-0.1_x86_64-unknown-linux-android31.json { "sdkRootPath" : "/Users/marc/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot", "swiftResourcesPath" : "/Users/marc/Library/org.swift.swiftpm/swift-sdks/swift-6.1-RELEASE-android-24-0.1.artifactbundle/swift-6.1-release-android-24-sdk/android-27c-sysroot/usr/lib/swift", "swiftStaticResourcesPath" : "/Users/marc/Library/org.swift.swiftpm/swift-sdks/swift-6.1-RELEASE-android-24-0.1.artifactbundle/swift-6.1-release-android-24-sdk/android-27c-sysroot/usr/lib/swift_static-x86_64", "toolsetPaths" : [ "/Users/marc/Library/org.swift.swiftpm/swift-sdks/swift-6.1-RELEASE-android-24-0.1.artifactbundle/swift-6.1-release-android-24-sdk/swift-toolset.json" ] } ``` </details> In addition, this fixes swiftlang#8584, where `swift sdk configure` with a specified target triple didn't work at all, and instead would configure some random target triple for the specified SDK. Make the `targetTriple` flag for `ConfigureSwiftSDK` optional and, when nil, apply the command to all triples included in the specified SDK. Fixes swiftlang#8584 and enables configuring multiple target triples with a single `swift sdk configure` command. --------- Co-authored-by: Max Desiatov <[email protected]> (cherry picked from commit 69f851d)
…onal (swiftlang#8687) Makes the "sdkRootPath" property of `swift-sdk.json` optional. ### Motivation: The Android SDK bundle (swiftlang/swift#80788) does not include the Android NDK's sysroot in the bundle itself, but instead relies on it being installed locally. The install location will vary, and the user will be able to configure it with a command (modulo swiftlang#8584) like: ``` swift sdk configure --sdk-root-path ~/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/ swift-6.2-RELEASE-android-0.1 aarch64-unknown-linux-android28 ``` However, since the `SwiftSDKMetadataV4.sdkRootPath` property is declared as non-optional, *some* value must be included in the `swift-sdk.json` file. @MaxDesiatov at swiftlang/swift#80788 (comment) mentions: > As for making it optional, I don't quite remember the exact issue that caused it to become non-optional. After all, making it optional is technically not a breaking change, so potentially could be considered if necessary. ### Modifications: Change `SwiftSDKMetadataV4.sdkRootPath` from `String` to `String?` ### Result: The swift-sdk.json can now contain destinations that do not specify a `sdkRootPath` property. (cherry picked from commit 55f0a83)
jakepetroules
approved these changes
Jul 18, 2025
@swift-ci test |
@swift-ci test windows |
@swift-ci smoke test windows |
Whoops, forgot that you wanted Ben to review too, let me know if he disapproves. |
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.
This is a cherry-pick of Allow omitting the target triple for
swift sdk configure
#8856 and Make sdkRootPath property of swift-sdk.json targetTriples object optional #8687, which fixes swift sdk configure updates a random target triple rather than the specified one #8584 an enables theswift sdk configure
command to be run with just a triple argument to update the configuration of all the matching SDKs.This shouldn't affect any existing code. The
swift sdk configure
command is rarely (if ever) used by anything other than Android, whose SDK is currently in development.swift sdk configure updates a random target triple rather than the specified one #8584
Allow omitting the target triple for
swift sdk configure
#8856Make sdkRootPath property of swift-sdk.json targetTriples object optional #8687
Low. This only affects the
swift sdk configure
command, which isn't in active use by any known existing cross-compilation SDKs.Tests aded at https://github.com/swiftlang/swift-package-manager/compare/release/6.2...swift-everywhere:swift-package-manager:6.2-sdk-configure?expand=1#diff-f0541842d88690661fe076fc7f751af90a6a8dc36edee3ccdc04374abb57f486
@MaxDesiatov, @jakepetroules CC: @finagolfin