Skip to content

Commit

Permalink
add defines to tests in swift
Browse files Browse the repository at this point in the history
  • Loading branch information
sbSteveK committed Oct 7, 2024
1 parent 610e716 commit 06451a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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")
Expand All @@ -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

//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ class TLSContextTests: XCBaseTestCase {
let context = try TLSContext(options:options, mode: .client)
_ = TLSConnectionOptions(context: context)
}

#endif
}

0 comments on commit 06451a0

Please sign in to comment.