Skip to content
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

Merged
merged 6 commits into from
Jan 9, 2025
Merged

Conversation

rebello95
Copy link
Collaborator

@rebello95 rebello95 commented Jan 6, 2025

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 on 1.25.2 instead of 1.28.2 like other parts of the project.

Changes in this PR:

  • Updates that directory to run on 1.28.2 which includes apple/swift-protobuf@3bc7630 and resolves the problem described in the aforementioned issue
  • Switches CI to use Xcode 16.2 and macOS 15
  • Switches our Package.swift to use Swift 6 when available via swiftLanguageVersions: [.version("6"), .v5]
  • Updates the Eliza SPM app to use Swift 6

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).

Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
Signed-off-by: Michael Rebello <[email protected]>
@rebello95 rebello95 mentioned this pull request Jan 6, 2025
3 tasks
Copy link
Member

@jhump jhump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@eseay eseay left a 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.

Copy link
Contributor

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?

Copy link
Collaborator Author

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]>
@rebello95 rebello95 requested a review from eseay January 9, 2025 16:34
@rebello95 rebello95 changed the title Upgrade Swift tools version to 6.0 and compile with Swift 6 Use Swift 6 when available & upgrade to Xcode 16.2 Jan 9, 2025
Signed-off-by: Michael Rebello <[email protected]>
Copy link
Contributor

@eseay eseay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@rebello95 rebello95 merged commit 75e74ea into main Jan 9, 2025
16 checks passed
@rebello95 rebello95 deleted the swift6 branch January 9, 2025 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants