Skip to content

Commit

Permalink
Swift 5.8 (#50)
Browse files Browse the repository at this point in the history
* Swift 5.8

* Remove #if compiler(>=5.5.2)
  • Loading branch information
adam-fowler committed Apr 3, 2023
1 parent c1e57c4 commit 6bea362
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/api-breakage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
linux:
runs-on: ubuntu-latest
container:
image: swift:5.7
image: swift:5.8
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ jobs:
strategy:
matrix:
image:
- 'swift:5.5'
- 'swift:5.6'
- 'swift:5.7'
- 'swift:5.8'

container:
image: ${{ matrix.image }}
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.3
// swift-tools-version:5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//
//===----------------------------------------------------------------------===//

#if compiler(>=5.5.2) && canImport(_Concurrency)

import NIOCore

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
Expand Down Expand Up @@ -72,5 +70,3 @@ public struct HBRequestBodyStreamerSequence: AsyncSequence {
return AsyncIterator(streamer: self.streamer)
}
}

#endif // compiler(>=5.5) && canImport(_Concurrency)
6 changes: 0 additions & 6 deletions Sources/HummingbirdCore/Request/ByteBufferStreamer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ public protocol HBStreamerProtocol: HBSendable {
/// - Returns: EventLoopFuture that will be fulfilled when all buffers are consumed
func consumeAll(on eventLoop: EventLoop, _ process: @escaping (ByteBuffer) -> EventLoopFuture<Void>) -> EventLoopFuture<Void>

#if compiler(>=5.5.2) && canImport(_Concurrency)

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
func consume() async throws -> HBStreamerOutput

#endif // compiler(>=5.5) && canImport(_Concurrency)
}

/// Request body streamer. `HBHTTPDecodeHandler` feeds this with ByteBuffers while the Router consumes them
Expand Down Expand Up @@ -338,7 +334,5 @@ final class HBStaticStreamer: HBStreamerProtocol {
}
}

#if compiler(>=5.6)
extension HBByteBufferStreamer: @unchecked Sendable {}
extension HBStaticStreamer: @unchecked Sendable {}
#endif
4 changes: 0 additions & 4 deletions Sources/HummingbirdCore/Request/RequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ extension HBRequestBody: CustomStringConvertible {
}
}

#if compiler(>=5.5.2) && canImport(_Concurrency)

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension HBRequestBody {
/// Provide body as a single ByteBuffer
Expand All @@ -118,5 +116,3 @@ extension HBRequestBody {
}
}
}

#endif // compiler(>=5.5.2) && canImport(_Concurrency)
4 changes: 0 additions & 4 deletions Sources/HummingbirdCore/Response/ResponseBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@

import NIOCore

#if compiler(>=5.6)
/// Function returning streamed byte buffer output
public typealias HBStreamCallback = @Sendable (EventLoop) -> EventLoopFuture<HBStreamerOutput>
#else
public typealias HBStreamCallback = (EventLoop) -> EventLoopFuture<HBStreamerOutput>
#endif

/// Response body. Can be a single ByteBuffer, a stream of ByteBuffers or empty
public enum HBResponseBody: HBSendable {
Expand Down
4 changes: 0 additions & 4 deletions Tests/HummingbirdCoreTests/CoreTests+async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
//
//===----------------------------------------------------------------------===//

#if compiler(>=5.5.2) && canImport(_Concurrency)

import HummingbirdCore
import HummingbirdCoreXCT
import NIOCore
Expand Down Expand Up @@ -85,5 +83,3 @@ final class HummingBirdCoreAsyncTests: XCTestCase {
XCTAssertNoThrow(try future.wait())
}
}

#endif // compiler(>=5.5) && canImport(_Concurrency)
1 change: 0 additions & 1 deletion Tests/HummingbirdCoreTests/CoreTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ class HummingBirdCoreTests: XCTestCase {
func testConsumeBodyInTask() {
struct Responder: HBHTTPResponder {
func respond(to request: HBHTTPRequest, context: ChannelHandlerContext, onComplete: @escaping (Result<HBHTTPResponse, Error>) -> Void) {
let eventLoop = context.eventLoop
Task {
do {
let buffer = try await request.body.consumeBody(maxSize: .max)
Expand Down

0 comments on commit 6bea362

Please sign in to comment.