Skip to content

Commit b0effbc

Browse files
authored
Make Swift 5.2 the minimum requirement (#1860)
Make Swift 5.2 the minimum requirement, dropping support for Swift 5.0 and 5.1. Motivation: Whenever we have problems, Swift 5.0 and 5.1 seem to be the culprits. Dropping support for these very old versions will require less maintenance and free up our time to work on new features. Modifications: Set the tools version in Package.swift to 5.2 Remove CI configurations for 5.0 and 5.1 Update the various readmes to reflect that this change will be rolled out in NIO 2.30.0 Result: Swift 5.2 is the minimum version of Swift required to use NIO.
1 parent 7f3a2f5 commit b0effbc

11 files changed

+31
-122
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ We require that your commit messages match our template. The easiest way to do t
6363

6464
git config commit.template dev/git.commit.template
6565

66-
The default policy for taking contributions is “Squash and Merge” - because of this the commit message format rule above applies to the PR rather than every commit contained within it.
66+
The default policy for taking contributions is “Squash and Merge” - because of this the commit message format rule above applies to the PR rather than every commit contained within it.
6767

6868
### Make sure Tests work on Linux
6969

70-
SwiftNIO uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not (prior to swift 5.1).
70+
SwiftNIO uses XCTest to run tests on both macOS and Linux. While the macOS version of XCTest is able to use the Objective-C runtime to discover tests at execution time, the Linux version is not (prior to swift 5.1).
7171
For this reason, whenever you add new tests **you have to run a script** that generates the hooks needed to run those tests on Linux, or our CI will complain that the tests are not all present on Linux. To do this, merely execute `ruby ./scripts/generate_linux_tests.rb` at the root of the package and check the changes it made.
7272

7373
### Make sure your patch works for all supported versions of swift
7474

75-
The CI will do this for you. You can use the docker-compose files included if you wish to check locally. Currently all versions of swift >= 5.0 are supported. For example usage of docker compose see the main [README](./README.md#an-alternative-using-docker-compose)
75+
The CI will do this for you. You can use the docker-compose files included if you wish to check locally. Currently all versions of swift >= 5.2 are supported. For example usage of docker compose see the main [README](./README.md#an-alternative-using-docker-compose)
7676

7777
### Make sure your code is performant
7878

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.0
1+
// swift-tools-version:5.2
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the SwiftNIO open source project

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It's like [Netty](https://netty.io), but written for Swift.
1111

1212
The SwiftNIO project is split across multiple repositories:
1313

14-
Repository | NIO 2 (Swift 5+) | NIO 1 (Swift 4+)
14+
Repository | NIO 2 (Swift 5.2+) | NIO 1 (Swift 4+)
1515
--- | --- | ---
1616
[https://github.com/apple/swift-nio][repo-nio] <br> SwiftNIO core | `from: "2.0.0"` | `from: "1.0.0"`
1717
[https://github.com/apple/swift-nio-ssl][repo-nio-ssl] <br> TLS (SSL) support | `from: "2.0.0"` | `from: "1.0.0"`
@@ -20,6 +20,8 @@ Repository | NIO 2 (Swift 5+) | NIO 1 (Swift 4+)
2020
[https://github.com/apple/swift-nio-transport-services][repo-nio-transport-services] <br> first-class support for macOS, iOS, tvOS, and watchOS | `from: "1.0.0"` | `from: "0.1.0"`
2121
[https://github.com/apple/swift-nio-ssh][repo-nio-ssh] <br> SSH support | `.upToNextMinor(from: "0.2.0")` | _n/a_
2222

23+
NIO 2.29.0 and older support Swift 5.0+.
24+
2325
### Protocol Implementations
2426

2527
Below you can find a list of a few protocol implementations that are done with SwiftNIO. This is a non-exhaustive list of protocols that are either part of the SwiftNIO project or are accepted into the [SSWG](https://swift.org/server)'s incubation process. All of the libraries listed below do all of their I/O in a non-blocking fashion using SwiftNIO.
@@ -64,7 +66,7 @@ The latest released SwiftNIO 1 version supports Swift 4.0, 4.1, 4.2, and 5.0.
6466

6567
#### SwiftNIO 2
6668

67-
The latest released SwiftNIO 2 version supports Swift 5.0, 5.1, 5.2, 5.3, and 5.4. If you have a SwiftNIO 1 application or library that you would like to migrate to SwiftNIO 2, please check out the [migration guide](docs/migration-guide-NIO1-to-NIO2.md) we prepared for you.
69+
The latest released SwiftNIO 2 version supports Swift 5.2, 5.3, and 5.4. If you have a SwiftNIO 1 application or library that you would like to migrate to SwiftNIO 2, please check out the [migration guide](docs/migration-guide-NIO1-to-NIO2.md) we prepared for you.
6870

6971
### Compatibility
7072

@@ -309,11 +311,11 @@ have a few prerequisites installed on your system.
309311

310312
#### macOS
311313

312-
- Xcode 10.2 or newer, Xcode 11 recommended.
314+
- Xcode 11.4 or newer, Xcode 12 recommended.
313315

314316
### Linux
315317

316-
- Swift 5.0, 5.1, 5.2, 5.3, or 5.4 from [swift.org/download](https://swift.org/download/#releases). We always recommend to use the latest released version.
318+
- Swift 5.2, 5.3, or 5.4 from [swift.org/download](https://swift.org/download/#releases). We always recommend to use the latest released version.
317319
- netcat (for integration tests only)
318320
- lsof (for integration tests only)
319321
- shasum (for integration tests only)
@@ -355,7 +357,7 @@ dnf install swift-lang /usr/bin/nc /usr/bin/lsof /usr/bin/shasum
355357
[repo-nio-ssh]: https://github.com/apple/swift-nio-ssh
356358

357359
### Speeding up testing
358-
It's possible to run the test suite in parallel, it can save significant time if you have a larger multi-core machine, just add `--parallel` when running the tests. This can speed up the run time of the test suite with 30x or more.
360+
It's possible to run the test suite in parallel, it can save significant time if you have a larger multi-core machine, just add `--parallel` when running the tests. This can speed up the run time of the test suite by 30x or more.
359361

360362
```
361363
swift test --parallel

dev/update-alloc-limits-to-last-completed-ci-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ url_prefix=${1-"https://ci.swiftserver.group/job/swift-nio2-swift"}
2222
target_repo=${2-"$here/.."}
2323
tmpdir=$(mktemp -d /tmp/.last-build_XXXXXX)
2424

25-
for f in 51 52 53 54 55 -nightly; do
25+
for f in 52 53 54 55 -nightly; do
2626
echo "swift$f"
2727
url="$url_prefix$f-prb/lastCompletedBuild/consoleFull"
2828
echo "$url"

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG swift_version=5.0
1+
ARG swift_version=5.2
22
ARG ubuntu_version=bionic
33
ARG base_image=swift:$swift_version-$ubuntu_version
44
FROM $base_image

docker/docker-compose.1804.50.yaml

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

docker/docker-compose.1804.51.yaml

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

docker/docker-compose.1604.52.yaml renamed to docker/docker-compose.1804.52.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ version: "3"
33
services:
44

55
runtime-setup:
6-
image: swift-nio:16.04-5.2
6+
image: swift-nio:18.04-5.2
77
build:
88
args:
9-
ubuntu_version: "xenial"
9+
ubuntu_version: "bionic"
1010
swift_version: "5.2"
1111

1212
unit-tests:
13-
image: swift-nio:16.04-5.2
13+
image: swift-nio:18.04-5.2
1414

1515
integration-tests:
16-
image: swift-nio:16.04-5.2
16+
image: swift-nio:18.04-5.2
1717

1818
test:
19-
image: swift-nio:16.04-5.2
19+
image: swift-nio:18.04-5.2
2020
environment:
2121
- MAX_ALLOCS_ALLOWED_1000_addHandlers=47050
2222
- MAX_ALLOCS_ALLOWED_1000_addHandlers_sync=40050
@@ -51,17 +51,17 @@ services:
5151
- MAX_ALLOCS_ALLOWED_scheduling_10000_executions=20150
5252
- MAX_ALLOCS_ALLOWED_udp_1000_reqs_1_conn=12200
5353
- MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=188050
54-
- SANITIZER_ARG=--sanitize=thread
54+
# - SANITIZER_ARG=--sanitize=thread broken on 18.04
5555
- INTEGRATION_TESTS_ARG=-f tests_0[013-9]
5656

5757
performance-test:
58-
image: swift-nio:16.04-5.2
58+
image: swift-nio:18.04-5.2
5959

6060
shell:
61-
image: swift-nio:16.04-5.2
61+
image: swift-nio:18.04-5.2
6262

6363
echo:
64-
image: swift-nio:16.04-5.2
64+
image: swift-nio:18.04-5.2
6565

6666
http:
67-
image: swift-nio:16.04-5.2
67+
image: swift-nio:18.04-5.2

docs/migration-guide-NIO1-to-NIO2.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This migration guide is our recommendation to migrate from NIO 1 to NIO 2. None
44

55
This repository also contains a fairly complete list of public [API changes](https://github.com/apple/swift-nio/blob/main/docs/public-api-changes-NIO1-to-NIO2.md) from NIO 1 to NIO 2.
66

7+
### Note: As of NIO 2.30.0 the minimum version of Swift required is 5.2.
8+
79
## Step 1: A warning-free compile on NIO 1 with Swift 5
810

911
To start with, we highly recommend to first get your project to compile warning-free with NIO 1 on Swift 5. The reason is that some of the warnings you might get are the result of deprecation in NIO 1 and deprecated NIO 1 API has been fully removed in NIO 2.

scripts/build_podspecs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Pod::Spec.new do |s|
9999
s.documentation_url = 'https://apple.github.io/swift-nio/docs/current/NIO/index.html'
100100
s.module_name = '${target#Swift}'
101101
102-
s.swift_version = '5.0'
102+
s.swift_version = '5.2'
103103
s.cocoapods_version = '>=1.6.0'
104104
s.ios.deployment_target = '10.0'
105105
s.osx.deployment_target = '10.10'

0 commit comments

Comments
 (0)