Skip to content

Commit

Permalink
feat!: Modularize event streams & event streams auth (#1530)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbelkins authored May 31, 2024
1 parent 1e8e4c1 commit bf8a8b3
Show file tree
Hide file tree
Showing 141 changed files with 1,096 additions and 1,380 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: |
set -o pipefail && \
NSUnbufferedIO=YES xcodebuild \
-scheme aws-sdk-swift \
-scheme aws-sdk-swift-Package \
-destination '${{ matrix.destination }}' \
test 2>&1 \
| xcbeautify
Expand Down
66 changes: 62 additions & 4 deletions AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ extension Target.Dependency {
static var clientRuntime: Self { .product(name: "ClientRuntime", package: "smithy-swift") }
static var smithyRetriesAPI: Self { .product(name: "SmithyRetriesAPI", package: "smithy-swift") }
static var smithyRetries: Self { .product(name: "SmithyRetries", package: "smithy-swift") }
static var smithy: Self { .product(name: "Smithy", package: "smithy-swift") }
static var smithyIdentityAPI: Self { .product(name: "SmithyIdentityAPI", package: "smithy-swift") }
static var smithyEventStreamsAPI: Self { .product(name: "SmithyEventStreamsAPI", package: "smithy-swift") }
static var smithyEventStreamsAuthAPI: Self { .product(name: "SmithyEventStreamsAuthAPI", package: "smithy-swift") }
static var smithyEventStreams: Self { .product(name: "SmithyEventStreams", package: "smithy-swift") }
static var smithyChecksumsAPI: Self { .product(name: "SmithyChecksumsAPI", package: "smithy-swift") }
static var smithyTestUtils: Self { .product(name: "SmithyTestUtil", package: "smithy-swift") }
}

Expand All @@ -35,7 +41,10 @@ let package = Package(
.watchOS(.v6)
],
products: [
.library(name: "AWSClientRuntime", targets: ["AWSClientRuntime"])
.library(name: "AWSClientRuntime", targets: ["AWSClientRuntime"]),
.library(name: "AWSSDKEventStreamsAuth", targets: ["AWSSDKEventStreamsAuth"]),
.library(name: "AWSSDKIdentity", targets: ["AWSSDKIdentity"]),
.library(name: "AWSSDKHTTPAuth", targets: ["AWSSDKHTTPAuth"]),
],
targets: [
.target(
Expand All @@ -45,17 +54,50 @@ let package = Package(
),
.target(
name: "AWSClientRuntime",
dependencies: [.crt, .clientRuntime, .smithyRetriesAPI, .smithyRetries],
dependencies: [
.crt,
.clientRuntime,
.smithyRetriesAPI,
.smithyRetries,
.smithyEventStreamsAPI,
.smithyEventStreamsAuthAPI,
"AWSSDKIdentity",
],
path: "./Sources/Core/AWSClientRuntime",
resources: [
.copy("PrivacyInfo.xcprivacy")
]
),
.target(
name: "AWSSDKIdentity",
dependencies: [.crt, .smithyIdentityAPI],
path: "./Sources/Core/AWSSDKIdentity"
),
.target(
name: "AWSSDKHTTPAuth",
dependencies: [.crt, .clientRuntime, .smithyChecksumsAPI, "AWSSDKIdentity"],
path: "./Sources/Core/AWSSDKHTTPAuth"
),
.target(
name: "AWSSDKEventStreamsAuth",
dependencies: [.smithyEventStreamsAPI, .smithyEventStreamsAuthAPI, .smithyEventStreams, .crt, .clientRuntime, "AWSSDKHTTPAuth"],
path: "./Sources/Core/AWSSDKEventStreamsAuth"
),
.testTarget(
name: "AWSClientRuntimeTests",
dependencies: [.awsClientRuntime, .clientRuntime, .smithyTestUtils],
path: "./Tests/Core/AWSClientRuntimeTests",
resources: [.process("Resources")]
),
.testTarget(
name: "AWSSDKHTTPAuthTests",
dependencies: ["AWSSDKHTTPAuth", "AWSClientRuntime", "AWSSDKEventStreamsAuth", .crt, .clientRuntime, .smithyTestUtils],
path: "./Tests/Core/AWSSDKHTTPAuthTests"
),
.testTarget(
name: "AWSSDKEventStreamsAuthTests",
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth"],
path: "./Tests/Core/AWSSDKEventStreamsAuthTests"
)
]
)
Expand Down Expand Up @@ -105,14 +147,30 @@ func addDoccDependency() {

// MARK: - Services

let serviceTargetDependencies: [Target.Dependency] = [
.clientRuntime,
.awsClientRuntime,
.smithyRetriesAPI,
.smithyRetries,
.smithy,
.smithyIdentityAPI,
.smithyEventStreamsAPI,
.smithyEventStreamsAuthAPI,
.smithyEventStreams,
.smithyChecksumsAPI,
"AWSSDKIdentity",
"AWSSDKHTTPAuth",
"AWSSDKEventStreamsAuth",
]

func addServiceTarget(_ name: String) {
package.products += [
.library(name: name, targets: [name]),
]
package.targets += [
.target(
name: name,
dependencies: [.clientRuntime, .awsClientRuntime, .smithyRetriesAPI, .smithyRetries],
dependencies: serviceTargetDependencies,
path: "./Sources/Services/\(name)"
)
]
Expand Down Expand Up @@ -229,7 +287,7 @@ func addProtocolTests() {
for protocolTest in protocolTests {
let target = Target.target(
name: protocolTest.name,
dependencies: [.clientRuntime, .awsClientRuntime],
dependencies: serviceTargetDependencies,
path: "\(protocolTest.sourcePath)/swift-codegen/\(protocolTest.name)"
)
let testTarget = protocolTest.buildOnly ? nil : Target.testTarget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import AWSSDKHTTPAuth
import XCTest
import ClientRuntime
import AWSClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import AWSSDKHTTPAuth
import XCTest
import AWSEventBridge
import ClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// SPDX-License-Identifier: Apache-2.0
//

import Smithy
import SmithyHTTPAPI
import Foundation
import XCTest
import AWSS3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import SmithyIdentityAPI
import Foundation
import XCTest
import AWSS3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import Smithy
import XCTest
import AWSS3
@testable import ClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import AWSSDKHTTPAuth
import XCTest
import AWSS3
import ClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import Smithy
import AWSSDKHTTPAuth
import XCTest
import AWSS3
import AWSS3Control
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import Smithy
import XCTest
import AWSS3
@testable import ClientRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// SPDX-License-Identifier: Apache-2.0
//

import Smithy
import Foundation
import XCTest
import AWSS3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import XCTest
import AWSSTS
import ClientRuntime
import AWSClientRuntime
import AWSSDKHTTPAuth

/// Tests presigned request using STS::getCallerIdentity.
class STSPresignedRequestTests: XCTestCase {
Expand Down
72 changes: 65 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ extension Target.Dependency {
static var clientRuntime: Self { .product(name: "ClientRuntime", package: "smithy-swift") }
static var smithyRetriesAPI: Self { .product(name: "SmithyRetriesAPI", package: "smithy-swift") }
static var smithyRetries: Self { .product(name: "SmithyRetries", package: "smithy-swift") }
static var smithy: Self { .product(name: "Smithy", package: "smithy-swift") }
static var smithyIdentityAPI: Self { .product(name: "SmithyIdentityAPI", package: "smithy-swift") }
static var smithyEventStreamsAPI: Self { .product(name: "SmithyEventStreamsAPI", package: "smithy-swift") }
static var smithyEventStreamsAuthAPI: Self { .product(name: "SmithyEventStreamsAuthAPI", package: "smithy-swift") }
static var smithyEventStreams: Self { .product(name: "SmithyEventStreams", package: "smithy-swift") }
static var smithyChecksumsAPI: Self { .product(name: "SmithyChecksumsAPI", package: "smithy-swift") }
static var smithyTestUtils: Self { .product(name: "SmithyTestUtil", package: "smithy-swift") }
}

Expand All @@ -35,7 +41,10 @@ let package = Package(
.watchOS(.v6)
],
products: [
.library(name: "AWSClientRuntime", targets: ["AWSClientRuntime"])
.library(name: "AWSClientRuntime", targets: ["AWSClientRuntime"]),
.library(name: "AWSSDKEventStreamsAuth", targets: ["AWSSDKEventStreamsAuth"]),
.library(name: "AWSSDKIdentity", targets: ["AWSSDKIdentity"]),
.library(name: "AWSSDKHTTPAuth", targets: ["AWSSDKHTTPAuth"]),
],
targets: [
.target(
Expand All @@ -45,17 +54,50 @@ let package = Package(
),
.target(
name: "AWSClientRuntime",
dependencies: [.crt, .clientRuntime, .smithyRetriesAPI, .smithyRetries],
dependencies: [
.crt,
.clientRuntime,
.smithyRetriesAPI,
.smithyRetries,
.smithyEventStreamsAPI,
.smithyEventStreamsAuthAPI,
"AWSSDKIdentity",
],
path: "./Sources/Core/AWSClientRuntime",
resources: [
.copy("PrivacyInfo.xcprivacy")
]
),
.target(
name: "AWSSDKIdentity",
dependencies: [.crt, .smithyIdentityAPI],
path: "./Sources/Core/AWSSDKIdentity"
),
.target(
name: "AWSSDKHTTPAuth",
dependencies: [.crt, .clientRuntime, .smithyChecksumsAPI, "AWSSDKIdentity"],
path: "./Sources/Core/AWSSDKHTTPAuth"
),
.target(
name: "AWSSDKEventStreamsAuth",
dependencies: [.smithyEventStreamsAPI, .smithyEventStreamsAuthAPI, .smithyEventStreams, .crt, .clientRuntime, "AWSSDKHTTPAuth"],
path: "./Sources/Core/AWSSDKEventStreamsAuth"
),
.testTarget(
name: "AWSClientRuntimeTests",
dependencies: [.awsClientRuntime, .clientRuntime, .smithyTestUtils],
path: "./Tests/Core/AWSClientRuntimeTests",
resources: [.process("Resources")]
),
.testTarget(
name: "AWSSDKHTTPAuthTests",
dependencies: ["AWSSDKHTTPAuth", "AWSClientRuntime", "AWSSDKEventStreamsAuth", .crt, .clientRuntime, .smithyTestUtils],
path: "./Tests/Core/AWSSDKHTTPAuthTests"
),
.testTarget(
name: "AWSSDKEventStreamsAuthTests",
dependencies: ["AWSClientRuntime", "AWSSDKEventStreamsAuth"],
path: "./Tests/Core/AWSSDKEventStreamsAuthTests"
)
]
)
Expand Down Expand Up @@ -105,14 +147,30 @@ func addDoccDependency() {

// MARK: - Services

let serviceTargetDependencies: [Target.Dependency] = [
.clientRuntime,
.awsClientRuntime,
.smithyRetriesAPI,
.smithyRetries,
.smithy,
.smithyIdentityAPI,
.smithyEventStreamsAPI,
.smithyEventStreamsAuthAPI,
.smithyEventStreams,
.smithyChecksumsAPI,
"AWSSDKIdentity",
"AWSSDKHTTPAuth",
"AWSSDKEventStreamsAuth",
]

func addServiceTarget(_ name: String) {
package.products += [
.library(name: name, targets: [name]),
]
package.targets += [
.target(
name: name,
dependencies: [.clientRuntime, .awsClientRuntime, .smithyRetriesAPI, .smithyRetries],
dependencies: serviceTargetDependencies,
path: "./Sources/Services/\(name)"
)
]
Expand Down Expand Up @@ -229,7 +287,7 @@ func addProtocolTests() {
for protocolTest in protocolTests {
let target = Target.target(
name: protocolTest.name,
dependencies: [.clientRuntime, .awsClientRuntime],
dependencies: serviceTargetDependencies,
path: "\(protocolTest.sourcePath)/swift-codegen/\(protocolTest.name)"
)
let testTarget = protocolTest.buildOnly ? nil : Target.testTarget(
Expand All @@ -255,7 +313,7 @@ addDependencies(
)

// Uncomment this line to exclude runtime unit tests
// excludeRuntimeUnitTests()
excludeRuntimeUnitTests()

let serviceTargets: [String] = [
"AWSACM",
Expand Down Expand Up @@ -641,7 +699,7 @@ let serviceTargets: [String] = [
]

// Uncomment this line to enable all services
addAllServices()
// addAllServices()

let servicesWithIntegrationTests: [String] = [
"AWSCloudFrontKeyValueStore",
Expand All @@ -661,7 +719,7 @@ let servicesWithIntegrationTests: [String] = [
// addIntegrationTests()

// Uncomment this line to enable protocol tests
// addProtocolTests()
addProtocolTests()

addResolvedTargets()

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
// SPDX-License-Identifier: Apache-2.0
//

import SmithyIdentityAPI
import struct ClientRuntime.DefaultSDKRuntimeConfiguration
import enum ClientRuntime.DefaultRetryErrorInfoProvider
import protocol ClientRuntime.HTTPClient
import protocol SmithyHTTPAPI.HTTPClient
import class ClientRuntime.HttpClientConfiguration
import protocol ClientRuntime.IdempotencyTokenGenerator
import enum ClientRuntime.ClientLogMode
Expand Down
Loading

0 comments on commit bf8a8b3

Please sign in to comment.