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

chore!: Require Swift 5.7, fix deprecation warnings #1173

Merged
merged 5 commits into from
Oct 11, 2023
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.7

//
// Copyright Amazon.com Inc. or its affiliates.
Expand Down Expand Up @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) {
]
case (false, true):
package.dependencies += [
.package(url: smithySwiftURL, .branch("main"))
.package(url: smithySwiftURL, branch: "main")
]
case (false, false):
package.dependencies += [
.package(url: smithySwiftURL, .exact(version))
.package(url: smithySwiftURL, exact: version)
]
}
}

func addCRTDependency(_ version: Version) {
package.dependencies += [
.package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version))
.package(url: "https://github.com/awslabs/aws-crt-swift", exact: version)
]
}

Expand Down
116 changes: 0 additions & 116 deletions Docker/5.5.3/ubuntu/20.04/Dockerfile

This file was deleted.

10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.7

//
// Copyright Amazon.com Inc. or its affiliates.
Expand Down Expand Up @@ -68,18 +68,18 @@ func addClientRuntimeDependency(_ version: Version) {
]
case (false, true):
package.dependencies += [
.package(url: smithySwiftURL, .branch("main"))
.package(url: smithySwiftURL, branch: "main")
]
case (false, false):
package.dependencies += [
.package(url: smithySwiftURL, .exact(version))
.package(url: smithySwiftURL, exact: version)
]
}
}

func addCRTDependency(_ version: Version) {
package.dependencies += [
.package(url: "https://github.com/awslabs/aws-crt-swift", .exact(version))
.package(url: "https://github.com/awslabs/aws-crt-swift", exact: version)
]
}

Expand Down Expand Up @@ -555,4 +555,4 @@ let servicesWithIntegrationTests: [String] = [
servicesWithIntegrationTests.forEach(addIntegrationTestTarget)

// Uncomment this line to enable protocol tests
// addProtocolTests()
addProtocolTests()
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $ swift package init --type executable

2. Edit your new package's `Package.swift` file to read:
```
// swift-tools-version: 5.5
// swift-tools-version: 5.7

import PackageDescription

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ import XCTest
@_spi(FileBasedConfig) @testable import AWSClientRuntime

class CachedCredentialsProviderTests: XCTestCase {

func testGetCredentials() async throws {
var counter: Int = 0
let accessKey = UUID().uuidString
let secret = UUID().uuidString
let coreProvider = MockCredentialsProvider {
counter += 1
return .init(accessKey: "some_access_key", secret: "some_secret")
return .init(accessKey: accessKey, secret: secret)
}

let subject = try CachedCredentialsProvider(
source: coreProvider,
refreshTime: 1
refreshTime: 0.01
)

_ = try await subject.getCredentials()
_ = try await subject.getCredentials()
_ = try await subject.getCredentials()
_ = try await subject.getCredentials()


// Counter is 1 because the last three accesses use cached credentials
XCTAssertEqual(counter, 1)
try! await Task.sleep(nanoseconds: 1 * 1_000_000_000)

let credentials = try! await subject.getCredentials()


try! await Task.sleep(nanoseconds: 1_000_000_000 / 100) // 0.01 seconds
let credentials = try await subject.getCredentials()

// Counter is 2 because we slept long enough for cache to expire
XCTAssertEqual(counter, 2)
XCTAssertEqual(credentials.accessKey, "some_access_key")
XCTAssertEqual(credentials.secret, "some_secret")
XCTAssertEqual(credentials.accessKey, accessKey)
XCTAssertEqual(credentials.secret, secret)
}
}
7 changes: 1 addition & 6 deletions codegen/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5.0
// swift-tools-version:5.7

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Expand All @@ -7,7 +7,6 @@

import PackageDescription
import class Foundation.ProcessInfo
import class Foundation.FileManager

let baseDir = "./protocol-test-codegen/build/smithyprojections/protocol-test-codegen"
let baseDirLocal = "./protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local"
Expand Down Expand Up @@ -87,11 +86,7 @@ func appendLibTarget(name: String, path: String) {

func appendTstTarget(name: String, path: String, dependency: String) {
var dependencies: [Target.Dependency] = [.product(name: "SmithyTestUtil", package: "smithy-swift")]
#if swift(>=5.7)
dependencies.append(.byNameItem(name: dependency, condition: nil))
#else
dependencies.append(._byNameItem(name: dependency, condition: nil))
#endif
package.targets.append(.testTarget(name: name,
dependencies: dependencies,
path: "\(path)/swift-codegen/\(name)")
Expand Down
Loading