|
| 1 | +// swift-tools-version: 5.6 |
| 2 | + |
| 3 | +import PackageDescription |
| 4 | + |
| 5 | +let package = Package( |
| 6 | + name: "swift-async-algorithms", |
| 7 | + platforms: [ |
| 8 | + .macOS("10.15"), |
| 9 | + .iOS("13.0"), |
| 10 | + .tvOS("13.0"), |
| 11 | + .watchOS("6.0") |
| 12 | + ], |
| 13 | + products: [ |
| 14 | + .library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]), |
| 15 | + .library(name: "AsyncSequenceValidation", targets: ["AsyncSequenceValidation"]), |
| 16 | + .library(name: "_CAsyncSequenceValidationSupport", type: .static, targets: ["AsyncSequenceValidation"]), |
| 17 | + .library(name: "AsyncAlgorithms_XCTest", targets: ["AsyncAlgorithms_XCTest"]), |
| 18 | + ], |
| 19 | + dependencies: [.package(url: "https://github.com/apple/swift-collections.git", .upToNextMajor(from: "1.0.4"))], |
| 20 | + targets: [ |
| 21 | + .target( |
| 22 | + name: "AsyncAlgorithms", |
| 23 | + dependencies: [.product(name: "Collections", package: "swift-collections")] |
| 24 | + ), |
| 25 | + .target( |
| 26 | + name: "AsyncSequenceValidation", |
| 27 | + dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"]), |
| 28 | + .systemLibrary(name: "_CAsyncSequenceValidationSupport"), |
| 29 | + .target( |
| 30 | + name: "AsyncAlgorithms_XCTest", |
| 31 | + dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"]), |
| 32 | + .testTarget( |
| 33 | + name: "AsyncAlgorithmsTests", |
| 34 | + dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation", "AsyncAlgorithms_XCTest"]), |
| 35 | + ] |
| 36 | +) |
| 37 | + |
| 38 | +#if canImport(Darwin) |
| 39 | +import Darwin |
| 40 | +let buildingDocs = getenv("BUILDING_FOR_DOCUMENTATION_GENERATION") != nil |
| 41 | +#elseif canImport(Glibc) |
| 42 | +import Glibc |
| 43 | +let buildingDocs = getenv("BUILDING_FOR_DOCUMENTATION_GENERATION") != nil |
| 44 | +#else |
| 45 | +let buildingDocs = false |
| 46 | +#endif |
| 47 | + |
| 48 | +// Only require the docc plugin when building documentation |
| 49 | +package.dependencies += buildingDocs ? [ |
| 50 | + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), |
| 51 | +] : [] |
0 commit comments