Skip to content

feat: Add Swift 6 language mode support #920

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

Merged
merged 37 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a56fb84
enable swift 6.0 language mode
dayaffe Apr 3, 2025
8761073
try modifying SwiftDependency
dayaffe Apr 3, 2025
dad0585
make WaiterError's Output: Sendable
dayaffe Apr 3, 2025
dc98b6d
more sendable
dayaffe Apr 3, 2025
f759bdb
more sendable
dayaffe Apr 3, 2025
8ed31c2
try removing version string
dayaffe Apr 3, 2025
1d93807
swift 6 compatible, all tests passing
dayaffe Apr 9, 2025
ebf4060
swiftlint
dayaffe Apr 9, 2025
b1491d3
more sendables
dayaffe Apr 14, 2025
082c5f1
temp add Package.resolved
dayaffe Apr 14, 2025
43b13d1
remove xcbeautify
dayaffe Apr 14, 2025
0d41fdc
bump minimum xcode to 15.3
dayaffe Apr 14, 2025
b672e52
add back xcbeautify
dayaffe Apr 14, 2025
a7afa38
add Event: Sendable and remove 5.9 focal
dayaffe Apr 15, 2025
a8da6ea
remove xcbeautify
dayaffe Apr 15, 2025
829882d
remove xcode 15.3 for now
dayaffe Apr 15, 2025
7a7e745
remove 15.3 and allow xcode 16.1 to run with macos 14
dayaffe Apr 15, 2025
67a9feb
fix: Fix silent failure with CRT HTTP client when response stream has…
sichanyoo Apr 15, 2025
98c6599
Merge branch 'main' into day/swift6-support
dayaffe Apr 15, 2025
0e274f5
update package.resolved
dayaffe Apr 16, 2025
ea89587
ktlint
dayaffe Apr 17, 2025
6162f2c
Clean up CRTClientEngine & fix failing test
dayaffe Apr 17, 2025
a6a8040
change ContinuationWrapper from actor to synchronous final class usin…
dayaffe Apr 18, 2025
f22919f
remove unnecessary SerialExecutor constructor
dayaffe Apr 21, 2025
bb3bf8d
DefaultAuthSchemeResolver Sendable
dayaffe Apr 21, 2025
d876045
Merge branch 'main' into day/swift6-support
dayaffe Apr 25, 2025
2310612
set smithy tools version to 5.9
dayaffe Apr 28, 2025
4735c1d
revert CI changes
dayaffe Apr 28, 2025
c638616
use crt 0.58.1
dayaffe Apr 29, 2025
31dca27
version correction
dayaffe Apr 29, 2025
72ed616
address PR comments
dayaffe Apr 30, 2025
f104d7e
try adding CI to edit swift-tools version
dayaffe May 1, 2025
958a5e3
try adding new swift6 compat workflow
dayaffe May 1, 2025
df7c767
intentionally remove Sendable to check build
dayaffe May 1, 2025
2cb9702
add back Sendable
dayaffe May 1, 2025
0fca366
purposefully remove Sendable from HTTPResponse
dayaffe May 1, 2025
4515eb6
add back Sendable to HTTPResponse
dayaffe May 1, 2025
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
34 changes: 1 addition & 33 deletions .github/workflows/continuous-integration.yml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
Expand All @@ -32,26 +31,13 @@ jobs:
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: |
Expand All @@ -77,9 +63,7 @@ jobs:
NSUnbufferedIO=YES xcodebuild \
-scheme smithy-swift-Package \
-destination '${{ matrix.destination }}' \
test 2>&1 \
| xcbeautify

test 2>&1
apple-downstream:
if: github.repository == 'smithy-lang/smithy-swift' || github.event_name == 'pull_request'
runs-on: ${{ matrix.runner }}
Expand All @@ -91,7 +75,6 @@ jobs:
- macos-14
- macos-15
xcode:
- Xcode_15.2
- Xcode_16.1
destination:
- 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
Expand All @@ -102,26 +85,13 @@ jobs:
- 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
- 'platform=macOS'
exclude:
# Don't run old macOS with new Xcode
- runner: macos-14
xcode: Xcode_16.1
# Don't run new macOS with old Xcode
- runner: macos-15
xcode: Xcode_15.2
# Don't run old simulators with new Xcode
- destination: 'platform=tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_16.1
- destination: 'platform=iOS Simulator,OS=17.2,name=iPhone 15'
xcode: Xcode_16.1
- destination: 'platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro'
xcode: Xcode_16.1
# Don't run new simulators with old Xcode
- destination: 'platform=tvOS Simulator,OS=18.1,name=Apple TV 4K (3rd generation) (at 1080p)'
xcode: Xcode_15.2
- destination: 'platform=iOS Simulator,OS=18.1,name=iPhone 16'
xcode: Xcode_15.2
- destination: 'platform=visionOS Simulator,OS=2.1,name=Apple Vision Pro'
xcode: Xcode_15.2
steps:
- name: Configure Xcode
run: |
Expand Down Expand Up @@ -180,7 +150,6 @@ jobs:
- ubuntu-24.04
- ubuntu-24.04-arm
swift:
- 5.9-focal
- 6.0-jammy
container:
image: swift:${{ matrix.swift }}
Expand Down Expand Up @@ -213,7 +182,6 @@ jobs:
- ubuntu-24.04
- ubuntu-24.04-arm
swift:
- 5.9-focal
- 6.0-jammy
container:
image: swift:${{ matrix.swift }}
Expand Down
33 changes: 33 additions & 0 deletions Package.resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this it will be removed

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.9
// swift-tools-version:6.0

