-
Notifications
You must be signed in to change notification settings - Fork 1
/
Package.swift
92 lines (84 loc) · 2.92 KB
/
Package.swift
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.
import class Foundation.ProcessInfo
import PackageDescription
let externalDependencies: [String: Range<Version>] = [
"https://github.com/apple/swift-docc-plugin": .upToNextMajor(from: "1.0.0"),
"https://github.com/apple/swift-atomics": .upToNextMajor(from: "1.0.0"),
"https://github.com/mattgallagher/CwlPreconditionTesting": .upToNextMajor(from: "2.0.0")
]
let internalDependencies: [String: Range<Version>] = [
"package-latency-tools": .upToNextMajor(from: "1.0.0")
]
#if swift(>=6.0)
@MainActor
#endif
func makeDependencies() -> [Package.Dependency] {
var dependencies: [Package.Dependency] = []
dependencies.reserveCapacity(externalDependencies.count + internalDependencies.count)
for extDep in externalDependencies {
dependencies.append(.package(url: extDep.key, extDep.value))
}
// Setting LOCAL_PACKAGES_DIR environment variable allows to use local version of repositories owned by Ordo One.
let localPath = ProcessInfo.processInfo.environment["LOCAL_PACKAGES_DIR"]
for intDep in internalDependencies {
if let localPath {
dependencies.append(.package(name: "\(intDep.key)", path: "\(localPath)/\(intDep.key)"))
} else {
dependencies.append(.package(url: "https://github.com/ordo-one/\(intDep.key)", intDep.value))
}
}
return dependencies
}
let package = Package(
name: "package-concurrency-helpers",
platforms: [
.macOS(.v13),
.iOS(.v16),
],
products: [
.library(
name: "PackageConcurrencyHelpers",
targets: ["PackageConcurrencyHelpers"]
),
.library(
name: "Helpers",
targets: ["Helpers"]
)
],
dependencies: makeDependencies(),
targets: [
.target(
name: "_PauseShims"
),
.target(
name: "PackageConcurrencyHelpers",
dependencies: [
"_PauseShims",
.product(name: "Atomics", package: "swift-atomics"),
],
path: "Sources/ConcurrencyHelpers",
swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
),
.target(
name: "Helpers",
dependencies: [
.product(name: "LatencyTimer", package: "package-latency-tools"),
]
),
.testTarget(
name: "ConcurrencyHelpersTests",
dependencies: [
.product(
name: "CwlPreconditionTesting",
package: "CwlPreconditionTesting",
condition: .when(platforms: [.macOS])),
"PackageConcurrencyHelpers",
]
),
.testTarget(
name: "HelpersTests",
dependencies: ["Helpers", "PackageConcurrencyHelpers"]
),
]
)