-
Notifications
You must be signed in to change notification settings - Fork 26
/
Package.swift
167 lines (141 loc) · 5.18 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
import class Foundation.ProcessInfo
// Workaround: Since we cannot include the flat just as command line options since then it applies to all targets,
// and ONE of our dependencies currently produces one warning, we have to use this workaround to enable it in _our_
// targets when the flag is set. We should remove the dependencies and then enable the flag globally though just by passing it.
let globalSwiftSettings: [SwiftSetting]
if ProcessInfo.processInfo.environment["WARNINGS_AS_ERRORS"] != nil {
print("WARNINGS_AS_ERRORS enabled, passing `-warnings-as-errors`")
globalSwiftSettings = [
SwiftSetting.unsafeFlags(["-warnings-as-errors"])
]
} else {
globalSwiftSettings = []
}
var targets: [PackageDescription.Target] = [
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: SWIM
.target(
name: "ClusterMembership",
dependencies: []
),
.target(
name: "SWIM",
dependencies: [
"ClusterMembership",
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics"),
]
),
.target(
name: "SWIMNIOExample",
dependencies: [
"SWIM",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOFoundationCompat", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
.product(name: "NIOExtras", package: "swift-nio-extras"),
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics"),
]
),
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: Other Membership Protocols ...
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: Documentation
.testTarget(
name: "ClusterMembershipDocumentationTests",
dependencies: [
"SWIM"
]
),
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: Tests
.testTarget(
name: "ClusterMembershipTests",
dependencies: [
"ClusterMembership"
]
),
.testTarget(
name: "SWIMTests",
dependencies: [
"SWIM",
"SWIMTestKit",
]
),
.testTarget(
name: "SWIMNIOExampleTests",
dependencies: [
"SWIMNIOExample",
"SWIMTestKit",
]
),
// NOT FOR PUBLIC CONSUMPTION.
.testTarget(
name: "SWIMTestKit",
dependencies: [
"SWIM",
.product(name: "NIO", package: "swift-nio"),
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics"),
]
),
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: Samples are defined in Samples/Package.swift
// ==== ------------------------------------------------------------------------------------------------------------
]
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.19.0"),
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.8.0"),
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.5.1"),
// ~~~ SSWG APIs ~~~
.package(url: "https://github.com/apple/swift-log.git", from: "1.4.0"),
.package(url: "https://github.com/apple/swift-metrics.git", "2.3.2"..<"3.0.0"), // since latest
]
let products: [PackageDescription.Product] = [
.library(
name: "ClusterMembership",
targets: ["ClusterMembership"]
),
.library(
name: "SWIM",
targets: ["SWIM"]
),
.library(
name: "SWIMNIOExample",
targets: ["SWIMNIOExample"]
),
]
var package = Package(
name: "swift-cluster-membership",
platforms: [
.macOS(.v13),
.iOS(.v16),
.tvOS(.v16),
.watchOS(.v9),
],
products: products,
dependencies: dependencies,
targets: targets.map { target in
var swiftSettings = target.swiftSettings ?? []
swiftSettings.append(contentsOf: globalSwiftSettings)
if !swiftSettings.isEmpty {
target.swiftSettings = swiftSettings
}
return target
},
cxxLanguageStandard: .cxx11
)
// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
for target in package.targets {
if target.type != .plugin {
var settings = target.swiftSettings ?? []
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
settings.append(.enableUpcomingFeature("MemberImportVisibility"))
target.swiftSettings = settings
}
}
// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //