Skip to content

Commit 66cd9b6

Browse files
gh-action-runnergh-action-runner
authored andcommitted
Squashed 'apollo-ios-codegen/' changes from 2fd9a7b5d..68aee5940
68aee5940 Merge 2.0 into main branch (#780) git-subtree-dir: apollo-ios-codegen git-subtree-split: 68aee594025266447ea93fc0273a432afa6c4c72
1 parent 16332c7 commit 66cd9b6

File tree

84 files changed

+770
-1118
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+770
-1118
lines changed

Package.swift

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// swift-tools-version:5.9
2-
//
3-
// The swift-tools-version declares the minimum version of Swift required to build this package.
4-
// Swift 5.9 is available from Xcode 15.0.
1+
// swift-tools-version:6.1
52

63
import PackageDescription
74

@@ -36,7 +33,7 @@ let package = Package(
3633
.product(name: "InflectorKit", package: "InflectorKit"),
3734
.product(name: "OrderedCollections", package: "swift-collections")
3835
],
39-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
36+
swiftSettings: [.swiftLanguageMode(.v6)]
4037
),
4138
.target(
4239
name: "GraphQLCompiler",
@@ -47,7 +44,7 @@ let package = Package(
4744
exclude: [
4845
"JavaScript"
4946
],
50-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
47+
swiftSettings: [.swiftLanguageMode(.v6)]
5148
),
5249
.target(
5350
name: "IR",
@@ -57,17 +54,17 @@ let package = Package(
5754
"Utilities",
5855
.product(name: "OrderedCollections", package: "swift-collections")
5956
],
60-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
57+
swiftSettings: [.swiftLanguageMode(.v6)]
6158
),
6259
.target(
6360
name: "TemplateString",
6461
dependencies: [],
65-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
62+
swiftSettings: [.swiftLanguageMode(.v6)]
6663
),
6764
.target(
6865
name: "Utilities",
6966
dependencies: [],
70-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
67+
swiftSettings: [.swiftLanguageMode(.v6)]
7168
),
7269
.executableTarget(
7370
name: "apollo-ios-cli",
@@ -77,15 +74,16 @@ let package = Package(
7774
exclude: [
7875
"README.md",
7976
],
80-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
77+
swiftSettings: [.swiftLanguageMode(.v6)]
8178
),
8279
.target(
8380
name: "CodegenCLI",
8481
dependencies: [
8582
"ApolloCodegenLib",
8683
.product(name: "ArgumentParser", package: "swift-argument-parser"),
8784
],
88-
swiftSettings: [.enableUpcomingFeature("ExistentialAny")]
85+
swiftSettings: [.swiftLanguageMode(.v6)]
8986
),
90-
]
87+
],
88+
swiftLanguageModes: [.v6, .v5]
9189
)

