Skip to content

Commit

Permalink
Add defensive @available guards to prevent accidental compilation on …
Browse files Browse the repository at this point in the history
…unsupported platforms.
  • Loading branch information
designatednerd committed Feb 25, 2020
1 parent 213faf8 commit 89074cc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/ApolloCLI.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// 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
Expand Down
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/ApolloCodegen.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// A class to facilitate running code generation
@available(OSX, message: "Only available on macOS")
public class ApolloCodegen {

/// Errors which can happen with code generation
Expand Down
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// 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
Expand Down
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/Basher.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// Bash command runner
@available(OSX, message: "Only available on macOS")
public struct Basher {

public enum BashError: Error, LocalizedError {
Expand Down
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/CLIDownloader.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// 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 {
Expand Down
1 change: 1 addition & 0 deletions Sources/ApolloCodegenLib/CLIExtractor.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// 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
Expand Down

0 comments on commit 89074cc

Please sign in to comment.