diff --git a/Package.swift b/Package.swift index c03fdfa..a32ec4d 100644 --- a/Package.swift +++ b/Package.swift @@ -5,28 +5,37 @@ import PackageDescription let package = Package( name: "swift-webdriver", products: [ - .library(name: "WebDriver", targets: ["WebDriver", "WinAppDriver"]), + .library(name: "WebDriver", targets: ["WebDriver"]), ], targets: [ .target( name: "WebDriver", path: "Sources/WebDriver"), - .target( - name: "WinAppDriver", - dependencies: ["WebDriver"], - path: "Sources/WinAppDriver"), .target( name: "TestsCommon", path: "Tests/Common"), - .testTarget( - name: "WinAppDriverTests", - dependencies: ["TestsCommon", "WebDriver", "WinAppDriver"], - // Ignore "LNK4217: locally defined symbol imported" spew due to SPM library support limitations - linkerSettings: [ .unsafeFlags(["-Xlinker", "-ignore:4217"]) ]), .testTarget( name: "UnitTests", - dependencies: ["TestsCommon", "WebDriver", "WinAppDriver"], + dependencies: ["TestsCommon", "WebDriver"], // Ignore "LNK4217: locally defined symbol imported" spew due to SPM library support limitations - linkerSettings: [ .unsafeFlags(["-Xlinker", "-ignore:4217"]) ]), + linkerSettings: [ .unsafeFlags(["-Xlinker", "-ignore:4217"], .when(platforms: [.windows])) ]), ] ) + +#if os(Windows) +package.products += [ + .library(name: "WinAppDriver", targets: ["WinAppDriver"]) +] +package.targets += [ + .target( + name: "WinAppDriver", + dependencies: ["WebDriver"], + path: "Sources/WinAppDriver"), + .testTarget( + name: "WinAppDriverTests", + dependencies: ["TestsCommon", "WebDriver", "WinAppDriver"], + // Ignore "LNK4217: locally defined symbol imported" spew due to SPM library support limitations + linkerSettings: [ .unsafeFlags(["-Xlinker", "-ignore:4217"]) ]), +] +#endif + diff --git a/Sources/WebDriver/HTTPWebDriver.swift b/Sources/WebDriver/HTTPWebDriver.swift index 064266e..acd6a81 100644 --- a/Sources/WebDriver/HTTPWebDriver.swift +++ b/Sources/WebDriver/HTTPWebDriver.swift @@ -1,5 +1,7 @@ import Foundation +#if canImport(FoundationNetworking) import FoundationNetworking +#endif public struct HTTPWebDriver: WebDriver { let rootURL: URL diff --git a/Sources/WebDriver/URLRequestExtensions.swift b/Sources/WebDriver/URLRequestExtensions.swift index 1739de5..e9edf88 100644 --- a/Sources/WebDriver/URLRequestExtensions.swift +++ b/Sources/WebDriver/URLRequestExtensions.swift @@ -1,5 +1,7 @@ import Foundation +#if canImport(FoundationNetworking) import FoundationNetworking +#endif extension URLSession { func dataTask( diff --git a/Tests/UnitTests/CommandLineTests.swift b/Tests/WinAppDriverTests/CommandLineTests.swift similarity index 100% rename from Tests/UnitTests/CommandLineTests.swift rename to Tests/WinAppDriverTests/CommandLineTests.swift