|
| 1 | +// swift-tools-version: 6.2 |
| 2 | + |
| 3 | +import PackageDescription |
| 4 | +import CompilerPluginSupport |
| 5 | + |
| 6 | +let AsyncAlgorithms_v1_0 = "AvailabilityMacro=AsyncAlgorithms 1.0:macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0" |
| 7 | +let AsyncAlgorithms_v1_1 = "AvailabilityMacro=AsyncAlgorithms 1.1:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0" |
| 8 | + |
| 9 | +let availabilityMacros: [SwiftSetting] = [ |
| 10 | + .enableExperimentalFeature( |
| 11 | + AsyncAlgorithms_v1_0 |
| 12 | + ), |
| 13 | + .enableExperimentalFeature( |
| 14 | + AsyncAlgorithms_v1_1 |
| 15 | + ), |
| 16 | +] |
| 17 | + |
| 18 | +let package = Package( |
| 19 | + name: "swift-async-algorithms", |
| 20 | + products: [ |
| 21 | + .library(name: "AsyncAlgorithms", targets: ["AsyncAlgorithms"]) |
| 22 | + ], |
| 23 | + targets: [ |
| 24 | + .target( |
| 25 | + name: "AsyncAlgorithms", |
| 26 | + dependencies: [ |
| 27 | + .product(name: "OrderedCollections", package: "swift-collections"), |
| 28 | + .product(name: "DequeModule", package: "swift-collections"), |
| 29 | + ], |
| 30 | + swiftSettings: availabilityMacros + [ |
| 31 | + .enableExperimentalFeature("StrictConcurrency=complete") |
| 32 | + ] |
| 33 | + ), |
| 34 | + .target( |
| 35 | + name: "AsyncSequenceValidation", |
| 36 | + dependencies: ["_CAsyncSequenceValidationSupport", "AsyncAlgorithms"], |
| 37 | + swiftSettings: availabilityMacros + [ |
| 38 | + .enableExperimentalFeature("StrictConcurrency=complete") |
| 39 | + ] |
| 40 | + ), |
| 41 | + .systemLibrary(name: "_CAsyncSequenceValidationSupport"), |
| 42 | + .target( |
| 43 | + name: "AsyncAlgorithms_XCTest", |
| 44 | + dependencies: ["AsyncAlgorithms", "AsyncSequenceValidation"], |
| 45 | + swiftSettings: availabilityMacros + [ |
| 46 | + .enableExperimentalFeature("StrictConcurrency=complete") |
| 47 | + ] |
| 48 | + ), |
| 49 | + .testTarget( |
| 50 | + name: "AsyncAlgorithmsTests", |
| 51 | + dependencies: [ |
| 52 | + .target(name: "AsyncAlgorithms"), |
| 53 | + .target( |
| 54 | + name: "AsyncSequenceValidation", |
| 55 | + condition: .when(platforms: [ |
| 56 | + .macOS, |
| 57 | + .iOS, |
| 58 | + .tvOS, |
| 59 | + .watchOS, |
| 60 | + .visionOS, |
| 61 | + .macCatalyst, |
| 62 | + .android, |
| 63 | + .linux, |
| 64 | + .openbsd, |
| 65 | + .wasi, |
| 66 | + ]) |
| 67 | + ), |
| 68 | + .target( |
| 69 | + name: "AsyncAlgorithms_XCTest", |
| 70 | + condition: .when(platforms: [ |
| 71 | + .macOS, |
| 72 | + .iOS, |
| 73 | + .tvOS, |
| 74 | + .watchOS, |
| 75 | + .visionOS, |
| 76 | + .macCatalyst, |
| 77 | + .android, |
| 78 | + .linux, |
| 79 | + .openbsd, |
| 80 | + .wasi, |
| 81 | + ]) |
| 82 | + ), |
| 83 | + ], |
| 84 | + swiftSettings: availabilityMacros + [ |
| 85 | + .enableExperimentalFeature("StrictConcurrency=complete") |
| 86 | + ] |
| 87 | + ), |
| 88 | + ] |
| 89 | +) |
| 90 | + |
| 91 | +if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { |
| 92 | + package.dependencies += [ |
| 93 | + .package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0") |
| 94 | + ] |
| 95 | +} else { |
| 96 | + package.dependencies += [ |
| 97 | + .package(path: "../swift-collections") |
| 98 | + ] |
| 99 | +} |
0 commit comments