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

Update CLI to include switching lets to vars to prevent memory overuse #1246

Merged
merged 4 commits into from
Jun 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/ApolloCodegenLib/CLIDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct CLIDownloader {
}

/// The URL string for getting the current version of the CLI
static let downloadURLString = "https://install.apollographql.com/legacy-cli/darwin/2.27.4"
static let downloadURLString = "https://install.apollographql.com/legacy-cli/darwin/2.28.0"

/// Downloads the appropriate Apollo CLI in a zip file.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/ApolloCodegenLib/CLIExtractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CLIExtractor {
}
}

static let expectedSHASUM = "0b11aa7973afed9a6b66fbff8c4a09421068a3fe0f50975f7c5d4ca791236b0c"
static let expectedSHASUM = "060d893aea4ebc2effa74b20433f5d0f586b31fec0d0f73c210ee152c032185e"

/// Checks to see if the CLI has already been extracted and is the correct version, and extracts or re-extracts as necessary
///
Expand Down
100 changes: 58 additions & 42 deletions Sources/GitHubAPI/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ public final class RepositoryQuery: GraphQLQuery {
public struct Data: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Query"]

public static let selections: [GraphQLSelection] = [
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
]
}

public private(set) var resultMap: ResultMap

Expand All @@ -46,10 +48,12 @@ public final class RepositoryQuery: GraphQLQuery {
public struct Repository: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Repository"]

public static let selections: [GraphQLSelection] = [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("issueOrPullRequest", arguments: ["number": 13], type: .object(IssueOrPullRequest.selections)),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("issueOrPullRequest", arguments: ["number": 13], type: .object(IssueOrPullRequest.selections)),
]
}

public private(set) var resultMap: ResultMap

Expand Down Expand Up @@ -83,16 +87,18 @@ public final class RepositoryQuery: GraphQLQuery {
public struct IssueOrPullRequest: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Issue", "PullRequest"]

public static let selections: [GraphQLSelection] = [
GraphQLTypeCase(
variants: ["Issue": AsIssue.selections],
default: [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
GraphQLField("author", type: .object(Author.selections)),
]
)
]
public static var selections: [GraphQLSelection] {
return [
GraphQLTypeCase(
variants: ["Issue": AsIssue.selections],
default: [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
GraphQLField("author", type: .object(Author.selections)),
]
)
]
}

public private(set) var resultMap: ResultMap

Expand Down Expand Up @@ -140,10 +146,12 @@ public final class RepositoryQuery: GraphQLQuery {
public struct Author: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Organization", "User", "Bot"]

public static let selections: [GraphQLSelection] = [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("login", type: .nonNull(.scalar(String.self))),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("login", type: .nonNull(.scalar(String.self))),
]
}

public private(set) var resultMap: ResultMap

Expand Down Expand Up @@ -197,14 +205,16 @@ public final class RepositoryQuery: GraphQLQuery {
public struct AsIssue: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Issue"]

public static let selections: [GraphQLSelection] = [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("body", type: .nonNull(.scalar(String.self))),
GraphQLField("url", type: .nonNull(.scalar(String.self))),
GraphQLField("author", type: .object(Author.selections)),
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
GraphQLField("author", type: .object(Author.selections)),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("body", type: .nonNull(.scalar(String.self))),
GraphQLField("url", type: .nonNull(.scalar(String.self))),
GraphQLField("author", type: .object(Author.selections)),
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
GraphQLField("author", type: .object(Author.selections)),
]
}

public private(set) var resultMap: ResultMap

Expand Down Expand Up @@ -268,12 +278,14 @@ public final class RepositoryQuery: GraphQLQuery {
public struct Author: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Organization", "User", "Bot"]

public static let selections: [GraphQLSelection] = [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("avatarUrl", type: .nonNull(.scalar(String.self))),
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("login", type: .nonNull(.scalar(String.self))),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("avatarUrl", type: .nonNull(.scalar(String.self))),
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("login", type: .nonNull(.scalar(String.self))),
]
}

public private(set) var resultMap: ResultMap

Expand Down Expand Up @@ -343,9 +355,11 @@ public final class RepoUrlQuery: GraphQLQuery {
public struct Data: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Query"]

public static let selections: [GraphQLSelection] = [
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
]
}

public private(set) var resultMap: ResultMap

Expand All @@ -370,10 +384,12 @@ public final class RepoUrlQuery: GraphQLQuery {
public struct Repository: GraphQLSelectionSet {
public static let possibleTypes: [String] = ["Repository"]

public static let selections: [GraphQLSelection] = [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("url", type: .nonNull(.scalar(String.self))),
]
public static var selections: [GraphQLSelection] {
return [
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
GraphQLField("url", type: .nonNull(.scalar(String.self))),
]
}

public private(set) var resultMap: ResultMap

Expand Down
Loading