Skip to content

Commit

Permalink
Drop support for Swift 5.7 (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianfett authored Jun 14, 2024
1 parent e7b9a08 commit 5f541d0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 26 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
fail-fast: false
matrix:
swift-image:
- swift:5.7-jammy
- swift:5.8-jammy
- swift:5.9-jammy
- swift:5.10-noble
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.8
import PackageDescription

let package = Package(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<img src="https://img.shields.io/github/actions/workflow/status/vapor/postgres-nio/test.yml?event=push&style=plastic&logo=github&label=tests&logoColor=%23ccc" alt="Continuous Integration">
</a>
<a href="https://swift.org">
<img src="https://design.vapor.codes/images/swift57up.svg" alt="Swift 5.7+">
<img src="https://design.vapor.codes/images/swift58up.svg" alt="Swift 5.8+">
</a>
<a href="https://www.swift.org/sswg/incubation-process.html">
<img src="https://design.vapor.codes/images/sswg-graduated.svg" alt="SSWG Incubation Level: Graduated">
Expand Down Expand Up @@ -167,7 +167,7 @@ Please see [SECURITY.md] for details on the security process.
[Team Chat]: https://discord.gg/vapor
[MIT License]: LICENSE
[Continuous Integration]: https://github.com/vapor/postgres-nio/actions
[Swift 5.7]: https://swift.org
[Swift 5.8]: https://swift.org
[Security.md]: https://github.com/vapor/.github/blob/main/SECURITY.md

[`PostgresConnection`]: https://api.vapor.codes/postgresnio/documentation/postgresnio/postgresconnection
Expand Down
8 changes: 4 additions & 4 deletions Sources/ConnectionPoolModule/ConnectionPool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public final class ConnectionPool<

public func run() async {
await withTaskCancellationHandler {
#if swift(>=5.8) && os(Linux) || swift(>=5.9)
#if os(Linux) || compiler(>=5.9)
if #available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *) {
return await withDiscardingTaskGroup() { taskGroup in
await self.run(in: &taskGroup)
Expand Down Expand Up @@ -313,7 +313,7 @@ public final class ConnectionPool<
case scheduleTimer(StateMachine.Timer)
}

#if swift(>=5.8) && os(Linux) || swift(>=5.9)
#if os(Linux) || compiler(>=5.9)
@available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *)
private func run(in taskGroup: inout DiscardingTaskGroup) async {
for await event in self.eventStream {
Expand Down Expand Up @@ -507,7 +507,7 @@ public final class ConnectionPool<
await withTaskGroup(of: TimerRunResult.self, returning: Void.self) { taskGroup in
taskGroup.addTask {
do {
#if swift(>=5.8) && os(Linux) || swift(>=5.9)
#if os(Linux) || compiler(>=5.9)
try await self.clock.sleep(for: timer.duration)
#else
try await self.clock.sleep(until: self.clock.now.advanced(by: timer.duration), tolerance: nil)
Expand Down Expand Up @@ -593,7 +593,7 @@ protocol TaskGroupProtocol {
mutating func addTask_(operation: @escaping @Sendable () async -> Void)
}

#if swift(>=5.8) && os(Linux) || swift(>=5.9)
#if os(Linux) || swift(>=5.9)
@available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *)
extension DiscardingTaskGroup: TaskGroupProtocol {
@inlinable
Expand Down
2 changes: 1 addition & 1 deletion Sources/PostgresNIO/New/NotificationListener.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ final class NotificationListener: @unchecked Sendable {
}


#if swift(<5.9)
#if compiler(<5.9)
// Async stream API backfill
extension AsyncThrowingStream {
static func makeStream(
Expand Down
7 changes: 1 addition & 6 deletions Sources/PostgresNIO/New/PostgresNotificationSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public struct PostgresNotification: Sendable {
public let payload: String
}

public struct PostgresNotificationSequence: AsyncSequence {
public struct PostgresNotificationSequence: AsyncSequence, Sendable {
public typealias Element = PostgresNotification

let base: AsyncThrowingStream<PostgresNotification, Error>
Expand All @@ -20,8 +20,3 @@ public struct PostgresNotificationSequence: AsyncSequence {
}
}
}

#if swift(>=5.7)
// AsyncThrowingStream is marked as Sendable in Swift 5.6
extension PostgresNotificationSequence: Sendable {}
#endif
11 changes: 0 additions & 11 deletions Sources/PostgresNIO/Utilities/Exports.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#if swift(>=5.8)

@_documentation(visibility: internal) @_exported import NIO
@_documentation(visibility: internal) @_exported import NIOSSL
@_documentation(visibility: internal) @_exported import struct Logging.Logger

#else

// TODO: Remove this with the next major release!
@_exported import NIO
@_exported import NIOSSL
@_exported import struct Logging.Logger

#endif

0 comments on commit 5f541d0

Please sign in to comment.