-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use Swift 6 when available & upgrade to Xcode 16.2 #331
Conversation
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think here. As far as buf.gen.yaml
and ci.yaml
- that all looks great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what we may want to do instead is keep the swift-tools-version
set at 5.6 and then specify swiftLanguageVersions: [.version("6"), .v5]
(instead of swiftLanguageModes
which is new and Swift 6/Xcode 16 only).
What this will do is allow us to compile with Swift 6 when using the package in Xcode 16, but it will continue to let the package compile with Xcode 15.4 as well. (docs here). I think that's what we want, because if we increase the required swift-tools-version
, I believe that would technically be considered a breaking change, since any dependent packages that are also set to 5.6 would need to increase their tools version to at least the value specified by Connect-Swift.
I could also be wrong here, but just wanted to share that since I've also been going through this exercise of updating some of my packages to compile with Swift 6 while still wanting them to be usable on Xcode 15.4.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this writeup @eseay.
I think you're correct based on the docs you linked, particularly the section on:
If instead you would just like to use Swift 6 language mode when it’s available (while still continuing to support older modes) you can keep a single Package.swift and specify the version in a compatible manner
I pushed an update with your recommendation 🙏🏽
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
After some discussion in apple/swift-protobuf#1729, I noticed that the compilation error when building with Swift 6 is actually an issue with the config in
Tests/UnitTests/ConnectLibraryTests/buf.gen.yaml
which was still running on1.25.2
instead of1.28.2
like other parts of the project.Changes in this PR:
1.28.2
which includes apple/swift-protobuf@3bc7630 and resolves the problem described in the aforementioned issuePackage.swift
to use Swift 6 when available viaswiftLanguageVersions: [.version("6"), .v5]
This is related to #310, but we will not be able to actually implement those until we fully switch to using Swift 6 (a breaking change).