-
Notifications
You must be signed in to change notification settings - Fork 43
70 lines (63 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// swift-tools-version:5.2
import PackageDescription
import Foundation
var testCombine = ProcessInfo.processInfo.environment["CX_TEST_COMBINE"] != nil
// uncommenet the following line to test against combine
// testCombine = true
let combineImpFlag: [SwiftSetting] = testCombine ? [.define("USE_COMBINE")] : [.define("USE_COMBINEX")]
let shimDep: [Target.Dependency] = testCombine ? ["_CXCompatible"] : ["CombineX", "CXFoundation"]
let package = Package(
name: "CombineX",
products: [
.library(name: "CombineX", targets: ["CombineX", "CXFoundation"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-atomics.git", .upToNextMinor(from: "0.0.3")),
.package(url: "https://github.com/Quick/Quick.git", from: "3.0.0"),
.package(url: "https://github.com/Quick/Nimble.git", from: "9.0.0"),
.package(url: "https://github.com/ddddxxx/Semver.git", .upToNextMinor(from: "0.2.1")),
],
targets: [
.target(name: "CXUtility"),
.target(
name: "CombineX",
dependencies: [
"CXUtility",
.product(name: "Atomics", package: "swift-atomics")],
swiftSettings: [.define("CX_LOCK_FREE_ATOMIC")]),
.target(
name: "CXFoundation",
dependencies: ["CXUtility", "CombineX"]),
// We have circular dependency CombineXTests -> CXTest -> CXShim -> CombineX
//
// Use git submodule instead of SPM dependency. also add underscore
// prefix to prevent name collision
.target(
name: "_CXCompatible"),
.target(
name: "_CXShim",
dependencies: shimDep,
swiftSettings: [.define("CX_PRIVATE_SHIM")] + combineImpFlag),
.target(
name: "_CXTest",
dependencies: ["_CXShim"],
swiftSettings: [.define("CX_PRIVATE_SHIM")]),
.target(
name: "CXTestUtility",
dependencies: ["CXUtility", "_CXShim", "_CXTest", "Semver", "Quick", "Nimble"],
swiftSettings: combineImpFlag),
.testTarget(
name: "CombineXTests",
dependencies: ["CXTestUtility", "CXUtility", "Quick", "Nimble"],
swiftSettings: combineImpFlag),
.testTarget(
name: "CXFoundationTests",
dependencies: ["CXTestUtility", "Quick", "Nimble"]),
.testTarget(
name: "CXInconsistentTests",
dependencies: ["CXTestUtility", "CXUtility", "Quick", "Nimble"]),
]
)
if testCombine {
package.platforms = [.macOS("10.15"), .iOS("13.0"), .tvOS("13.0"), .watchOS("6.0")]
}