-
Notifications
You must be signed in to change notification settings - Fork 13
Make nats.swift work cross platform. #89
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
base: main
Are you sure you want to change the base?
Conversation
|
Any updates here? |
|
Need this please 🚀🚀🚀 |
|
Thanks @benbenbenbenbenben |
|
Will get back here shortly. Sorry for the delay! |
|
As both |
|
Thank you @benbenbenbenbenben!! I was searching this solution!! I hope this PR will be integrated asap |
|
Sorry about that delay there @morenonicolelli - all dependencies restored to the original repos and we're good to go! |
Jarema
left a comment
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.
Some small nits.
|
Got em' |
|
Hi folks. I could really use this update (need to deploy server-side swift to container on linux), and wondering if there's a plan to merge the PR soon? Looks like it's almost good to go? Thanks to all for this great package. |
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.
Pull Request Overview
This pull request adds cross-platform support to nats.swift, enabling it to build and run on Linux in addition to macOS and iOS. The changes are minimal and focused on platform-specific compatibility requirements.
- Adds conditional imports for
FoundationNetworking(required for URLSession on Linux) - Implements conditional crypto library imports (CryptoKit on Apple platforms, swift-crypto on Linux)
- Updates dependency versions to support cross-platform builds (nkeys.swift 0.2.0, swift-nuid 0.3.0)
- Adds swift-crypto as a Linux-specific dependency for JetStream
- Removes unused
import Combinestatement - Includes devcontainer configuration for Linux build testing
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Tests/NatsTests/Unit/JwtTests.swift | Adds conditional import of FoundationNetworking for Linux URLSession support |
| Sources/Nats/NatsConnection.swift | Adds conditional import of FoundationNetworking for Linux URLSession support |
| Sources/JetStream/JetStreamContext.swift | Removes unused Combine import |
| Sources/JetStream/Consumer.swift | Adds conditional crypto imports (CryptoKit for Apple platforms, Crypto for Linux) |
| Sources/BenchmarkPubSub/main.swift | Updates async iteration syntax, likely for Swift 6 concurrency requirements |
| Package.swift | Updates dependency versions and adds swift-crypto as Linux-conditional dependency for JetStream |
| .devcontainer/devcontainer.json | Adds devcontainer configuration with Swift 6.0 for Linux development and testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @Jarema - Many thanks for picking this up again and for posting the review. I'm really keen to use this change if we can make it stick. Hi @benbenbenbenbenben - I appreciate this sits with you and it's been a while since you raised. If you're able to find time to action this one small review comment that would be absolutely amazng. If not, (which I totally get if you've moved on to other things!), let me know and if you're both happy, perhaps I can create a new PR/branch to take over the update and apply the changes so we can finalise? Thank you both - totally love this package and to be able to use it on Linux would be a game changer for me. Happy to help, just let me know how to do that for the best. Appreciate the efforts! |
|
@avmwilliams let's give @benbenbenbenbenben few days, and in case of lack of time, let's transfer the work to you on new PR. It is quite close to be done. |
|
Of course, no pressure intended. Just an offer of help :) |
|
It's good to go as far as I'm concerned. |
Hi,
I'm opening this for discussion as I'm currently experimenting with NATS on iOS & Linux. It requires minimal changes to make this repo build on Linux, but most of those changes are in dependencies:
Jarema/swift-nuid#1
nats-io/nkeys.swift#9
Each pull request, those above and this one include a devcontainer file to test the Linux build. It is minimal but I can appreciate if it is considered clutter. Nevertheless, the changes required are minimal.