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

Update to Swift 6 #109

Merged
merged 45 commits into from
Dec 13, 2024
Merged

Update to Swift 6 #109

merged 45 commits into from
Dec 13, 2024

Conversation

fpseverino
Copy link
Member

@fpseverino fpseverino commented Nov 10, 2024

  • Update package to Swift 6
  • Remove all EventLoopFutures in favor of async/await
  • Update JWTKit to v5
  • Update to Swift Testing
  • Adopt swift-format
  • Update CI

Copy link

codecov bot commented Nov 10, 2024

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Package.swift Outdated Show resolved Hide resolved
@fpseverino fpseverino requested a review from vamsii777 November 10, 2024 20:03
@vamsii777
Copy link
Contributor

Just a quick note to highlight that while many parts of the codebase, such as GoogleJWT and GitHub services, leverage modern async/await constructs, there are still sections, like the Imgur service, that use legacy Future-based approaches.

@fpseverino
Copy link
Member Author

there are still sections, like the Imgur service, that use legacy Future-based approaches.

Those are basically dead code not visible to the user, they're not even part of a target and are stuck in very old versions of Imperial.
Reviving them requires a bit of work, since the protocols have changed, and I think it's best to do it in a separate PR

Copy link
Member

@ptoffy ptoffy left a comment

Choose a reason for hiding this comment

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

Overall this looks good to me. There's no major changes besides a/a instead of ELFs. Besides the parameters I'd try updating the existential return types to opaque types, that should work e.g for AsyncResponseEncodable. I'd also add formatting

Sources/ImperialAuth0/Auth0.swift Outdated Show resolved Hide resolved
Sources/ImperialCore/Routing/FederatedServiceRouter.swift Outdated Show resolved Hide resolved
Sources/ImperialCore/Routing/FederatedServiceRouter.swift Outdated Show resolved Hide resolved
Sources/ImperialCore/Services/FederatedService.swift Outdated Show resolved Hide resolved
Sources/ImperialDiscord/Discord.swift Outdated Show resolved Hide resolved
Sources/ImperialDropbox/Dropbox.swift Outdated Show resolved Hide resolved
Sources/ImperialKeycloak/Keycloak.swift Outdated Show resolved Hide resolved
Sources/ImperialCore/Helpers/Optional+Imperial.swift Outdated Show resolved Hide resolved
Package.swift Outdated Show resolved Hide resolved
Package.swift Show resolved Hide resolved
@fpseverino
Copy link
Member Author

I'm afraid that by activating formatting a lot of changes will be made that distract from the important ones. I'll do that in a separate PR

@fpseverino fpseverino requested a review from ptoffy November 14, 2024 18:45
ptoffy
ptoffy previously requested changes Nov 14, 2024
Copy link
Member

@ptoffy ptoffy left a comment

Choose a reason for hiding this comment

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

Let's also add Swift 6 language mode. I'm fine with the rest, not sure if @0xTim wants to chime in on something. I would also add some tests honestly, but that can be done later.

After thinking again I'm somewhat worried of the closures having to return opaques, as those are publicly passed in methods, but I guess we can see how that works in tests etc

Copy link
Contributor

@vamsii777 vamsii777 left a comment

Choose a reason for hiding this comment

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

Great work!

@vamsii777 vamsii777 mentioned this pull request Nov 23, 2024
@fpseverino fpseverino requested review from ptoffy and 0xTim November 23, 2024 17:47
@fpseverino
Copy link
Member Author

fpseverino commented Dec 6, 2024

In the last few commits I:

  • updated the remaining services from Future APIs to a/a and refactored them in their own target
  • changed all classes to structs, since I don't think any of them needed to be a reference type (I could easily be wrong)
  • made a lot of public APIs internal or package (I think they were made before the package access level)
  • removed FederatedCreatable and OAuthService, as their only purpose IIUC was to get data (like user and email) from the services in a very convoluted way (even the Kodeco book uses a simpler custom solution), without considering that the endpoints they provided could be outdated and require some maintenance that I think we can avoid

Let me know what you think!

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

Nothing blocking. I have thoughts about how much we're making package protected in case users want to extend Imperial to support other OAuth providers (especially internal ones that they can't upstream) but it's much easier to go that way than try and lock it down after. Lets get this into people's hands to start trying out

@fpseverino fpseverino dismissed ptoffy’s stale review December 13, 2024 20:40

All requested changes have been addressed and resolved and the PR received an approval from Tim

@fpseverino fpseverino merged commit b2c85c9 into vapor-community:main Dec 13, 2024
12 of 13 checks passed
@fpseverino fpseverino deleted the update branch December 13, 2024 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants