From 7e8e10da05e376ffce0d1721526e20e68d8a81d4 Mon Sep 17 00:00:00 2001 From: Adam Fowler Date: Fri, 14 Apr 2023 09:31:35 +0100 Subject: [PATCH] Swift 5.8 (#72) * Swift 5.8 * Minimum required swift version is 5.6 * Replace _SotoSendable with Sendable --- .github/workflows/ci.yml | 2 +- Package@swift-5.4.swift | 39 ------------------- Package@swift-5.5.swift | 39 ------------------- .../Templates/api+async.swift | 4 -- .../SotoCodeGeneratorLib/Templates/enum.swift | 4 +- .../Templates/enumWithValues.swift | 2 +- 6 files changed, 4 insertions(+), 86 deletions(-) delete mode 100644 Package@swift-5.4.swift delete mode 100644 Package@swift-5.5.swift diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9ed2bb..b8990e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: strategy: matrix: tag: - - swift:5.5 - swift:5.6 - swift:5.7 + - swift:5.8 container: image: ${{ matrix.tag }} steps: diff --git a/Package@swift-5.4.swift b/Package@swift-5.4.swift deleted file mode 100644 index 13102aa..0000000 --- a/Package@swift-5.4.swift +++ /dev/null @@ -1,39 +0,0 @@ -// swift-tools-version:5.4 -import PackageDescription - -let package = Package( - name: "soto-codegenerator", - products: [ - .executable(name: "SotoCodeGenerator", targets: ["SotoCodeGenerator"]), - .library(name: "SotoCodeGeneratorLib", targets: ["SotoCodeGeneratorLib"]) - ], - dependencies: [ - .package(url: "https://github.com/soto-project/soto-smithy.git", from: "0.3.1"), - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"), - .package(url: "https://github.com/hummingbird-project/hummingbird-mustache.git", from: "1.0.3"), - .package(url: "https://github.com/apple/swift-log.git", from: "1.4.0"), - ], - targets: [ - .executableTarget( - name: "SotoCodeGenerator", - dependencies: [ - .byName(name: "SotoCodeGeneratorLib"), - .product(name: "ArgumentParser", package: "swift-argument-parser"), - .product(name: "Logging", package: "swift-log") - ] - ), - .target( - name: "SotoCodeGeneratorLib", - dependencies: [ - .product(name: "SotoSmithy", package: "soto-smithy"), - .product(name: "SotoSmithyAWS", package: "soto-smithy"), - .product(name: "HummingbirdMustache", package: "hummingbird-mustache"), - .product(name: "Logging", package: "swift-log") - ] - ), - .testTarget( - name: "SotoCodeGeneratorTests", - dependencies: [.byName(name: "SotoCodeGeneratorLib")] - ) - ] -) diff --git a/Package@swift-5.5.swift b/Package@swift-5.5.swift deleted file mode 100644 index 2b4ba45..0000000 --- a/Package@swift-5.5.swift +++ /dev/null @@ -1,39 +0,0 @@ -// swift-tools-version:5.5 -import PackageDescription - -let package = Package( - name: "soto-codegenerator", - products: [ - .executable(name: "SotoCodeGenerator", targets: ["SotoCodeGenerator"]), - .library(name: "SotoCodeGeneratorLib", targets: ["SotoCodeGeneratorLib"]) - ], - dependencies: [ - .package(url: "https://github.com/soto-project/soto-smithy.git", from: "0.3.1"), - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.0.0"), - .package(url: "https://github.com/hummingbird-project/hummingbird-mustache.git", from: "1.0.3"), - .package(url: "https://github.com/apple/swift-log.git", from: "1.4.0"), - ], - targets: [ - .executableTarget( - name: "SotoCodeGenerator", - dependencies: [ - .byName(name: "SotoCodeGeneratorLib"), - .product(name: "ArgumentParser", package: "swift-argument-parser"), - .product(name: "Logging", package: "swift-log") - ] - ), - .target( - name: "SotoCodeGeneratorLib", - dependencies: [ - .product(name: "SotoSmithy", package: "soto-smithy"), - .product(name: "SotoSmithyAWS", package: "soto-smithy"), - .product(name: "HummingbirdMustache", package: "hummingbird-mustache"), - .product(name: "Logging", package: "swift-log") - ] - ), - .testTarget( - name: "SotoCodeGeneratorTests", - dependencies: [.byName(name: "SotoCodeGeneratorLib")] - ) - ] -) diff --git a/Sources/SotoCodeGeneratorLib/Templates/api+async.swift b/Sources/SotoCodeGeneratorLib/Templates/api+async.swift index 067c3a1..b483957 100644 --- a/Sources/SotoCodeGeneratorLib/Templates/api+async.swift +++ b/Sources/SotoCodeGeneratorLib/Templates/api+async.swift @@ -17,8 +17,6 @@ extension Templates { {{%CONTENT_TYPE:TEXT}} {{>header}} - #if compiler(>=5.5.2) && canImport(_Concurrency) - import SotoCore @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @@ -68,7 +66,5 @@ extension Templates { {{>waiters_async}} {{/waiters}} - #endif // compiler(>=5.5.2) && canImport(_Concurrency) - """ } diff --git a/Sources/SotoCodeGeneratorLib/Templates/enum.swift b/Sources/SotoCodeGeneratorLib/Templates/enum.swift index 5364c54..ba8231d 100644 --- a/Sources/SotoCodeGeneratorLib/Templates/enum.swift +++ b/Sources/SotoCodeGeneratorLib/Templates/enum.swift @@ -16,7 +16,7 @@ extension Templates { static let enumTemplate = """ {{%CONTENT_TYPE:TEXT}} {{#isExtensible}} - {{scope}} struct {{name}}: RawRepresentable, Equatable, Codable, _SotoSendable { + {{scope}} struct {{name}}: RawRepresentable, Equatable, Codable, Sendable { {{scope}} var rawValue: String {{scope}} init(rawValue: String) { @@ -32,7 +32,7 @@ extension Templates { } {{/isExtensible}} {{^isExtensible}} - {{scope}} enum {{name}}: String, CustomStringConvertible, Codable, _SotoSendable { + {{scope}} enum {{name}}: String, CustomStringConvertible, Codable, Sendable { {{#values}} {{#documentation}} {{>comment}} diff --git a/Sources/SotoCodeGeneratorLib/Templates/enumWithValues.swift b/Sources/SotoCodeGeneratorLib/Templates/enumWithValues.swift index a452360..776327c 100644 --- a/Sources/SotoCodeGeneratorLib/Templates/enumWithValues.swift +++ b/Sources/SotoCodeGeneratorLib/Templates/enumWithValues.swift @@ -16,7 +16,7 @@ extension Templates { static let enumWithValuesTemplate = #""" {{! Template for a AWSShape enum with values }} {{%CONTENT_TYPE:TEXT}} - {{scope}} {{object}} {{name}}: {{shapeProtocol}}, _SotoSendable { + {{scope}} {{object}} {{name}}: {{shapeProtocol}}, Sendable { {{#namespace}} {{scope}} static let _xmlNamespace: String? = "{{.}}" {{/namespace}}