forked from apple/swift-cluster-membership
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
154 lines (129 loc) · 4.95 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
// swift-tools-version:5.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import class Foundation.ProcessInfo
import PackageDescription
// 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: "SWIMTests",
dependencies: [
"SWIM",
"SWIMTestKit",
]
),
.testTarget(
name: "SWIMNIOExampleTests",
dependencies: [
"SWIMNIOExample",
"SWIMTestKit",
]
),
// NOT FOR PUBLIC CONSUMPTION.
.testTarget(
name: "SWIMTestKit",
dependencies: [
.product(name: "NIO", package: "swift-nio"),
.product(name: "Logging", package: "swift-log"),
.product(name: "Metrics", package: "swift-metrics"),
]
),
// ==== ------------------------------------------------------------------------------------------------------------
// MARK: Integration Tests - `it_` prefixed
.target(
name: "it_Clustered_swim_suspension_reachability",
dependencies: [
"SWIM",
],
path: "IntegrationTests/tests_01_cluster/it_Clustered_swim_suspension_reachability"
),
// ==== ------------------------------------------------------------------------------------------------------------
// 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"),
// swift-metrics 1.x and 2.x are almost API compatible, so most clients should use
.package(url: "https://github.com/apple/swift-metrics.git", "1.0.0" ..< "3.0.0"),
]
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",
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
)