diff --git a/AWSSDKSwiftCLI/Package.swift b/AWSSDKSwiftCLI/Package.swift index 5c0e73ccfd4..d96f05c3685 100644 --- a/AWSSDKSwiftCLI/Package.swift +++ b/AWSSDKSwiftCLI/Package.swift @@ -1,5 +1,4 @@ -// swift-tools-version: 5.5 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version: 5.7 import PackageDescription @@ -26,9 +25,6 @@ let package = Package( resources: [ .process("Resources/Package.Base.swift"), .process("Resources/DocIndex.Base.md") - ], - swiftSettings: [ - .unsafeFlags(["-package-description-version", "5.7"]) ] ), .testTarget( diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift index 3a0c934f4e8..1b3d074b628 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Commands/GeneratePackageManifest.swift @@ -38,6 +38,12 @@ struct GeneratePackageManifestCommand: ParsableCommand { @Flag(help: "If the package manifest should include the protocol tests.") var includeProtocolTests: Bool = false + @Flag(help: "If the package manifest should exclude AWS services.") + var excludeAWSServices = false + + @Flag(help: "If the package manifest should exclude runtime tests.") + var excludeRuntimeTests = false + func run() throws { let generatePackageManifest = GeneratePackageManifest.standard( repoPath: repoPath, @@ -46,7 +52,9 @@ struct GeneratePackageManifestCommand: ParsableCommand { crtVersion: crtVersion, services: services.isEmpty ? nil : services, includeIntegrationTests: includeIntegrationTests, - includeProtocolTests: includeProtocolTests + includeProtocolTests: includeProtocolTests, + excludeAWSServices: excludeAWSServices, + excludeRuntimeTests: excludeRuntimeTests ) try generatePackageManifest.run() } @@ -73,6 +81,10 @@ struct GeneratePackageManifest { let includeIntegrationTests: Bool /// If the package manifest should include the protocol tests. let includeProtocolTests: Bool + /// If the package manifest should exclude the AWS services. + let excludeAWSServices: Bool + /// If the package manifest should exclude runtime unit tests. + let excludeRuntimeTests: Bool typealias BuildPackageManifest = ( _ clientRuntimeVersion: Version, @@ -97,7 +109,7 @@ struct GeneratePackageManifest { /// - Returns: The contents of the generated package manifest. func generatePackageManifestContents() throws -> String { let versions = try resolveVersions() - let servicesWithIntegrationTests = try includeIntegrationTests ? resolveServicesWithIntegrationTests() : [] + let servicesWithIntegrationTests = try resolveServicesWithIntegrationTests() let services = try resolveServices().map { PackageManifestBuilder.Service( name: $0, @@ -226,7 +238,9 @@ extension GeneratePackageManifest { crtVersion: Version? = nil, services: [String]? = nil, includeIntegrationTests: Bool = false, - includeProtocolTests: Bool = false + includeProtocolTests: Bool = false, + excludeAWSServices: Bool = false, + excludeRuntimeTests: Bool = false ) -> Self { GeneratePackageManifest( repoPath: repoPath, @@ -235,13 +249,18 @@ extension GeneratePackageManifest { crtVersion: crtVersion, services: services, includeIntegrationTests: includeIntegrationTests, - includeProtocolTests: includeProtocolTests + includeProtocolTests: includeProtocolTests, + excludeAWSServices: excludeAWSServices, + excludeRuntimeTests: excludeRuntimeTests ) { _clientRuntimeVersion, _crtVersion, _services in let builder = PackageManifestBuilder( clientRuntimeVersion: _clientRuntimeVersion, crtVersion: _crtVersion, services: _services, - includeProtocolTests: includeProtocolTests + includeProtocolTests: includeProtocolTests, + includeIntegrationTests: includeIntegrationTests, + excludeAWSServices: excludeAWSServices, + excludeRuntimeTests: excludeRuntimeTests ) return try builder.build() } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift index 368e7341977..356113a2e36 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/PackageManifestBuilder.swift @@ -19,6 +19,9 @@ struct PackageManifestBuilder { let crtVersion: Version let services: [Service] let includeProtocolTests: Bool + let includeIntegrationTests: Bool + let excludeAWSServices: Bool + let excludeRuntimeTests: Bool let basePackageContents: () throws -> String init( @@ -26,22 +29,31 @@ struct PackageManifestBuilder { crtVersion: Version, services: [Service], includeProtocolTests: Bool, + includeIntegrationTests: Bool, + excludeAWSServices: Bool, + excludeRuntimeTests: Bool, basePackageContents: @escaping () throws -> String ) { self.clientRuntimeVersion = clientRuntimeVersion self.crtVersion = crtVersion self.services = services self.includeProtocolTests = includeProtocolTests + self.includeIntegrationTests = includeIntegrationTests + self.excludeAWSServices = excludeAWSServices self.basePackageContents = basePackageContents + self.excludeRuntimeTests = excludeRuntimeTests } init( clientRuntimeVersion: Version, crtVersion: Version, services: [Service], - includeProtocolTests: Bool + includeProtocolTests: Bool, + includeIntegrationTests: Bool, + excludeAWSServices: Bool, + excludeRuntimeTests: Bool ) { - self.init(clientRuntimeVersion: clientRuntimeVersion, crtVersion: crtVersion, services: services, includeProtocolTests: includeProtocolTests) { + self.init(clientRuntimeVersion: clientRuntimeVersion, crtVersion: crtVersion, services: services, includeProtocolTests: includeProtocolTests, includeIntegrationTests: includeIntegrationTests, excludeAWSServices: excludeAWSServices, excludeRuntimeTests: excludeRuntimeTests) { // Returns the contents of the base package manifest stored in the bundle at `Resources/Package.Base.swift` let basePackageName = "Package.Base" @@ -83,6 +95,9 @@ struct PackageManifestBuilder { // Add the generated content that defines the dependencies' versions buildDependencies(), "", + // Remove the runtime tests if needed + buildRuntimeTests(), + "", // Add the generated content that defines the list of services to include buildServiceTargets(), "", @@ -90,6 +105,8 @@ struct PackageManifestBuilder { buildIntegrationTestsTargets(), "", buildProtocolTests(), + "", + buildResolvedServices(), "\n" ] return contents.joined(separator: .newline) @@ -104,14 +121,6 @@ struct PackageManifestBuilder { /// Builds the dependencies versions - /// - ///```swift - ///addDependencies( - /// clientRuntimeVersion: 0.1.0, - /// crtVersion: 0.1.0 - ///) - ///``` - /// private func buildDependencies() -> String { """ addDependencies( @@ -120,72 +129,53 @@ struct PackageManifestBuilder { ) """ } - + + private func buildRuntimeTests() -> String { + return [ + "// Uncomment this line to exclude runtime unit tests", + (excludeRuntimeTests ? "" : "// ") + "excludeRuntimeUnitTests()" + ].joined(separator: .newline) + } + /// Builds the list of services to include. /// This generates an array of strings, where the each item is a name of a service /// and calls the `addServiceTarget` for each item. - /// - ///``` - ///let serviceTargets: [String] = [ - /// "Service Name 1", - /// "Service Name 2", - /// "Service Name 3" - /// // etc... - ///] - ///serviceTagets.forEach(addServiceTarget) - ///``` - /// private func buildServiceTargets() -> String { - let propertyName = "serviceTargets" - var lines: [String] = [] - lines += ["let \(propertyName): [String] = ["] + lines += ["let serviceTargets: [String] = ["] lines += services.map { " \($0.name.wrappedInQuotes())," } lines += ["]"] lines += [""] - lines += ["\(propertyName).forEach(addServiceTarget)"] - + lines += ["// Uncomment this line to enable all services"] + lines += ["\(excludeAWSServices ? "// " : "")addAllServices()"] + return lines.joined(separator: .newline) } /// Builds the list of services to add integration test targets for.. /// This generates an array of strings, where the each item is a name of a service /// and calls the `addIntegrationTestTarget` for each item. - /// - ///``` - ///let servicesWithIntegrationTests: [String] = [ - /// "Service Name 1", - /// "Service Name 2", - /// "Service Name 3" - /// // etc... - ///] - ///serviceTagets.forEach(addIntegrationTestTarget) - ///``` - /// private func buildIntegrationTestsTargets() -> String { - let propertyName = "servicesWithIntegrationTests" - var lines: [String] = [] - lines += ["let \(propertyName): [String] = ["] + lines += ["let servicesWithIntegrationTests: [String] = ["] lines += services.filter(\.includeIntegrationTests).map { " \($0.name.wrappedInQuotes())," } lines += ["]"] lines += [""] - lines += ["\(propertyName).forEach(addIntegrationTestTarget)"] + lines += ["// Uncomment this line to enable integration tests"] + lines += ["\(includeIntegrationTests ? "" : "// ")addIntegrationTests()"] return lines.joined(separator: .newline) } /// Calls the method to include protocol tests in the manifest. - /// - ///``` - ///// Uncomment this line to enable protocol tests - ///addProtocolTests() - ///``` private func buildProtocolTests() -> String { return [ "// Uncomment this line to enable protocol tests", (includeProtocolTests ? "" : "// ") + "addProtocolTests()" - ].joined(separator: .newline) } + + private func buildResolvedServices() -> String { + "addResolvedTargets()" + } } diff --git a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift index 668f742134d..6592a5e2aa9 100644 --- a/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift +++ b/AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Resources/Package.Base.swift @@ -100,7 +100,6 @@ func addDoccDependency() { // MARK: - Services func addServiceTarget(_ name: String) { - let testName = "\(name)Tests" package.products += [ .library(name: name, targets: [name]), ] @@ -109,7 +108,13 @@ func addServiceTarget(_ name: String) { name: name, dependencies: [.clientRuntime, .awsClientRuntime], path: "./Sources/Services/\(name)" - ), + ) + ] +} + +func addServiceUnitTestTarget(_ name: String) { + let testName = "\(name)Tests" + package.targets += [ .testTarget( name: "\(testName)", dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils], @@ -120,7 +125,7 @@ func addServiceTarget(_ name: String) { func addIntegrationTestTarget(_ name: String) { let integrationTestName = "\(name)IntegrationTests" - var additionalDependencies: [PackageDescription.Target.Dependency] = [] + var additionalDependencies: [String] = [] var exclusions: [String] = [] switch name { case "AWSECS": @@ -134,10 +139,12 @@ func addIntegrationTestTarget(_ name: String) { default: break } + integrationTestServices.insert(name) + additionalDependencies.forEach { integrationTestServices.insert($0) } package.targets += [ .testTarget( name: integrationTestName, - dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils] + additionalDependencies, + dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils] + additionalDependencies.map { Target.Dependency.target(name: $0, condition: nil) }, path: "./IntegrationTests/Services/\(integrationTestName)", exclude: exclusions, resources: [.process("Resources")] @@ -145,6 +152,25 @@ func addIntegrationTestTarget(_ name: String) { ] } +var enabledServices = Set() + +var enabledServiceUnitTests = Set() + +func addAllServices() { + enabledServices = Set(serviceTargets) + enabledServiceUnitTests = Set(serviceTargets) +} + +var integrationTestServices = Set() + +func addIntegrationTests() { + servicesWithIntegrationTests.forEach { addIntegrationTestTarget($0) } +} + +func excludeRuntimeUnitTests() { + package.targets.removeAll { $0.name == "AWSClientRuntimeTests" } +} + func addProtocolTests() { struct ProtocolTest { @@ -194,3 +220,8 @@ func addProtocolTests() { ] } } + +func addResolvedTargets() { + enabledServices.union(integrationTestServices).forEach(addServiceTarget) + enabledServiceUnitTests.forEach(addServiceUnitTestTarget) +} diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift index eaa5fcf0929..857e8158a34 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/GeneratePackageManifestTests.swift @@ -31,6 +31,10 @@ class GeneratePackageManifestTests: CLITestCase { withIntermediateDirectories: true ) } + try! FileManager.default.createDirectory( + atPath: "IntegrationTests/Services", + withIntermediateDirectories: true + ) } // MARK: - Tests @@ -112,6 +116,8 @@ extension GeneratePackageManifest { services: [String]? = nil, includesIntegrationTests: Bool = false, includeProtocolTests: Bool = false, + excludeAWSServices: Bool = false, + excludeRuntimeTests: Bool = false, buildPackageManifest: @escaping BuildPackageManifest = { (_,_,_) throws -> String in "" } ) -> GeneratePackageManifest { GeneratePackageManifest( @@ -122,6 +128,8 @@ extension GeneratePackageManifest { services: services, includeIntegrationTests: includesIntegrationTests, includeProtocolTests: includeProtocolTests, + excludeAWSServices: excludeAWSServices, + excludeRuntimeTests: excludeRuntimeTests, buildPackageManifest: buildPackageManifest ) } diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift index 0194adde89f..f2662b922eb 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Commands/PrepareReleaseTests.swift @@ -104,7 +104,7 @@ class PrepareReleaseTests: CLITestCase { ProcessRunner.testRunner = runner let subject = PrepareRelease.mock(repoType: .awsSdkSwift) try! subject.stageFiles() - XCTAssertTrue(command.hasSuffix("git add Package.swift Package.version packageDependencies.plist Sources/Services Tests/Services")) + XCTAssertTrue(command.hasSuffix("git add Package.swift Package.version packageDependencies.plist Sources/Services Tests/Services Sources/Core/AWSSDKForSwift/Documentation.docc/AWSSDKForSwift.md")) } func testStageFilesForSmithySwift() { diff --git a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift index e87ceca8c73..0e2fbc075c4 100644 --- a/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift +++ b/AWSSDKSwiftCLI/Tests/AWSSDKSwiftCLITests/Models/PackageManifestBuilderTests.swift @@ -9,47 +9,59 @@ import XCTest class PackageManifestBuilderTests: XCTestCase { - + let expected = """ - - - // MARK: - Generated - - addDependencies( - clientRuntimeVersion: "1.2.3", - crtVersion: "4.5.6" - ) - - let serviceTargets: [String] = [ - "A", - "B", - "C", - "D", - "E", - ] - - serviceTargets.forEach(addServiceTarget) - - let servicesWithIntegrationTests: [String] = [ - "A", - "B", - "C", - "D", - "E", - ] - - servicesWithIntegrationTests.forEach(addIntegrationTestTarget) - - // Uncomment this line to enable protocol tests - addProtocolTests() - """ - + + +// MARK: - Generated + +addDependencies( + clientRuntimeVersion: "1.2.3", + crtVersion: "4.5.6" +) + +// Uncomment this line to exclude runtime unit tests +// excludeRuntimeUnitTests() + +let serviceTargets: [String] = [ + "A", + "B", + "C", + "D", + "E", +] + +// Uncomment this line to enable all services +addAllServices() + +let servicesWithIntegrationTests: [String] = [ + "A", + "B", + "C", + "D", + "E", +] + +// Uncomment this line to enable integration tests +// addIntegrationTests() + +// Uncomment this line to enable protocol tests +// addProtocolTests() + +addResolvedTargets() + + +""" + func testBuild() { let subject = PackageManifestBuilder( clientRuntimeVersion: .init("1.2.3"), crtVersion: .init("4.5.6"), services: ["A","B","C","D","E"].map { PackageManifestBuilder.Service(name: $0, includeIntegrationTests: true) }, - includeProtocolTests: true, + includeProtocolTests: false, + includeIntegrationTests: false, + excludeAWSServices: false, + excludeRuntimeTests: false, basePackageContents: { "" } ) let result = try! subject.build() diff --git a/Package.swift b/Package.swift index 8d27ad85009..1eb335cedf6 100644 --- a/Package.swift +++ b/Package.swift @@ -100,7 +100,6 @@ func addDoccDependency() { // MARK: - Services func addServiceTarget(_ name: String) { - let testName = "\(name)Tests" package.products += [ .library(name: name, targets: [name]), ] @@ -109,7 +108,13 @@ func addServiceTarget(_ name: String) { name: name, dependencies: [.clientRuntime, .awsClientRuntime], path: "./Sources/Services/\(name)" - ), + ) + ] +} + +func addServiceUnitTestTarget(_ name: String) { + let testName = "\(name)Tests" + package.targets += [ .testTarget( name: "\(testName)", dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils], @@ -120,7 +125,7 @@ func addServiceTarget(_ name: String) { func addIntegrationTestTarget(_ name: String) { let integrationTestName = "\(name)IntegrationTests" - var additionalDependencies: [PackageDescription.Target.Dependency] = [] + var additionalDependencies: [String] = [] var exclusions: [String] = [] switch name { case "AWSECS": @@ -134,10 +139,12 @@ func addIntegrationTestTarget(_ name: String) { default: break } + integrationTestServices.insert(name) + additionalDependencies.forEach { integrationTestServices.insert($0) } package.targets += [ .testTarget( name: integrationTestName, - dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils] + additionalDependencies, + dependencies: [.crt, .clientRuntime, .awsClientRuntime, .byName(name: name), .smithyTestUtils] + additionalDependencies.map { Target.Dependency.target(name: $0, condition: nil) }, path: "./IntegrationTests/Services/\(integrationTestName)", exclude: exclusions, resources: [.process("Resources")] @@ -145,6 +152,25 @@ func addIntegrationTestTarget(_ name: String) { ] } +var enabledServices = Set() + +var enabledServiceUnitTests = Set() + +func addAllServices() { + enabledServices = Set(serviceTargets) + enabledServiceUnitTests = Set(serviceTargets) +} + +var integrationTestServices = Set() + +func addIntegrationTests() { + servicesWithIntegrationTests.forEach { addIntegrationTestTarget($0) } +} + +func excludeRuntimeUnitTests() { + package.targets.removeAll { $0.name == "AWSClientRuntimeTests" } +} + func addProtocolTests() { struct ProtocolTest { @@ -195,6 +221,11 @@ func addProtocolTests() { } } +func addResolvedTargets() { + enabledServices.union(integrationTestServices).forEach(addServiceTarget) + enabledServiceUnitTests.forEach(addServiceUnitTestTarget) +} + // MARK: - Generated @@ -203,6 +234,9 @@ addDependencies( crtVersion: "0.17.0" ) +// Uncomment this line to exclude runtime unit tests +// excludeRuntimeUnitTests() + let serviceTargets: [String] = [ "AWSACM", "AWSACMPCA", @@ -579,13 +613,23 @@ let serviceTargets: [String] = [ "AWSXRay", ] -serviceTargets.forEach(addServiceTarget) +// Uncomment this line to enable all services +addAllServices() let servicesWithIntegrationTests: [String] = [ + "AWSECS", + "AWSKinesis", + "AWSMediaConvert", + "AWSS3", + "AWSSQS", + "AWSTranscribeStreaming", ] -servicesWithIntegrationTests.forEach(addIntegrationTestTarget) +// Uncomment this line to enable integration tests +// addIntegrationTests() // Uncomment this line to enable protocol tests // addProtocolTests() +addResolvedTargets() + diff --git a/codegen/Package.swift b/codegen/Package.swift deleted file mode 100644 index 78143f37a4a..00000000000 --- a/codegen/Package.swift +++ /dev/null @@ -1,113 +0,0 @@ -// swift-tools-version:5.7 - -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ - -import PackageDescription -import class Foundation.ProcessInfo - -let baseDir = "./protocol-test-codegen/build/smithyprojections/protocol-test-codegen" -let baseDirLocal = "./protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local" - -var package = Package( - name: "ProtocolCodegenTests", - platforms: [ - .macOS(.v10_15), .iOS(.v13) - ], - products: [ - ], - targets: [ - ] -) - -appendLibTarget(name: "AWSRestJsonTestSDK", path: "\(baseDir)/aws-restjson") -appendTstTarget(name: "AWSRestJsonTestSDKTests", path: "\(baseDir)/aws-restjson", dependency: "AWSRestJsonTestSDK") - -appendLibTarget(name: "AWSRestJsonValidationTestSDK", path: "\(baseDir)/aws-restjson-validation") -appendTstTarget(name: "AWSRestJsonValidationTestSDKTests", path: "\(baseDir)/aws-restjson-validation", dependency: "AWSRestJsonValidationTestSDK") - -appendLibTarget(name: "AWSJson1_0TestSDK", path: "\(baseDir)/aws-json-10") -appendTstTarget(name: "AWSJson1_0TestSDKTests", path: "\(baseDir)/aws-json-10", dependency: "AWSJson1_0TestSDK") - -appendLibTarget(name: "AWSJson1_1TestSDK", path: "\(baseDir)/aws-json-11") -appendTstTarget(name: "AWSJson1_1TestSDKTests", path: "\(baseDir)/aws-json-11", dependency: "AWSJson1_1TestSDK") - -appendLibTarget(name: "RestXmlTestSDK", path: "\(baseDir)/rest-xml") -appendTstTarget(name: "RestXmlTestSDKTests", path: "\(baseDir)/rest-xml", dependency: "RestXmlTestSDK") - -appendLibTarget(name: "RestXmlWithNamespaceTestSDK", path: "\(baseDir)/rest-xml-xmlns") -appendTstTarget(name: "RestXmlWithNamespaceTestSDKTests", path: "\(baseDir)/rest-xml-xmlns", dependency: "RestXmlWithNamespaceTestSDK") - -appendLibTarget(name: "Ec2QueryTestSDK", path: "\(baseDir)/ec2-query") -appendTstTarget(name: "Ec2QueryTestSDKTests", path: "\(baseDir)/ec2-query", dependency: "Ec2QueryTestSDK") - -appendLibTarget(name: "AWSQueryTestSDK", path: "\(baseDir)/aws-query") -appendTstTarget(name: "AWSQueryTestSDKTests", path: "\(baseDir)/aws-query", dependency: "AWSQueryTestSDK") - -//Service specific -appendLibTarget(name: "APIGatewayTestSDK", path: "\(baseDir)/apigateway") -appendTstTarget(name: "APIGatewayTestSDKTests", path: "\(baseDir)/apigateway", dependency: "APIGatewayTestSDK") -appendLibTarget(name: "GlacierTestSDK", path: "\(baseDir)/glacier") -appendTstTarget(name: "GlacierTestSDKTests", path: "\(baseDir)/glacier", dependency: "GlacierTestSDK") -appendLibTarget(name: "MachineLearningTestSDK", path: "\(baseDir)/machinelearning") -appendTstTarget(name: "MachineLearningTestSDKTests", path: "\(baseDir)/machinelearning", dependency: "MachineLearningTestSDK") -appendLibTarget(name: "S3TestSDK", path: "\(baseDir)/s3") -appendTstTarget(name: "S3TestSDKTests", path: "\(baseDir)/s3", dependency: "S3TestSDK") - -//Local tests -appendLibTarget(name: "rest_json_extras", path: "\(baseDirLocal)/rest_json_extras") -appendTstTarget(name: "rest_json_extrasTests", path: "\(baseDirLocal)/rest_json_extras", dependency: "rest_json_extras") -appendLibTarget(name: "AwsQueryExtras", path: "\(baseDirLocal)/AwsQueryExtras") -appendTstTarget(name: "AwsQueryExtrasTests", path: "\(baseDirLocal)/AwsQueryExtras", dependency: "AwsQueryExtras") -appendLibTarget(name: "EventStream", path: "\(baseDirLocal)/EventStream") -// EventStream has a Smithy definition, but no tests defined yet. -//appendTstTarget(name: "EventStreamTests", path: "\(baseDirLocal)/EventStream", dependency: "EventStream") -appendLibTarget(name: "Waiters", path: "\(baseDirLocal)/Waiters") -appendTstTarget(name: "WaitersTests", path: "./protocol-test-codegen-local/Tests", dependency: "Waiters") - -func appendLibTarget(name: String, path: String) { - package.targets.append( - .target(name: name, - dependencies: [ - .product( - name: "ClientRuntime", - package: "smithy-swift" - ), - .product(name: "SmithyXML", package: "smithy-swift"), - .product( - name: "AWSClientRuntime", - package: "aws-sdk-swift" - ), - ], - path: "\(path)/swift-codegen/\(name)") - ) - package.products.append( - .library(name: name, targets: [name]) - ) -} - -func appendTstTarget(name: String, path: String, dependency: String) { - var dependencies: [Target.Dependency] = [.product(name: "SmithyTestUtil", package: "smithy-swift")] - dependencies.append(.byNameItem(name: dependency, condition: nil)) - package.targets.append(.testTarget(name: name, - dependencies: dependencies, - path: "\(path)/swift-codegen/\(name)") - ) -} - - - -if let smithySwiftDir = ProcessInfo.processInfo.environment["SMITHY_SWIFT_CI_DIR"], - let sdkDir = ProcessInfo.processInfo.environment["AWS_SDK_SWIFT_CI_DIR"] { - package.dependencies += [ - .package(path: smithySwiftDir), - .package(path: sdkDir), - ] -} else { - package.dependencies += [ - .package(path: "../../smithy-swift"), - .package(path: "../../aws-sdk-swift"), - ] -} diff --git a/scripts/protogen.sh b/scripts/protogen.sh index 5342b281af2..b3d8a651046 100755 --- a/scripts/protogen.sh +++ b/scripts/protogen.sh @@ -43,9 +43,9 @@ rm codegen/protocol-test-codegen-local/build/smithyprojections/protocol-test-cod rm codegen/protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local/EventStream/swift-codegen/Package.swift rm codegen/protocol-test-codegen-local/build/smithyprojections/protocol-test-codegen-local/Waiters/swift-codegen/Package.swift -# Regenerate the Package.swift with protocol tests included +# Regenerate the Package.swift with protocol tests included and services excluded cd AWSSDKSwiftCLI -swift run AWSSDKSwiftCLI generate-package-manifest --include-protocol-tests .. +swift run AWSSDKSwiftCLI generate-package-manifest --include-protocol-tests --exclude-aws-services --exclude-runtime-tests .. cd .. # If on Mac, reopen Xcode to the refreshed tests diff --git a/scripts/setup_for_crt_builder.sh b/scripts/setup_for_crt_builder.sh deleted file mode 100755 index 7746caa8c6b..00000000000 --- a/scripts/setup_for_crt_builder.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -x - -# Generates the Package.swift file, configured to work properly when building -# with the CRT builder script (see https://github.com/awslabs/aws-crt-builder). -# For use only as a pre-build step when using the CRT builder script on CI. - -# Symlink the SMITHY_SWIFT_CI_DIR to be in the same directory as this project's -# home directory. -ln -s $SMITHY_SWIFT_CI_DIR ../smithy-swift - -# Regenerate the Package.swift file. -cd AWSSDKSwiftCLI -swift run AWSSDKSwiftCLI generate-package-manifest ../ -cd .. - -# Dump the Package.swift to logs for troubleshooting. -cat Package.swift