Skip to content

[6.0] Handle Swift versions unsupported by XCBuild #7504

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

Conversation

neonichu
Copy link
Contributor

@neonichu neonichu commented Apr 25, 2024

XCBuild has its own notion of supported Swift versions which can differ from the ones SwiftPM's own build system and the used compiler support. Using a version outside of the supported range prevents building, so we'll try to obtain the list of supported versions and intersect it with the versions supported by a given package to find the best version supported by both.

(cherry picked from commit 3f9587c)

Explanation: XCBuild has its own notion of supported Swift versions that can be different from the toolchain/SwiftPM. To support packages that support multiple language versions, including Swift 6, we need to allow falling back to an older language version if the newest supported one is not supported by XCBuild.
Scope: Anyone using XCBuild from existing Xcodes together with a Swift 6 toolchain, specifically we're running into this when adopting Swift 6 in swift-syntax since the macOS toolchain build uses XCBuild to produce universal binaries.
Issue: rdar://126952308 (Building a package that supports Swift 6 mode using a Swift 6 toolchain but with a RainbowE Xcode fails with: SWIFT_VERSION '6' is unsupported, supported versions are: 4.0, 4.2, 5.0)
Original PR: #7499
Risk: Low risk
Testing: Manually tested with a few different Xcodes, added a unit test for the specific scenario.
Reviewer: @MaxDesiatov

XCBuild has its own notion of supported Swift versions which can differ
from the ones SwiftPM's own build system and the used compiler support.
Using a version outside of the supported range prevents building, so
we'll try to obtain the list of supported versions and intersect it with
the versions supported by a given package to find the best version
supported by both.

(cherry picked from commit 3f9587c)
@neonichu neonichu self-assigned this Apr 25, 2024
@neonichu
Copy link
Contributor Author

@swift-ci please test

@neonichu neonichu added the swift 6.0 Related to Swift 6.0 release branch label Apr 25, 2024
@neonichu neonichu changed the title Handle Swift versions unsupported by XCBuild [6.0] Handle Swift versions unsupported by XCBuild Apr 25, 2024
@neonichu neonichu merged commit a131c58 into release/6.0 Apr 26, 2024
@neonichu neonichu deleted the handle-swift-versions-unsupported-by-xcbuild-6.0 branch April 26, 2024 07:33
ahoppen added a commit to ahoppen/swift-package-manager that referenced this pull request May 9, 2024
This shouldn’t be needed anymore with swiftlang#7504.
ahoppen added a commit that referenced this pull request May 14, 2024
This shouldn’t be needed anymore with
#7504.
ahoppen added a commit to ahoppen/swift-package-manager that referenced this pull request May 14, 2024
This shouldn’t be needed anymore with swiftlang#7504.
ahoppen added a commit that referenced this pull request May 14, 2024
* **Explanation**: Remove code that forced swift-syntax to be built in
Swift 5 mode because the underlying issue was fixed by
#7504
* **Scope**: Building SwiftPM
* **Risk**: Low, if there are any issues, they will be caught at build
time
* **Testing**: Checked that SwiftPM still builds
* **Issue**: n/a
* **Reviewer**: @bnbarham on
#7545
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
furby-tm pushed a commit to wabiverse/swift-package-manager that referenced this pull request May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
swift 6.0 Related to Swift 6.0 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants