From c0ea59d33d9b80502334d2eeedf7d3a07c08a828 Mon Sep 17 00:00:00 2001 From: Josh Elkins Date: Tue, 7 Jan 2025 14:50:21 -0600 Subject: [PATCH] chore: Clean up integration test manifest (#1856) --- IntegrationTests/Package.swift | 138 ++++++------------ .../Resources/.gitkeep | 0 2 files changed, 42 insertions(+), 96 deletions(-) create mode 100644 IntegrationTests/Services/AWSCognitoIdentityIntegrationTests/Resources/.gitkeep diff --git a/IntegrationTests/Package.swift b/IntegrationTests/Package.swift index 772fd161304..8e13752ddc9 100644 --- a/IntegrationTests/Package.swift +++ b/IntegrationTests/Package.swift @@ -7,7 +7,6 @@ // SPDX-License-Identifier: Apache-2.0 // -import Foundation import PackageDescription // MARK: - Target dependencies @@ -21,13 +20,10 @@ extension Target.Dependency { static var awsSDKCommon: Self { .product(name: "AWSSDKCommon", package: "aws-sdk-swift") } static var awsSDKIdentity: Self { .product(name: "AWSSDKIdentity", package: "aws-sdk-swift") } - // CRT module - static var crt: Self { .product(name: "AwsCommonRuntimeKit", package: "aws-crt-swift") } - // Smithy modules static var clientRuntime: Self { .product(name: "ClientRuntime", package: "smithy-swift") } static var smithyIdentity: Self { .product(name: "SmithyIdentity", package: "smithy-swift") } - static var smithyTestUtils: Self { .product(name: "SmithyTestUtil", package: "smithy-swift") } + static var smithyTestUtil: Self { .product(name: "SmithyTestUtil", package: "smithy-swift") } } // MARK: - Base Package @@ -40,57 +36,33 @@ let package = Package( .tvOS(.v13), .watchOS(.v6) ], - targets: [ - .target( - name: "AWSIntegrationTestUtils", - path: "./AWSIntegrationTestUtils" - ) - ] + dependencies: [ + .package(path: "../../smithy-swift"), + .package(path: "../../aws-sdk-swift"), + ], + targets: integrationTestTargets ) -// MARK: - CRT, Smithy ClientRuntime, AWS ClientRuntime Dependencies - -func addDependencies() { - addRuntimeDependencies() - addCRTDependency() -} - -func addRuntimeDependencies() { - let smithySwiftURL = "https://github.com/smithy-lang/smithy-swift" - let awsSDKSwiftURL = "https://github.com/awslabs/aws-sdk-swift" - let useLocalDeps = ProcessInfo.processInfo.environment["AWS_SWIFT_SDK_USE_LOCAL_DEPS"] != nil - let useMainDeps = ProcessInfo.processInfo.environment["AWS_SWIFT_SDK_USE_MAIN_DEPS"] != nil - switch (useLocalDeps, useMainDeps) { - case (true, true): - fatalError("Unable to determine which dependencies to use. Please only specify one of AWS_SWIFT_SDK_USE_LOCAL_DEPS or AWS_SWIFT_SDK_USE_MAIN_DEPS.") - case (true, false): - package.dependencies += [ - .package(path: "../../smithy-swift"), - .package(path: "../../aws-sdk-swift") - ] - case (false, true): - package.dependencies += [ - .package(url: smithySwiftURL, branch: "main"), - .package(url: awsSDKSwiftURL, branch: "main") - ] - case (false, false): - package.dependencies += [ - .package(url: smithySwiftURL, .upToNextMajor(from: "0.0.0")), - .package(url: awsSDKSwiftURL, .upToNextMajor(from: "0.0.0")) - ] - } +private var integrationTestTargets: [Target] { + let integrationTests = [ + "AWSCloudFrontKeyValueStore", + "AWSEC2", + "AWSECS", + "AWSEventBridge", + "AWSGlacier", + "AWSKinesis", + "AWSMediaConvert", + "AWSRoute53", + "AWSS3", + "AWSSQS", + "AWSSTS", + "AWSTranscribeStreaming", + "AWSCognitoIdentity", + ].map { integrationTestTarget($0) } + return integrationTests + [.target(name: "AWSIntegrationTestUtils", path: "./AWSIntegrationTestUtils")] } -func addCRTDependency() { - package.dependencies += [ - .package(url: "https://github.com/awslabs/aws-crt-swift", .upToNextMajor(from: "0.0.0")) - ] -} - -// MARK: - Integration test target helper functions - - -func addIntegrationTestTarget(_ name: String) { +private func integrationTestTarget(_ name: String) -> Target { let integrationTestName = "\(name)IntegrationTests" var additionalDependencies: [String] = [] var exclusions: [String] = [] @@ -121,48 +93,22 @@ func addIntegrationTestTarget(_ name: String) { default: break } - package.targets += [ - .testTarget( - name: integrationTestName, - dependencies: [ - .crt, - .clientRuntime, - .awsClientRuntime, - .smithyTestUtils, - .awsSDKIdentity, - .smithyIdentity, - .awsSDKCommon, - .awsIntegrationTestUtils, - .product(name: name, package: "aws-sdk-swift") - ] + additionalDependencies.map { - Target.Dependency.product(name: $0, package: "aws-sdk-swift", condition: nil) - }, - path: "./Services/\(integrationTestName)", - exclude: exclusions, - resources: [.process("Resources")] - ) - ] + return .testTarget( + name: integrationTestName, + dependencies: [ + .clientRuntime, + .awsClientRuntime, + .smithyTestUtil, + .awsSDKIdentity, + .smithyIdentity, + .awsSDKCommon, + .awsIntegrationTestUtils, + .product(name: name, package: "aws-sdk-swift") + ] + additionalDependencies.map { + Target.Dependency.product(name: $0, package: "aws-sdk-swift", condition: nil) + }, + path: "./Services/\(integrationTestName)", + exclude: exclusions, + resources: [.process("Resources")] + ) } - -let servicesWithIntegrationTests: [String] = [ - "AWSCloudFrontKeyValueStore", - "AWSEC2", - "AWSECS", - "AWSEventBridge", - "AWSGlacier", - "AWSKinesis", - "AWSMediaConvert", - "AWSRoute53", - "AWSS3", - "AWSSQS", - "AWSSTS", - "AWSTranscribeStreaming", - "AWSCognitoIdentity", -] - -func addIntegrationTests() { - servicesWithIntegrationTests.forEach { addIntegrationTestTarget($0) } -} - -addDependencies() -addIntegrationTests() diff --git a/IntegrationTests/Services/AWSCognitoIdentityIntegrationTests/Resources/.gitkeep b/IntegrationTests/Services/AWSCognitoIdentityIntegrationTests/Resources/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d