mirror of
https://github.com/apple/swift-nio
synced 2026-11-22 04:30:41 +00:00
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.
This commit is contained in:
1 parent
06c16b1a26
commit
2fe3d92cf5
17 files changed
+8
-59
No files matched your search
@@ -12,7 +12,7 @@ jobs:
|
||||
with:
|
||||
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
|
||||
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"mallocCountTotal" : 8000
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"mallocCountTotal" : 556
|
||||
}
|
||||
+1
-1
@@ -67,7 +67,7 @@ The default policy for taking contributions is “Squash and Merge” - because
|
||||
|
||||
### Make sure your patch works for all supported versions of swift
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
If you wish to test this locally you have two options [act](https://github.com/nektos/act) and Docker Compose files.
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// swift-tools-version:5.8
|
||||
// swift-tools-version:5.9
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftNIO open source project
|
||||
|
||||
@@ -74,9 +74,9 @@ This is the current version of SwiftNIO and will be supported for the foreseeabl
|
||||
### Swift Versions
|
||||
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
|
||||
The most recent versions of SwiftNIO support Swift 5.8 and newer. The minimum Swift version supported by SwiftNIO releases are detailed below:
|
||||
The most recent versions of SwiftNIO support Swift 5.9 and newer. The minimum Swift version supported by SwiftNIO releases are detailed below:
|
||||
|
||||
SwiftNIO | Minimum Swift Version
|
||||
--------------------|----------------------
|
||||
@@ -86,7 +86,8 @@ SwiftNIO | Minimum Swift Version
|
||||
`2.43.0 ..< 2.51.0` | 5.5.2
|
||||
`2.51.0 ..< 2.60.0` | 5.6
|
||||
`2.60.0 ..< 2.65.0` | 5.7
|
||||
`2.65.0 ...` | 5.8
|
||||
`2.65.0 ..< 2.76.0 | 5.8
|
||||
`2.76.0 ...` | 5.9
|
||||
|
||||
### SwiftNIO 1
|
||||
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.
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=5.9)
|
||||
/// A helper protocol that can be mixed in to a NIO ``EventLoop`` to provide an
|
||||
/// automatic conformance to `SerialExecutor`.
|
||||
///
|
||||
@@ -91,4 +90,3 @@ extension NIODefaultSerialEventLoopExecutor: SerialExecutor {
|
||||
self.loop === other.loop
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -317,7 +317,6 @@ public protocol EventLoop: EventLoopGroup {
|
||||
/// allows `EventLoop`s to cache a pre-succeeded `Void` future to prevent superfluous allocations.
|
||||
func makeSucceededVoidFuture() -> EventLoopFuture<Void>
|
||||
|
||||
#if compiler(>=5.9)
|
||||
/// Returns a `SerialExecutor` corresponding to this ``EventLoop``.
|
||||
///
|
||||
/// 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 {
|
||||
/// Submit a job to be executed by the `EventLoop`
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
func enqueue(_ job: consuming ExecutorJob)
|
||||
#endif
|
||||
|
||||
/// Must crash if it is not safe to call `wait()` on an `EventLoopFuture`.
|
||||
///
|
||||
@@ -415,7 +413,6 @@ extension EventLoop {
|
||||
}
|
||||
|
||||
extension EventLoop {
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
public var executor: any SerialExecutor {
|
||||
NIODefaultSerialEventLoopExecutor(self)
|
||||
@@ -432,7 +429,6 @@ extension EventLoop {
|
||||
unownedJob.runSynchronously(on: self.executor.asUnownedSerialExecutor())
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extension EventLoopGroup {
|
||||
|
||||
@@ -89,8 +89,7 @@ public struct NIOScheduledCallback: Sendable {
|
||||
}
|
||||
|
||||
extension EventLoop {
|
||||
// This could be package once we drop Swift 5.8.
|
||||
public func _scheduleCallback(
|
||||
package func _scheduleCallback(
|
||||
at deadline: NIODeadline,
|
||||
handler: some NIOScheduledCallbackHandler
|
||||
) -> NIOScheduledCallback {
|
||||
|
||||
@@ -407,10 +407,8 @@ public final class NIOAsyncTestingEventLoop: EventLoop, @unchecked Sendable {
|
||||
}
|
||||
|
||||
// MARK: SerialExecutor conformance
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
extension NIOAsyncTestingEventLoop: NIOSerialEventLoopExecutor {}
|
||||
#endif
|
||||
|
||||
/// This is a thread-safe promise creation store.
|
||||
///
|
||||
|
||||
@@ -271,14 +271,12 @@ public final class EmbeddedEventLoop: EventLoop, CustomStringConvertible {
|
||||
precondition(scheduledTasks.isEmpty, "Embedded event loop freed with unexecuted scheduled tasks!")
|
||||
}
|
||||
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
public var executor: any SerialExecutor {
|
||||
fatalError(
|
||||
"EmbeddedEventLoop is not thread safe and cannot be used as a SerialExecutor. Use NIOAsyncTestingEventLoop instead."
|
||||
)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
|
||||
@@ -489,7 +489,6 @@ extension MultiThreadedEventLoopGroup: CustomStringConvertible {
|
||||
}
|
||||
}
|
||||
|
||||
#if compiler(>=5.9)
|
||||
@usableFromInline
|
||||
struct ErasedUnownedJob {
|
||||
@usableFromInline
|
||||
@@ -507,7 +506,6 @@ struct ErasedUnownedJob {
|
||||
self.erasedJob as! UnownedJob
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@usableFromInline
|
||||
internal struct ScheduledTask {
|
||||
|
||||
@@ -15,14 +15,12 @@
|
||||
import Atomics
|
||||
import NIOCore
|
||||
|
||||
#if compiler(>=5.9)
|
||||
private protocol SilenceWarning {
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
func enqueue(_ job: UnownedJob)
|
||||
}
|
||||
@available(macOS 14, *)
|
||||
extension SelectableEventLoop: SilenceWarning {}
|
||||
#endif
|
||||
|
||||
private let _haveWeTakenOverTheConcurrencyPool = ManagedAtomic(false)
|
||||
extension NIOSingletons {
|
||||
|
||||
@@ -353,7 +353,6 @@ internal final class SelectableEventLoop: EventLoop {
|
||||
try? self._schedule0(.immediate(.function(task)))
|
||||
}
|
||||
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
@usableFromInline
|
||||
func enqueue(_ job: consuming ExecutorJob) {
|
||||
@@ -361,7 +360,6 @@ internal final class SelectableEventLoop: EventLoop {
|
||||
let erasedJob = ErasedUnownedJob(job: UnownedJob(job))
|
||||
try? self._schedule0(.immediate(.unownedJob(erasedJob)))
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Add the `ScheduledTask` to be executed.
|
||||
@usableFromInline
|
||||
@@ -901,17 +899,13 @@ extension SelectableEventLoop: CustomStringConvertible, CustomDebugStringConvert
|
||||
}
|
||||
|
||||
// MARK: SerialExecutor conformance
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
extension SelectableEventLoop: NIOSerialEventLoopExecutor {}
|
||||
#endif
|
||||
|
||||
@usableFromInline
|
||||
enum UnderlyingTask {
|
||||
case function(() -> Void)
|
||||
#if compiler(>=5.9)
|
||||
case unownedJob(ErasedUnownedJob)
|
||||
#endif
|
||||
case callback(any NIOScheduledCallbackHandler)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=5.9)
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
|
||||
@@ -112,11 +111,3 @@ private final class NewlineDelimiterCoder: ByteToMessageDecoder, MessageToByteEn
|
||||
out.writeInteger(self.newLine)
|
||||
}
|
||||
}
|
||||
#else
|
||||
@main
|
||||
struct Client {
|
||||
static func main() {
|
||||
fatalError("Requires at least Swift 5.9")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -12,7 +12,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#if compiler(>=5.9)
|
||||
import NIOCore
|
||||
import NIOPosix
|
||||
|
||||
@@ -122,11 +121,3 @@ private final class NewlineDelimiterCoder: ByteToMessageDecoder, MessageToByteEn
|
||||
out.writeInteger(self.newLine)
|
||||
}
|
||||
}
|
||||
#else
|
||||
@main
|
||||
struct Server {
|
||||
static func main() {
|
||||
fatalError("Requires at least Swift 5.9")
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -16,7 +16,6 @@ import NIOEmbedded
|
||||
import NIOPosix
|
||||
import XCTest
|
||||
|
||||
#if compiler(>=5.9)
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
actor EventLoopBoundActor {
|
||||
nonisolated let unownedExecutor: UnownedSerialExecutor
|
||||
@@ -45,19 +44,13 @@ actor EventLoopBoundActor {
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
|
||||
final class SerialExecutorTests: XCTestCase {
|
||||
private func _testBasicExecutorFitsOnEventLoop(loop1: EventLoop, loop2: EventLoop) async throws {
|
||||
#if compiler(<5.9)
|
||||
throw XCTSkip("Custom executors are only supported in 5.9")
|
||||
#else
|
||||
|
||||
let testActor = EventLoopBoundActor(loop: loop1)
|
||||
await testActor.assertInLoop(loop1)
|
||||
await testActor.assertNotInLoop(loop2)
|
||||
#endif
|
||||
}
|
||||
|
||||
func testBasicExecutorFitsOnEventLoop_MTELG() async throws {
|
||||
|
||||
Reference in new issue
Block a user