import Foundation
import PackageDescription
Expand Down Expand Up @@ -56,7 +56,7 @@ let package = Package(
],
dependencies: {
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/awslabs/aws-crt-swift.git", exact: "0.48.0"),
.package(url: "https://github.com/awslabs/aws-crt-swift.git", branch: "swift6-support"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this

]
let isDocCEnabled = ProcessInfo.processInfo.environment["AWS_SWIFT_SDK_ENABLE_DOCC"] != nil
Expand Down Expand Up @@ -157,7 +157,10 @@ let package = Package(
),
.target(
name: "SmithyHTTPAPI",
dependencies: ["Smithy"]
dependencies: [
"Smithy",
.product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift")
]
),
.target(
name: "SmithyHTTPClient",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public class DefaultAuthSchemeResolverParameters: AuthSchemeResolverParameters {
}
}

public class DefaultAuthSchemeResolver: AuthSchemeResolver {
public final class DefaultAuthSchemeResolver: AuthSchemeResolver, Sendable {
public func resolveAuthScheme(params: AuthSchemeResolverParameters) throws -> [AuthOption] {
return []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
* SPDX-License-Identifier: Apache-2.0.
*/

public protocol IdempotencyTokenGenerator {
public protocol IdempotencyTokenGenerator: Sendable {
func generateToken() -> String
}
2 changes: 1 addition & 1 deletion Sources/ClientRuntime/Endpoints/CRTResolvedEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class CRTResolvedEndpoint {
}
}

public func getProperties() -> [String: AnyHashable]? {
public func getProperties() -> [String: EndpointProperty]? {
switch crtResolvedEndpoint {
case let .endpoint(_, _, properties):
return properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import struct SmithyHTTPAPI.Endpoint
import struct SmithyHTTPAPI.Headers
import enum SmithyHTTPAPI.EndpointPropertyValue

public struct DefaultEndpointResolver<Params: EndpointsRequestContextProviding> {

Expand All @@ -32,6 +33,6 @@ public struct DefaultEndpointResolver<Params: EndpointsRequestContextProviding>

let headers = crtResolvedEndpoint.getHeaders() ?? [:]
let properties = crtResolvedEndpoint.getProperties() ?? [:]
return try Endpoint(urlString: url, headers: Headers(headers), properties: properties)
return try Endpoint(urlString: url, headers: Headers(headers), endpointProperties: properties)
}
}
62 changes: 55 additions & 7 deletions Sources/ClientRuntime/Endpoints/EndpointsAuthSchemeResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// SPDX-License-Identifier: Apache-2.0
//

import enum SmithyHTTPAPI.EndpointPropertyValue

/// Supported authentication schemes
public enum EndpointsAuthScheme: Equatable {
case sigV4(SigV4Parameters)
Expand All @@ -25,7 +27,8 @@ extension EndpointsAuthScheme {
/// Initialize an AuthScheme from a dictionary
/// - Parameter dictionary: Dictionary containing the auth scheme
public init(from dictionary: [String: Any]) throws {
guard let name = dictionary["name"] as? String else {
guard let endpointProperty = dictionary["name"] as? SmithyHTTPAPI.EndpointPropertyValue,
case let .string(name) = endpointProperty else {
throw EndpointError.authScheme("Invalid auth scheme")
}
switch name {
Expand Down Expand Up @@ -60,9 +63,29 @@ extension EndpointsAuthScheme.SigV4Parameters {
/// Initialize a SigV4AuthScheme from a dictionary
/// - Parameter dictionary: Dictionary containing the auth scheme
init(from dictionary: [String: Any]) throws {
self.signingName = dictionary["signingName"] as? String
self.signingRegion = dictionary["signingRegion"] as? String
self.disableDoubleEncoding = dictionary["disableDoubleEncoding"] as? Bool
// For signingName (expected to be a string)
if let value = dictionary["signingName"] as? EndpointPropertyValue,
case let .string(name) = value {
self.signingName = name
} else {
self.signingName = nil
}

// For signingRegion (expected to be a string)
if let value = dictionary["signingRegion"] as? EndpointPropertyValue,
case let .string(region) = value {
self.signingRegion = region
} else {
self.signingRegion = nil
}

// For disableDoubleEncoding (expected to be a bool)
if let value = dictionary["disableDoubleEncoding"] as? EndpointPropertyValue,
case let .bool(flag) = value {
self.disableDoubleEncoding = flag
} else {
self.disableDoubleEncoding = nil
}
}
}

Expand All @@ -86,9 +109,34 @@ extension EndpointsAuthScheme.SigV4AParameters {
/// Initialize a SigV4AAuthScheme from a dictionary
/// - Parameter dictionary: Dictionary containing the auth scheme
init(from dictionary: [String: Any]) throws {
self.signingName = dictionary["signingName"] as? String
self.signingRegionSet = dictionary["signingRegionSet"] as? [String]
self.disableDoubleEncoding = dictionary["disableDoubleEncoding"] as? Bool
// Extract signingName
if let value = dictionary["signingName"] as? EndpointPropertyValue,
case let .string(name) = value {
self.signingName = name
} else {
self.signingName = nil
}

// Extract signingRegionSet as an array of String
if let value = dictionary["signingRegionSet"] as? EndpointPropertyValue,
case let .array(regions) = value {
self.signingRegionSet = regions.compactMap { element in
if case let .string(region) = element {
return region
}
return nil
}
} else {
self.signingRegionSet = nil
}

// Extract disableDoubleEncoding
if let value = dictionary["disableDoubleEncoding"] as? EndpointPropertyValue,
case let .bool(flag) = value {
self.disableDoubleEncoding = flag
} else {
self.disableDoubleEncoding = nil
}
}
}

Expand Down
Loading
Loading