Skip to content

Commit 8dc95d7

Browse files
Merge pull request #1246 from apollographql/update/cli
Update CLI to include switching lets to vars to prevent memory overuse
2 parents b03b487 + 2ff405c commit 8dc95d7

6 files changed

Lines changed: 995 additions & 723 deletions

File tree

Sources/ApolloCodegenLib/CLIDownloader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct CLIDownloader {
3030
}
3131

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

3535
/// Downloads the appropriate Apollo CLI in a zip file.
3636
///

Sources/ApolloCodegenLib/CLIExtractor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct CLIExtractor {
2525
}
2626
}
2727

28-
static let expectedSHASUM = "0b11aa7973afed9a6b66fbff8c4a09421068a3fe0f50975f7c5d4ca791236b0c"
28+
static let expectedSHASUM = "060d893aea4ebc2effa74b20433f5d0f586b31fec0d0f73c210ee152c032185e"
2929

3030
/// Checks to see if the CLI has already been extracted and is the correct version, and extracts or re-extracts as necessary
3131
///

Sources/GitHubAPI/API.swift

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ public final class RepositoryQuery: GraphQLQuery {
1919
public struct Data: GraphQLSelectionSet {
2020
public static let possibleTypes: [String] = ["Query"]
2121

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

2628
public private(set) var resultMap: ResultMap
2729

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

49-
public static let selections: [GraphQLSelection] = [
50-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
51-
GraphQLField("issueOrPullRequest", arguments: ["number": 13], type: .object(IssueOrPullRequest.selections)),
52-
]
51+
public static var selections: [GraphQLSelection] {
52+
return [
53+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
54+
GraphQLField("issueOrPullRequest", arguments: ["number": 13], type: .object(IssueOrPullRequest.selections)),
55+
]
56+
}
5357

5458
public private(set) var resultMap: ResultMap
5559

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

86-
public static let selections: [GraphQLSelection] = [
87-
GraphQLTypeCase(
88-
variants: ["Issue": AsIssue.selections],
89-
default: [
90-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
91-
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
92-
GraphQLField("author", type: .object(Author.selections)),
93-
]
94-
)
95-
]
90+
public static var selections: [GraphQLSelection] {
91+
return [
92+
GraphQLTypeCase(
93+
variants: ["Issue": AsIssue.selections],
94+
default: [
95+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
96+
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
97+
GraphQLField("author", type: .object(Author.selections)),
98+
]
99+
)
100+
]
101+
}
96102

97103
public private(set) var resultMap: ResultMap
98104

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

143-
public static let selections: [GraphQLSelection] = [
144-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
145-
GraphQLField("login", type: .nonNull(.scalar(String.self))),
146-
]
149+
public static var selections: [GraphQLSelection] {
150+
return [
151+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
152+
GraphQLField("login", type: .nonNull(.scalar(String.self))),
153+
]
154+
}
147155

148156
public private(set) var resultMap: ResultMap
149157

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

200-
public static let selections: [GraphQLSelection] = [
201-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
202-
GraphQLField("body", type: .nonNull(.scalar(String.self))),
203-
GraphQLField("url", type: .nonNull(.scalar(String.self))),
204-
GraphQLField("author", type: .object(Author.selections)),
205-
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
206-
GraphQLField("author", type: .object(Author.selections)),
207-
]
208+
public static var selections: [GraphQLSelection] {
209+
return [
210+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
211+
GraphQLField("body", type: .nonNull(.scalar(String.self))),
212+
GraphQLField("url", type: .nonNull(.scalar(String.self))),
213+
GraphQLField("author", type: .object(Author.selections)),
214+
GraphQLField("viewerCanReact", type: .nonNull(.scalar(Bool.self))),
215+
GraphQLField("author", type: .object(Author.selections)),
216+
]
217+
}
208218

209219
public private(set) var resultMap: ResultMap
210220

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

271-
public static let selections: [GraphQLSelection] = [
272-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
273-
GraphQLField("avatarUrl", type: .nonNull(.scalar(String.self))),
274-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
275-
GraphQLField("login", type: .nonNull(.scalar(String.self))),
276-
]
281+
public static var selections: [GraphQLSelection] {
282+
return [
283+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
284+
GraphQLField("avatarUrl", type: .nonNull(.scalar(String.self))),
285+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
286+
GraphQLField("login", type: .nonNull(.scalar(String.self))),
287+
]
288+
}
277289

278290
public private(set) var resultMap: ResultMap
279291

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

346-
public static let selections: [GraphQLSelection] = [
347-
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
348-
]
358+
public static var selections: [GraphQLSelection] {
359+
return [
360+
GraphQLField("repository", arguments: ["owner": "apollographql", "name": "apollo-ios"], type: .object(Repository.selections)),
361+
]
362+
}
349363

350364
public private(set) var resultMap: ResultMap
351365

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

373-
public static let selections: [GraphQLSelection] = [
374-
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
375-
GraphQLField("url", type: .nonNull(.scalar(String.self))),
376-
]
387+
public static var selections: [GraphQLSelection] {
388+
return [
389+
GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
390+
GraphQLField("url", type: .nonNull(.scalar(String.self))),
391+
]
392+
}
377393

378394
public private(set) var resultMap: ResultMap
379395

0 commit comments

Comments
 (0)