Skip to content

Commit bdbc34a

Browse files
authored
fix release builds on 0.x (#809)
* fix release builds on 0.x * fix jazzy on old ubuntus * remove warnings from latest NIO usage * update swift prometheus in samples
1 parent 0719927 commit bdbc34a

File tree

6 files changed

+74
-49
lines changed

6 files changed

+74
-49
lines changed

Package.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import PackageDescription
1111
var globalSwiftSettings: [SwiftSetting]
1212

1313
var globalConcurrencyFlags: [String] = []
14-
//#if swift(>=5.4)
15-
//globalConcurrencyFlags.append(contentsOf: [
14+
// #if swift(>=5.4)
15+
// globalConcurrencyFlags.append(contentsOf: [
1616
// "-Xfrontend", "-enable-experimental-concurrency",
1717
// // "-Xfrontend", "-enable-experimental-distributed",
18-
//])
19-
//#endif
18+
// ])
19+
// #endif
2020

2121
if ProcessInfo.processInfo.environment["SACT_WARNINGS_AS_ERRORS"] != nil {
2222
print("SACT_WARNINGS_AS_ERRORS enabled, passing `-warnings-as-errors`")
@@ -28,9 +28,7 @@ if ProcessInfo.processInfo.environment["SACT_WARNINGS_AS_ERRORS"] != nil {
2828
SwiftSetting.unsafeFlags(allUnsafeFlags),
2929
]
3030
} else {
31-
globalSwiftSettings = [
32-
SwiftSetting.unsafeFlags(globalConcurrencyFlags),
33-
]
31+
globalSwiftSettings = []
3432
}
3533

3634
var targets: [PackageDescription.Target] = [

Samples/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var dependencies: [Package.Dependency] = [
113113
// ~~~~~~~ only for samples ~~~~~~~
114114

115115
// for metrics examples:
116-
.package(url: "https://github.com/MrLotU/SwiftPrometheus", from: "1.0.0-alpha.5"), // Apache v2 license
116+
.package(url: "https://github.com/MrLotU/SwiftPrometheus", from: "1.0.0-alpha.11"), // Apache v2 license
117117

118118
// for mocking logging via files in XPC examples
119119
.package(url: "https://github.com/JohnSundell/Files", from: "4.0.0"), // MIT license

Samples/Sources/SampleMetrics/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import Prometheus
2222
// MARK: Option A) Prometheus backend
2323

2424
let prom = PrometheusClient()
25-
MetricsSystem.bootstrap(prom)
25+
MetricsSystem.bootstrap(PrometheusMetricsFactory(client: prom))
2626

2727
// ==== ----------------------------------------------------------------------------------------------------------------
2828
// MARK: StatsD backend

Tests/DistributedActorsDocumentationTests/ClusteringDocExamples.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ class ClusteringDocExamples: XCTestCase {
2222
// tag::config_tls[]
2323
let system = ActorSystem("TestSystem") { settings in
2424
// ...
25-
settings.cluster.tls = TLSConfiguration.forServer( // <1>
25+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration( // <1>
2626
certificateChain: try! NIOSSLCertificate.fromPEMFile("/path/to/certificate.pem").map { NIOSSLCertificateSource.certificate($0) }, // <2>
27-
privateKey: .file("/path/to/private-key.pem"), // <3>
28-
certificateVerification: .fullVerification, // <4>
29-
trustRoots: .file("/path/to/certificateChain.pem")
27+
privateKey: .file("/path/to/private-key.pem") // , // <3>
28+
// certificateVerification: .fullVerification, // <4>
29+
// trustRoots: .file("/path/to/certificateChain.pem")
3030
) // <5>
31+
settings.cluster.tls?.certificateVerification = .fullVerification
32+
settings.cluster.tls?.trustRoots = .file("/path/to/certificateChain.pem")
3133
}
3234
// end::config_tls[]
3335

Tests/DistributedActorsTests/Cluster/RemotingTLSClusteredTests.swift

Lines changed: 56 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,28 @@ class RemotingTLSTests: ClusteredActorSystemsXCTestCase {
191191

192192
let local = self.setUpNode("local") { settings in
193193
settings.cluster.node.host = "localhost"
194-
settings.cluster.tls = TLSConfiguration.forServer(
194+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
195195
certificateChain: [testCertificateSource1],
196-
privateKey: testKeySource1,
197-
certificateVerification: .fullVerification,
198-
trustRoots: .certificates([testCertificate2])
196+
privateKey: testKeySource1
197+
// ,
198+
// certificateVerification: .fullVerification,
199+
// trustRoots: .certificates([testCertificate2])
199200
)
201+
settings.cluster.tls?.certificateVerification = .fullVerification
202+
settings.cluster.tls?.trustRoots = .certificates([testCertificate2])
200203
}
201204

202205
let remote = setUpNode("remote") { settings in
203206
settings.cluster.node.host = "localhost"
204-
settings.cluster.tls = TLSConfiguration.forServer(
207+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
205208
certificateChain: [testCertificateSource2],
206-
privateKey: testKeySource2,
207-
certificateVerification: .fullVerification,
208-
trustRoots: .certificates([testCertificate1])
209+
privateKey: testKeySource2
210+
// ,
211+
// certificateVerification: .fullVerification,
212+
// trustRoots: .certificates([testCertificate1])
209213
)
214+
settings.cluster.tls?.certificateVerification = .fullVerification
215+
settings.cluster.tls?.trustRoots = .certificates([testCertificate1])
210216
}
211217

212218
local.cluster.join(node: remote.cluster.uniqueNode.node)
@@ -221,22 +227,28 @@ class RemotingTLSTests: ClusteredActorSystemsXCTestCase {
221227

222228
let local = self.setUpNode("local") { settings in
223229
settings.cluster.node.host = "127.0.0.1"
224-
settings.cluster.tls = TLSConfiguration.forServer(
230+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
225231
certificateChain: [testCertificateSource],
226-
privateKey: testKey,
227-
certificateVerification: .fullVerification,
228-
trustRoots: .certificates([testCertificate])
232+
privateKey: testKey
233+
// ,
234+
// certificateVerification: .fullVerification,
235+
// trustRoots: .certificates([testCertificate])
229236
)
237+
settings.cluster.tls?.certificateVerification = .fullVerification
238+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
230239
}
231240

232241
let remote = setUpNode("remote") { settings in
233242
settings.cluster.node.host = "127.0.0.1"
234-
settings.cluster.tls = TLSConfiguration.forServer(
243+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
235244
certificateChain: [testCertificateSource],
236-
privateKey: testKey,
237-
certificateVerification: .fullVerification,
238-
trustRoots: .certificates([testCertificate])
245+
privateKey: testKey
246+
// ,
247+
// certificateVerification: .fullVerification,
248+
// trustRoots: .certificates([testCertificate])
239249
)
250+
settings.cluster.tls?.certificateVerification = .fullVerification
251+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
240252
}
241253

242254
let testKit = ActorTestKit(local)
@@ -268,22 +280,28 @@ class RemotingTLSTests: ClusteredActorSystemsXCTestCase {
268280
let testKey: NIOSSLPrivateKeySource = .privateKey(try NIOSSLPrivateKey(bytes: [UInt8](testKey1.utf8), format: .pem))
269281
let local = self.setUpNode("local") { settings in
270282
settings.cluster.node.host = "localhost"
271-
settings.cluster.tls = TLSConfiguration.forServer(
283+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
272284
certificateChain: [testCertificateSource],
273-
privateKey: testKey,
274-
certificateVerification: .noHostnameVerification,
275-
trustRoots: .certificates([testCertificate])
285+
privateKey: testKey
286+
// ,
287+
// certificateVerification: .fullVerification,
288+
// trustRoots: .certificates([testCertificate])
276289
)
290+
settings.cluster.tls?.certificateVerification = .noHostnameVerification
291+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
277292
}
278293

279294
let remote = setUpNode("remote") { settings in
280295
settings.cluster.node.host = "localhost"
281-
settings.cluster.tls = TLSConfiguration.forServer(
296+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
282297
certificateChain: [testCertificateSource],
283-
privateKey: testKey,
284-
certificateVerification: .noHostnameVerification,
285-
trustRoots: .certificates([testCertificate])
298+
privateKey: testKey
299+
// ,
300+
// certificateVerification: .fullVerification,
301+
// trustRoots: .certificates([testCertificate])
286302
)
303+
settings.cluster.tls?.certificateVerification = .noHostnameVerification
304+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
287305
}
288306

289307
local.cluster.join(node: remote.cluster.uniqueNode.node)
@@ -303,24 +321,30 @@ class RemotingTLSTests: ClusteredActorSystemsXCTestCase {
303321
let testCertificateSource: NIOSSLCertificateSource = .certificate(testCertificate)
304322
let testKey: NIOSSLPrivateKeySource = .file(tmpKeyFile.path)
305323
let local = self.setUpNode("local") { settings in
306-
settings.cluster.tls = TLSConfiguration.forServer(
324+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
307325
certificateChain: [testCertificateSource],
308-
privateKey: testKey,
309-
certificateVerification: .noHostnameVerification,
310-
trustRoots: .certificates([testCertificate])
326+
privateKey: testKey
327+
// ,
328+
// certificateVerification: .fullVerification,
329+
// trustRoots: .certificates([testCertificate])
311330
)
331+
settings.cluster.tls?.certificateVerification = .noHostnameVerification
332+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
312333
settings.cluster.tlsPassphraseCallback = { setter in
313334
setter([UInt8]("test".utf8))
314335
}
315336
}
316337

317338
let remote = setUpNode("remote") { settings in
318-
settings.cluster.tls = TLSConfiguration.forServer(
339+
settings.cluster.tls = TLSConfiguration.makeServerConfiguration(
319340
certificateChain: [testCertificateSource],
320-
privateKey: testKey,
321-
certificateVerification: .noHostnameVerification,
322-
trustRoots: .certificates([testCertificate])
341+
privateKey: testKey
342+
// ,
343+
// certificateVerification: .fullVerification,
344+
// trustRoots: .certificates([testCertificate])
323345
)
346+
settings.cluster.tls?.certificateVerification = .noHostnameVerification
347+
settings.cluster.tls?.trustRoots = .certificates([testCertificate])
324348
settings.cluster.tlsPassphraseCallback = { setter in
325349
setter([UInt8]("test".utf8))
326350
}

docker/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev build-esse
2121
# switch of gem docs building
2222
RUN echo "gem: --no-document" > ~/.gemrc
2323
# jazzy no longer works on xenial as ruby is too old.
24-
RUN if [ "${ubuntu_version}" != "xenial" ] ; then gem install jazzy; fi
25-
RUN gem install asciidoctor -v 1.5.8
26-
RUN gem install asciidoctor-pdf --pre
27-
RUN gem install asciidoctor-diagram -v 1.5.8
24+
RUN if [ "${ubuntu_version}" = "focal" ] ; then echo "gem: --no-document" > ~/.gemrc; fi
25+
RUN if [ "${ubuntu_version}" = "focal" ] ; then gem install jazzy; fi
26+
RUN if [ "${ubuntu_version}" = "focal" ] ; then gem install asciidoctor -v 1.5.8; fi
27+
RUN if [ "${ubuntu_version}" = "focal" ] ; then gem install asciidoctor-pdf --pre; fi
28+
RUN if [ "${ubuntu_version}" = "focal" ] ; then gem install asciidoctor-diagram -v 1.5.8; fi
2829

2930
# tools
3031
RUN mkdir -p $HOME/.tools

0 commit comments

Comments
 (0)