Sources/ApolloCodegenLib/ApolloCodegen+Errors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extension ApolloCodegen {
6767
/// Errors that may occur during code generation that are not fatal. If these errors are present,
6868
/// the generated files will likely not compile correctly. Code generation execution can continue,
6969
/// but these errors should be surfaced to the user.
70-
public enum NonFatalError: Equatable {
70+
public enum NonFatalError: Equatable, Sendable {
7171
case typeNameConflict(name: String, conflictingName: String, containingObject: String)
7272

7373
var errorTypeName: String {

Sources/ApolloCodegenLib/ApolloCodegen.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import Utilities
88
#if os(macOS)
99

1010
/// A class to facilitate running code generation
11-
public class ApolloCodegen {
11+
public final class ApolloCodegen: Sendable {
1212

1313
// MARK: - Public
1414

1515
/// OptionSet used to configure what items should be generated during code generation.
16-
public struct ItemsToGenerate: OptionSet {
16+
public struct ItemsToGenerate: OptionSet, Sendable {
1717
public var rawValue: Int
1818

1919
/// Only generate your code (Operations, Fragments, Enums, etc), this option maintains the codegen functionality
@@ -81,7 +81,7 @@ public class ApolloCodegen {
8181
// MARK: - Internal
8282

8383
@dynamicMemberLookup
84-
class ConfigurationContext {
84+
struct ConfigurationContext: Sendable, Equatable {
8585
let config: ApolloCodegenConfiguration
8686
let pluralizer: Pluralizer
8787
let rootURL: URL?
@@ -654,7 +654,7 @@ public class ApolloCodegen {
654654
let filePathsToDelete = await oldGeneratedFilePaths.subtracting(fileManager.writtenFiles)
655655

656656
for path in filePathsToDelete {
657-
try fileManager.deleteFile(atPath: path)
657+
try await fileManager.deleteFile(atPath: path)
658658
}
659659
}
660660

Sources/ApolloCodegenLib/ApolloSchemaDownloadConfiguration.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Foundation
22

33
/// A configuration object that defines behavior for schema download.
4-
public struct ApolloSchemaDownloadConfiguration: Equatable, Codable {
4+
public struct ApolloSchemaDownloadConfiguration: Equatable, Codable, Sendable {
55

66
// MARK: Types
77

88
/// How to attempt to download your schema
9-
public enum DownloadMethod: Equatable, Codable {
9+
public enum DownloadMethod: Equatable, Codable, Sendable {
1010

1111
/// The Apollo Schema Registry, which serves as a central hub for managing your graph.
1212
case apolloRegistry(_ settings: ApolloRegistrySettings)
@@ -18,7 +18,7 @@ public struct ApolloSchemaDownloadConfiguration: Equatable, Codable {
1818
includeDeprecatedInputValues: Bool = false
1919
)
2020

21-
public struct ApolloRegistrySettings: Equatable, Codable {
21+
public struct ApolloRegistrySettings: Equatable, Codable, Sendable {
2222
/// The API key to use when retrieving your schema from the Apollo Registry.
2323
public let apiKey: String
2424
/// The identifier of the graph to fetch. Can be found in Apollo Studio.
@@ -68,7 +68,7 @@ public struct ApolloSchemaDownloadConfiguration: Equatable, Codable {
6868

6969
/// The HTTP request method. This is an option on Introspection schema downloads only.
7070
/// Apollo Registry downloads are always POST requests.
71-
public enum HTTPMethod: Equatable, CustomStringConvertible, Codable {
71+
public enum HTTPMethod: Equatable, CustomStringConvertible, Codable, Sendable {
7272
/// Use POST for HTTP requests. This is the default for GraphQL.
7373
case POST
7474
/// Use GET for HTTP requests with the GraphQL query being sent in the query string
@@ -88,7 +88,7 @@ public struct ApolloSchemaDownloadConfiguration: Equatable, Codable {
8888
/// The output format for the downloaded schema. This is an option on Introspection schema
8989
/// downloads only. For Apollo Registry schema downloads, the schema will always be output as
9090
/// an SDL document
91-
public enum OutputFormat: String, Equatable, CustomStringConvertible, Codable {
91+
public enum OutputFormat: String, Equatable, CustomStringConvertible, Codable, Sendable {
9292
/// A Schema Definition Language (SDL) document defining the schema as described in
9393
/// the [GraphQL Specification](https://spec.graphql.org/draft/#sec-Schema)
9494
case SDL
@@ -117,7 +117,7 @@ public struct ApolloSchemaDownloadConfiguration: Equatable, Codable {
117117
}
118118

119119
/// An HTTP header that will be sent in the schema download request.
120-
public struct HTTPHeader: Equatable, CustomDebugStringConvertible, Codable {
120+
public struct HTTPHeader: Equatable, Sendable, CustomDebugStringConvertible, Codable {
121121
/// The name of the header field. HTTP header field names are case insensitive.
122122
let key: String
123123
/// The value for the header field.

Sources/ApolloCodegenLib/ApolloSchemaDownloader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public struct ApolloSchemaDownloader {
5656
withRootURL rootURL: URL? = nil,
5757
session: (any NetworkSession)? = nil
5858
) async throws {
59-
try ApolloFileManager.default.createContainingDirectoryIfNeeded(
59+
try await ApolloFileManager.default.createContainingDirectoryIfNeeded(
6060
forPath: configuration.outputPath
6161
)
6262

Sources/ApolloCodegenLib/CodegenConfiguration/ApolloCodegenConfiguration+OperationManifestConfiguration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import Foundation
22

33
extension ApolloCodegenConfiguration {
44

5-
public struct OperationManifestConfiguration: Codable, Equatable {
6-
5+
public struct OperationManifestConfiguration: Codable, Equatable, Sendable {
6+
77
// MARK: - Properties
88

99
/// Local path where the generated operation manifest file should be written.
1010
public let path: String
1111
/// The version format to use when generating the operation manifest. Defaults to `.persistedQueries`.
1212
public let version: Version
1313

14-
public enum Version: String, Codable, Equatable {
14+
public enum Version: String, Codable, Equatable, Sendable {
1515
/// Generates an operation manifest for use with persisted queries.
1616
case persistedQueries
1717
/// Generates an operation manifest in the legacy safelisting format used prior to the

Sources/ApolloCodegenLib/CodegenConfiguration/ApolloCodegenConfiguration+SchemaCustomization.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import Foundation
22

33
extension ApolloCodegenConfiguration {
44

5-
public struct SchemaCustomization: Codable, Equatable {
6-
5+
public struct SchemaCustomization: Codable, Equatable, Sendable {
6+
77
// MARK: - Properties
88

99
/// Dictionary with Keys representing the types being renamed/customized, and
@@ -54,7 +54,7 @@ extension ApolloCodegenConfiguration {
5454

5555
// MARK: - Enums
5656

57-
public enum CustomSchemaTypeName: Codable, ExpressibleByStringLiteral, Equatable {
57+
public enum CustomSchemaTypeName: Codable, ExpressibleByStringLiteral, Equatable, Sendable {
5858
case type(name: String)
5959
case `enum`(name: String?, cases: [String: String]?)
6060
case inputObject(name: String?, fields: [String: String]?)

0 commit comments

Comments
 (0)