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

Linux Support #15

Open
abdulajet opened this issue Mar 29, 2022 · 2 comments
Open

Linux Support #15

abdulajet opened this issue Mar 29, 2022 · 2 comments

Comments

@abdulajet
Copy link

abdulajet commented Mar 29, 2022

Swift Server folks might want to use this package, and most likely will be deploying via linux. Swift linux does not have the Foundation and CryptoKit frameworks. But there are implementations for linux called FoundationNetworking and Crypto which have the same API.

Adding support should be as easy as adding

#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

and

Importing Crypto over CryptoKit

@daneden
Copy link
Owner

daneden commented Mar 31, 2022

Thanks for the pointers @abdulajet! If I wanted to test whether this package runs/compiles on Linux distros, do you know how I’d do that in Xcode on macOS?

Do you happen to know how to conditionally import packages for Linux distros? I know how to do compiler conditions based on OS like so:

#if os(macOS)
typealias NativeColor = NSColor
#else
typealias NativeColor = UIColor
#endif

I figure we’ll need to do something similar for importing Foundation vs FoundationNetworking and CryptoKit vs Crypto but not sure how we’d switch over Linux specifically.

@abdulajet
Copy link
Author

abdulajet commented Apr 2, 2022

Im not sure about testing on Xcode on macOS, I only ran into issues in my project when I tried to deploy via docker. So maybe you can create a Vapor test project and try run it on docker locally.

You can conditionally check for linux but using:

#if os(Linux)

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

No branches or pull requests

2 participants