Raise minimum supported Swift version from 5.4 to 5.5

Motivation:

SwiftNIO periodically drops support for older Swift versions. Now that
5.7 has been released, 5.4 will be dropped.

Modifications:

- Remove 5.4 specific Package.swift and docker-compose
- Update the 5.7 docker-compose to use the released 5.7 and move from
  focal (2004) to jammy (2204)
- Update docs

Results:

Minimum Swift version is 5.5
This commit is contained in:
George Barnett 2022-09-15 09:37:52 +01:00
parent 6c84d24775
commit dcb8cf89d4
8 changed files with 32 additions and 167 deletions

View File

@ -119,7 +119,7 @@ let package = Package(
.library(name: "NIOHTTPCompression", targets: ["NIOHTTPCompression"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.34.0"),
.package(url: "https://github.com/apple/swift-nio.git", from: "2.42.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
],
targets: targets

View File

@ -1,125 +0,0 @@
// swift-tools-version:5.4
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftNIO open source project
//
// Copyright (c) 2017-2022 Apple Inc. and the SwiftNIO project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import PackageDescription
var targets: [PackageDescription.Target] = [
.target(
name: "NIOExtras",
dependencies: [
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
]),
.target(
name: "NIOHTTPCompression",
dependencies: [
"CNIOExtrasZlib",
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.executableTarget(
name: "HTTPServerWithQuiescingDemo",
dependencies: [
"NIOExtras",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.executableTarget(
name: "NIOWritePCAPDemo",
dependencies: [
"NIOExtras",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.executableTarget(
name: "NIOWritePartialPCAPDemo",
dependencies: [
"NIOExtras",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.executableTarget(
name: "NIOExtrasPerformanceTester",
dependencies: [
"NIOExtras",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
]),
.target(
name: "NIOSOCKS",
dependencies: [
.product(name: "NIO", package: "swift-nio"),
.product(name: "NIOCore", package: "swift-nio"),
]),
.executableTarget(
name: "NIOSOCKSClient",
dependencies: [
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
"NIOSOCKS"
]),
.target(
name: "CNIOExtrasZlib",
dependencies: [],
linkerSettings: [
.linkedLibrary("z")
]),
.testTarget(
name: "NIOExtrasTests",
dependencies: [
"NIOExtras",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
.product(name: "NIOTestUtils", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
]),
.testTarget(
name: "NIOHTTPCompressionTests",
dependencies: [
"CNIOExtrasZlib",
"NIOHTTPCompression",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
.product(name: "NIOHTTP1", package: "swift-nio"),
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
]),
.testTarget(
name: "NIOSOCKSTests",
dependencies: [
"NIOSOCKS",
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
])
]
let package = Package(
name: "swift-nio-extras",
products: [
.library(name: "NIOExtras", targets: ["NIOExtras"]),
.library(name: "NIOSOCKS", targets: ["NIOSOCKS"]),
.library(name: "NIOHTTPCompression", targets: ["NIOHTTPCompression"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio.git", from: "2.34.0"),
],
targets: targets
)

View File

@ -14,7 +14,7 @@ All code will go through code review like in the other repositories related to t
`swift-nio-extras` part of the SwiftNIO 2 family of repositories and depends on the following:
- [`swift-nio`](https://github.com/apple/swift-nio), version 2.30.0 or better.
- Swift 5.4.
- Swift 5.5.
- `zlib` and its development headers installed on the system. But don't worry, you'll find `zlib` on pretty much any UNIX system that can compile any sort of code.
To depend on `swift-nio-extras`, put the following in the `dependencies` of your `Package.swift`:
@ -25,7 +25,14 @@ To depend on `swift-nio-extras`, put the following in the `dependencies` of your
### Support for older Swift versions
Earlier versions of SwiftNIO (2.39.x and lower) and SwiftNIOExtras (1.10.x and lower) supported Swift 5.2 and 5.3, SwiftNIO (2.29.x and lower) and SwiftNIOExtras (1.9.x and lower) supported Swift 5.0 and 5.1.
The most recent versions of SwiftNIO Extras support Swift 5.5 and newer. The minimum Swift version supported by SwiftNIO Extras releases are detailed below:
SwiftNIO Extras | Minimum Swift Version
--------------------|----------------------
`1.0.0 ..< 1.10.0` | 5.0
`1.10.0 ..< 1.11.0` | 5.2
`1.11.0 ..< 1.14.0` | 5.4
`1.14.0 ...` | 5.5
On the [`nio-extras-0.1`](https://github.com/apple/swift-nio-extras/tree/nio-extras-0.1) branch, you can find the `swift-nio-extras` version for the SwiftNIO 1 family. It requires Swift 4.1 or better.

View File

@ -546,7 +546,7 @@ class HTTPResponseCompressorTest: XCTestCase {
XCTAssertNoThrow(try channel.pipeline.removeHandler(name: "compressor").wait())
XCTAssertNoThrow(try writePromise.futureResult.wait())
}
func testChunkedGzipResponseProducesCorrectNumberOfWrites() throws {
let channel = try compressionChannel()
try sendRequest(acceptEncoding: "gzip", channel: channel)
@ -558,14 +558,14 @@ class HTTPResponseCompressorTest: XCTestCase {
channel.write(NIOAny(HTTPServerResponsePart.head(head)), promise: nil)
channel.writeAndFlush(NIOAny(HTTPServerResponsePart.body(.byteBuffer(bodyBuffer))), promise: nil)
channel.writeAndFlush(NIOAny(HTTPServerResponsePart.end(nil)), promise: finalPromise)
try finalPromise.futureResult.wait()
var writeCount = 0
while try channel.readOutbound(as: ByteBuffer.self) != nil {
writeCount += 1
}
// Expected number of emitted writes in the chunked response is 8:
// 1. HTTP response header
// 2. First chunk length
@ -673,7 +673,7 @@ extension EventLoopFuture {
}
return fulfilled
} else {
let lock = Lock()
let lock = NIOLock()
let group = DispatchGroup()
var fulfilled = false // protected by lock

View File

@ -1,4 +1,4 @@
ARG swift_version=5.4
ARG swift_version=5.7
ARG ubuntu_version=focal
ARG base_image=swift:$swift_version-$ubuntu_version
FROM $base_image

View File

@ -1,18 +0,0 @@
version: "3"
services:
runtime-setup:
image: swift-nio-extras:18.04-5.4
build:
args:
base_image: "swift:5.4-bionic"
ubuntu_version: "bionic"
swift_version: "5.4"
test:
image: swift-nio-extras:18.04-5.4
command: /bin/bash -xcl "cat /etc/lsb-release && swift -version && swift test -Xswiftc -warnings-as-errors $${SANITIZER_ARG-}"
shell:
image: swift-nio-extras:18.04-5.4

View File

@ -1,15 +0,0 @@
version: "3"
services:
runtime-setup:
image: swift-nio-extras:20.04-5.7
build:
args:
base_image: "swiftlang/swift:nightly-5.7-focal"
test:
image: swift-nio-extras:20.04-5.7
shell:
image: swift-nio-extras:20.04-5.7

View File

@ -0,0 +1,16 @@
version: "3"
services:
runtime-setup:
image: swift-nio-extras:22.04-5.7
build:
args:
ubuntu_version: "jammy"
swift_version: "5.7"
test:
image: swift-nio-extras:22.04-5.7
shell:
image: swift-nio-extras:22.04-5.7