diff --git a/Package.swift b/Package.swift index 7d37aa2b..56876e98 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,9 @@ let cSettings: [CSetting] = [ .define("AWS_APPSTORE_SAFE"), ] +/// Store any defines that will be used by Swift Tests in swiftTestSettings +var swiftTestSettings: [SwiftSetting] = [] + ////////////////////////////////////////////////////////////////////// /// Configure C targets. /// Note: We can not use unsafe flags because SwiftPM makes the target ineligible for use by other packages. @@ -125,11 +128,13 @@ awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") awsCIoPlatformExcludes.append("source/darwin") cSettingsIO.append(.define("AWS_USE_IO_COMPLETION_PORTS")) +swiftTestSettings.append(.define("AWS_USE_IO_COMPLETION_PORTS")) #elseif os(Linux) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/bsd") awsCIoPlatformExcludes.append("source/darwin") cSettingsIO.append(.define("AWS_USE_EPOLL")) +swiftTestSettings.append(.define("AWS_USE_EPOLL")) #else // macOS, iOS, watchOS, tvOS awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") @@ -138,6 +143,10 @@ cSettingsIO.append(.define("__APPLE__")) cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) cSettingsIO.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) cSettingsIO.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) +swiftTestSettings.append(.define("__APPLE__")) +swiftTestSettings.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) #endif ////////////////////////////////////////////////////////////////////// @@ -311,11 +320,7 @@ packageTargets.append(contentsOf: [ resources: [ .process("Resources") ], - swiftSettings: [ - .define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS])), - .define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS])), - .define("AWS_USE_KQUEUE", .when(platforms: [.macOS])) - ] + swiftSettings: swiftTestSettings ), .executableTarget( name: "Elasticurl", diff --git a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift index 0dae4ef3..f2326bf0 100644 --- a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift +++ b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift @@ -54,6 +54,5 @@ class TLSContextTests: XCBaseTestCase { let context = try TLSContext(options:options, mode: .client) _ = TLSConnectionOptions(context: context) } - #endif }