|
| 1 | +// swift-tools-version: 5.9 |
| 2 | +import PackageDescription |
| 3 | + |
| 4 | +let package = Package( |
| 5 | + name: "WebDriverAgent", |
| 6 | + defaultLocalization: "en", |
| 7 | + platforms: [ |
| 8 | + .iOS(.v12) |
| 9 | + ], |
| 10 | + products: [ |
| 11 | + // Expose the Obj-C library as a SwiftPM product so it can be imported from Swift. |
| 12 | + .library(name: "WebDriverAgentLib", targets: ["WebDriverAgentLib"]) |
| 13 | + ], |
| 14 | + targets: [ |
| 15 | + // ---- Vendor: CocoaAsyncSocket ---- |
| 16 | + .target( |
| 17 | + name: "CocoaAsyncSocket", |
| 18 | + path: "WebDriverAgentLib/Vendor/CocoaAsyncSocket", |
| 19 | + publicHeadersPath: "." |
| 20 | + ), |
| 21 | + |
| 22 | + // ---- Vendor: CocoaHTTPServer ---- |
| 23 | + .target( |
| 24 | + name: "CocoaHTTPServer", |
| 25 | + dependencies: ["CocoaAsyncSocket"], |
| 26 | + path: "WebDriverAgentLib/Vendor/CocoaHTTPServer", |
| 27 | + publicHeadersPath: ".", |
| 28 | + cSettings: [ |
| 29 | + .headerSearchPath("Categories"), |
| 30 | + .headerSearchPath("Responses") |
| 31 | + ] |
| 32 | + ), |
| 33 | + |
| 34 | + // ---- Vendor: RoutingHTTPServer ---- |
| 35 | + .target( |
| 36 | + name: "RoutingHTTPServer", |
| 37 | + dependencies: ["CocoaHTTPServer"], |
| 38 | + path: "WebDriverAgentLib/Vendor/RoutingHTTPServer", |
| 39 | + publicHeadersPath: ".", |
| 40 | + cSettings: [ |
| 41 | + // Need CocoaHTTPServer headers in include path for quote-style imports |
| 42 | + .headerSearchPath("../CocoaHTTPServer"), |
| 43 | + .headerSearchPath("../CocoaHTTPServer/Responses"), |
| 44 | + .headerSearchPath("../CocoaHTTPServer/Categories") |
| 45 | + ] |
| 46 | + ), |
| 47 | + |
| 48 | + // ---- Main library ---- |
| 49 | + .target( |
| 50 | + name: "WebDriverAgentLib", |
| 51 | + dependencies: [ |
| 52 | + "RoutingHTTPServer" |
| 53 | + ], |
| 54 | + path: "WebDriverAgentLib", |
| 55 | + exclude: [ |
| 56 | + "Vendor" // compiled in dedicated targets above |
| 57 | + ], |
| 58 | + publicHeadersPath: "include", |
| 59 | + cSettings: [ |
| 60 | + .headerSearchPath(".."), |
| 61 | + .headerSearchPath("include"), |
| 62 | + .headerSearchPath("Routing"), |
| 63 | + .headerSearchPath("Utilities"), |
| 64 | + .headerSearchPath("Utilities/LRUCache"), |
| 65 | + .headerSearchPath("Categories"), |
| 66 | + .headerSearchPath("Commands"), |
| 67 | + .headerSearchPath("include/WebDriverAgentLib"), |
| 68 | + .headerSearchPath("../PrivateHeaders/XCTest"), |
| 69 | + .headerSearchPath("../PrivateHeaders/MobileCoreServices"), |
| 70 | + .headerSearchPath("../PrivateHeaders/AccessibilityUtilities"), |
| 71 | + .headerSearchPath("../PrivateHeaders/TextInput"), |
| 72 | + .headerSearchPath("../PrivateHeaders/UIKitCore"), |
| 73 | + ], |
| 74 | + linkerSettings: [ |
| 75 | + // Link against XCTest and system UIKit/Foundation frameworks that |
| 76 | + // are referenced across the Objective-C implementation files. |
| 77 | + .linkedFramework("XCTest"), |
| 78 | + .linkedFramework("UIKit"), |
| 79 | + .linkedFramework("Foundation"), |
| 80 | + .linkedFramework("MobileCoreServices"), |
| 81 | + .linkedFramework("UniformTypeIdentifiers") |
| 82 | + ] |
| 83 | + ), |
| 84 | + // Unit-test target (optional – keeps parity with the original project). |
| 85 | + .testTarget( |
| 86 | + name: "WebDriverAgentLibTests", |
| 87 | + dependencies: ["WebDriverAgentLib"], |
| 88 | + path: "WebDriverAgentTests" |
| 89 | + ) |
| 90 | + ] |
| 91 | +) |
0 commit comments