When building this project for Apple platforms other than macOS, the build failed for a couple of reasons. First, NIOSSHServer requires Foundation.Process which is only available on macOS. Second, the tests are making use of an CryptoKit API that's only present on iOS 13.2 (and aligned other versions), which is newer than the 13.0 stated in the Package.swift:
error: Cannot find type 'Process' in scope
...
error: 'isValidAuthenticationCode(_:authenticating:using:)' is only available in iOS 13.2 or newer
Modifications
Wrap all the code in NIOSSHServer with #if canImport(Foundation.Process) and, in main.swift, throw a fatalError with a helpful message.
Add missing availability guards in test code. I've tried to keep them as scoped as possible.
Result
Source and tests can now build on Apple platforms other than macOS.
Motivation
When building this project for Apple platforms other than macOS, the build failed for a couple of reasons. First,
NIOSSHServer
requiresFoundation.Process
which is only available on macOS. Second, the tests are making use of an CryptoKit API that's only present on iOS 13.2 (and aligned other versions), which is newer than the 13.0 stated in the Package.swift:Modifications
NIOSSHServer
with#if canImport(Foundation.Process)
and, inmain.swift
, throw afatalError
with a helpful message.Result
Source and tests can now build on Apple platforms other than macOS.