diff --git a/Sources/ApolloCodegenLib/ApolloCLI.swift b/Sources/ApolloCodegenLib/ApolloCLI.swift index 7611c66012..601d8a93ef 100644 --- a/Sources/ApolloCodegenLib/ApolloCLI.swift +++ b/Sources/ApolloCodegenLib/ApolloCLI.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// Wrapper for calling the bundled node-based Apollo CLI. -@available(OSX, message: "Only available on macOS") public struct ApolloCLI { /// Creates an instance of `ApolloCLI`, downloading and extracting if needed @@ -47,3 +49,5 @@ public struct ApolloCLI { return try Basher.run(command: command, from: folder) } } + +#endif diff --git a/Sources/ApolloCodegenLib/ApolloCodegen.swift b/Sources/ApolloCodegenLib/ApolloCodegen.swift index 1dd948256c..2660a3da81 100644 --- a/Sources/ApolloCodegenLib/ApolloCodegen.swift +++ b/Sources/ApolloCodegenLib/ApolloCodegen.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// A class to facilitate running code generation -@available(OSX, message: "Only available on macOS") public class ApolloCodegen { /// Errors which can happen with code generation @@ -42,3 +44,5 @@ public class ApolloCodegen { return try cli.runApollo(with: options.arguments, from: folder) } } + +#endif diff --git a/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift b/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift index b39ad8d5cf..9118d24ef7 100644 --- a/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift +++ b/Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// A wrapper to facilitate downloading a schema with the Apollo node CLI -@available(OSX, message: "Only available on macOS") public struct ApolloSchemaDownloader { /// Runs code generation from the given folder with the passed-in options @@ -19,3 +21,5 @@ public struct ApolloSchemaDownloader { return try cli.runApollo(with: options.arguments) } } + +#endif diff --git a/Sources/ApolloCodegenLib/Basher.swift b/Sources/ApolloCodegenLib/Basher.swift index e6b4d110a1..36ddff2dcd 100644 --- a/Sources/ApolloCodegenLib/Basher.swift +++ b/Sources/ApolloCodegenLib/Basher.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// Bash command runner -@available(OSX, message: "Only available on macOS") public struct Basher { public enum BashError: Error, LocalizedError { @@ -65,3 +67,5 @@ public struct Basher { return output } } + +#endif diff --git a/Sources/ApolloCodegenLib/CLIDownloader.swift b/Sources/ApolloCodegenLib/CLIDownloader.swift index 020d44c522..f4ddc2c444 100644 --- a/Sources/ApolloCodegenLib/CLIDownloader.swift +++ b/Sources/ApolloCodegenLib/CLIDownloader.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// Helper for downloading the CLI Zip file so we don't have to include it in the repo. -@available(OSX, message: "Only available on macOS") struct CLIDownloader { enum CLIDownloaderError: Error, LocalizedError { @@ -118,3 +120,5 @@ struct CLIDownloader { } } } + +#endif diff --git a/Sources/ApolloCodegenLib/CLIExtractor.swift b/Sources/ApolloCodegenLib/CLIExtractor.swift index 0bd26615b3..0cce082596 100644 --- a/Sources/ApolloCodegenLib/CLIExtractor.swift +++ b/Sources/ApolloCodegenLib/CLIExtractor.swift @@ -1,7 +1,9 @@ import Foundation +// Only available on macOS +#if os(macOS) + /// Helper for extracting and validating the node-based Apollo CLI from a zip. -@available(OSX, message: "Only available on macOS") struct CLIExtractor { // MARK: - Extracting the binary @@ -122,3 +124,5 @@ struct CLIExtractor { } } } + +#endif