Skip to content

Commit 2fe3d92

Browse files
authored
Drop support for Swift 5.8 (#2924)
# Motivation We only support the last three Swift released versions which are at this time 5.9, 5.10 and 6. # Modification This PR drops anything related to Swift 5.8. # Result Version support aligned.
1 parent 06c16b1 commit 2fe3d92

17 files changed

+8
-59
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
1414
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15-
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
15+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
1616
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
1717
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
1818

Benchmarks/Thresholds/5.8/NIOCoreBenchmarks.NIOAsyncChannel.init.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

Benchmarks/Thresholds/5.8/NIOPosixBenchmarks.TCPEcho.p90.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The default policy for taking contributions is “Squash and Merge” - because
6767

6868
### Make sure your patch works for all supported versions of swift
6969

70-
The CI will do this for you, but a project maintainer must kick it off for you. Currently all versions of Swift >= 5.8 are supported.
70+
The CI will do this for you, but a project maintainer must kick it off for you. Currently all versions of Swift >= 5.9 are supported.
7171

7272
If you wish to test this locally you have two options [act](https://github.com/nektos/act) and Docker Compose files.
7373

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.8
1+
// swift-tools-version:5.9
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the SwiftNIO open source project

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ This is the current version of SwiftNIO and will be supported for the foreseeabl
7474
### Swift Versions
7575

7676
We commit to support the most recently released swift version (currently 5.10) and the last two minor releases before that unless this is impossible to do in one codebase.
77-
In addition checks are run against the latest beta release (if any) as well as the nightly swift builds and the intent is that these should pass.
77+
In addition checks are run against the latest beta release (if any) as well as the nightly swift builds and the intent is that these should pass.
7878

79-
The most recent versions of SwiftNIO support Swift 5.8 and newer. The minimum Swift version supported by SwiftNIO releases are detailed below:
79+
The most recent versions of SwiftNIO support Swift 5.9 and newer. The minimum Swift version supported by SwiftNIO releases are detailed below:
8080

8181
SwiftNIO | Minimum Swift Version
8282
--------------------|----------------------
@@ -86,7 +86,8 @@ SwiftNIO | Minimum Swift Version
8686
`2.43.0 ..< 2.51.0` | 5.5.2
8787
`2.51.0 ..< 2.60.0` | 5.6
8888
`2.60.0 ..< 2.65.0` | 5.7
89-
`2.65.0 ...` | 5.8
89+
`2.65.0 ..< 2.76.0 | 5.8
90+
`2.76.0 ...` | 5.9
9091

9192
### SwiftNIO 1
9293
SwiftNIO 1 is considered end of life - it is strongly recommended that you move to a newer version. The Core NIO team does not actively work on this version. No new features will be added to this version but PRs which fix bugs or security vulnerabilities will be accepted until the end of May 2022.

Sources/NIOCore/EventLoop+SerialExecutor.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if compiler(>=5.9)
1615
/// A helper protocol that can be mixed in to a NIO ``EventLoop`` to provide an
1716
/// automatic conformance to `SerialExecutor`.
1817
///
@@ -91,4 +90,3 @@ extension NIODefaultSerialEventLoopExecutor: SerialExecutor {
9190
self.loop === other.loop
9291
}
9392
}
94-
#endif

Sources/NIOCore/EventLoop.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ public protocol EventLoop: EventLoopGroup {
317317
/// allows `EventLoop`s to cache a pre-succeeded `Void` future to prevent superfluous allocations.
318318
func makeSucceededVoidFuture() -> EventLoopFuture<Void>
319319

320-
#if compiler(>=5.9)
321320
/// Returns a `SerialExecutor` corresponding to this ``EventLoop``.
322321
///
323322
/// This executor can be used to isolate an actor to a given ``EventLoop``. Implementers are encouraged to customise
@@ -330,7 +329,6 @@ public protocol EventLoop: EventLoopGroup {
330329
/// Submit a job to be executed by the `EventLoop`
331330
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
332331
func enqueue(_ job: consuming ExecutorJob)
333-
#endif
334332

335333
/// Must crash if it is not safe to call `wait()` on an `EventLoopFuture`.
336334
///
@@ -415,7 +413,6 @@ extension EventLoop {
415413
}
416414

417415
extension EventLoop {
418-
#if compiler(>=5.9)
419416
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
420417
public var executor: any SerialExecutor {
421418
NIODefaultSerialEventLoopExecutor(self)
@@ -432,7 +429,6 @@ extension EventLoop {
432429
unownedJob.runSynchronously(on: self.executor.asUnownedSerialExecutor())
433430
}
434431
}
435-
#endif
436432
}
437433

438434
extension EventLoopGroup {

Sources/NIOCore/NIOScheduledCallback.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ public struct NIOScheduledCallback: Sendable {
8989
}
9090

9191
extension EventLoop {
92-
// This could be package once we drop Swift 5.8.
93-
public func _scheduleCallback(
92+
package func _scheduleCallback(
9493
at deadline: NIODeadline,
9594
handler: some NIOScheduledCallbackHandler
9695
) -> NIOScheduledCallback {

Sources/NIOEmbedded/AsyncTestingEventLoop.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,8 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
407407
}
408408

409409
// MARK: SerialExecutor conformance
410-
#if compiler(>=5.9)
411410
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
412411
extension NIOAsyncTestingEventLoop: NIOSerialEventLoopExecutor {}
413-
#endif
414412

415413
/// This is a thread-safe promise creation store.
416414
///

Sources/NIOEmbedded/Embedded.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,12 @@ public final class EmbeddedEventLoop: EventLoop, CustomStringConvertible {
271271
precondition(scheduledTasks.isEmpty, "Embedded event loop freed with unexecuted scheduled tasks!")
272272
}
273273

274-
#if compiler(>=5.9)
275274
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
276275
public var executor: any SerialExecutor {
277276
fatalError(
278277
"EmbeddedEventLoop is not thread safe and cannot be used as a SerialExecutor. Use NIOAsyncTestingEventLoop instead."
279278
)
280279
}
281-
#endif
282280
}
283281

284282
@usableFromInline

Sources/NIOPosix/MultiThreadedEventLoopGroup.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,6 @@ extension MultiThreadedEventLoopGroup: CustomStringConvertible {
489489
}
490490
}
491491

492-
#if compiler(>=5.9)
493492
@usableFromInline
494493
struct ErasedUnownedJob {
495494
@usableFromInline
@@ -507,7 +506,6 @@ struct ErasedUnownedJob {
507506
self.erasedJob as! UnownedJob
508507
}
509508
}
510-
#endif
511509

512510
@usableFromInline
513511
internal struct ScheduledTask {

Sources/NIOPosix/PosixSingletons+ConcurrencyTakeOver.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@
1515
import Atomics
1616
import NIOCore
1717

18-
#if compiler(>=5.9)
1918
private protocol SilenceWarning {
2019
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
2120
func enqueue(_ job: UnownedJob)
2221
}
2322
@available(macOS 14, *)
2423
extension SelectableEventLoop: SilenceWarning {}
25-
#endif
2624

2725
private let _haveWeTakenOverTheConcurrencyPool = ManagedAtomic(false)
2826
extension NIOSingletons {

Sources/NIOPosix/SelectableEventLoop.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,13 @@ internal final class SelectableEventLoop: EventLoop {
353353
try? self._schedule0(.immediate(.function(task)))
354354
}
355355

356-
#if compiler(>=5.9)
357356
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
358357
@usableFromInline
359358
func enqueue(_ job: consuming ExecutorJob) {
360359
// nothing we can do if we fail enqueuing here.
361360
let erasedJob = ErasedUnownedJob(job: UnownedJob(job))
362361
try? self._schedule0(.immediate(.unownedJob(erasedJob)))
363362
}
364-
#endif
365363

366364
/// Add the `ScheduledTask` to be executed.
367365
@usableFromInline
@@ -901,17 +899,13 @@ extension SelectableEventLoop: CustomStringConvertible, CustomDebugStringConvert
901899
}
902900

903901
// MARK: SerialExecutor conformance
904-
#if compiler(>=5.9)
905902
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
906903
extension SelectableEventLoop: NIOSerialEventLoopExecutor {}
907-
#endif
908904

909905
@usableFromInline
910906
enum UnderlyingTask {
911907
case function(() -> Void)
912-
#if compiler(>=5.9)
913908
case unownedJob(ErasedUnownedJob)
914-
#endif
915909
case callback(any NIOScheduledCallbackHandler)
916910
}
917911

Sources/NIOTCPEchoClient/Client.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if compiler(>=5.9)
1615
import NIOCore
1716
import NIOPosix
1817

@@ -112,11 +111,3 @@ private final class NewlineDelimiterCoder: ByteToMessageDecoder, MessageToByteEn
112111
out.writeInteger(self.newLine)
113112
}
114113
}
115-
#else
116-
@main
117-
struct Client {
118-
static func main() {
119-
fatalError("Requires at least Swift 5.9")
120-
}
121-
}
122-
#endif

Sources/NIOTCPEchoServer/Server.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if compiler(>=5.9)
1615
import NIOCore
1716
import NIOPosix
1817

@@ -122,11 +121,3 @@ private final class NewlineDelimiterCoder: ByteToMessageDecoder, MessageToByteEn
122121
out.writeInteger(self.newLine)
123122
}
124123
}
125-
#else
126-
@main
127-
struct Server {
128-
static func main() {
129-
fatalError("Requires at least Swift 5.9")
130-
}
131-
}
132-
#endif

Tests/NIOPosixTests/SerialExecutorTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import NIOEmbedded
1616
import NIOPosix
1717
import XCTest
1818

19-
#if compiler(>=5.9)
2019
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
2120
actor EventLoopBoundActor {
2221
nonisolated let unownedExecutor: UnownedSerialExecutor
@@ -45,19 +44,13 @@ actor EventLoopBoundActor {
4544
}
4645
#endif
4746
}
48-
#endif
4947

5048
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
5149
final class SerialExecutorTests: XCTestCase {
5250
private func _testBasicExecutorFitsOnEventLoop(loop1: EventLoop, loop2: EventLoop) async throws {
53-
#if compiler(<5.9)
54-
throw XCTSkip("Custom executors are only supported in 5.9")
55-
#else
56-
5751
let testActor = EventLoopBoundActor(loop: loop1)
5852
await testActor.assertInLoop(loop1)
5953
await testActor.assertNotInLoop(loop2)
60-
#endif
6154
}
6255

6356
func testBasicExecutorFitsOnEventLoop_MTELG() async throws {

0 commit comments

Comments
 (0)