diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 20a4e9d6a3..c17b272790 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,16 +63,16 @@ We require that your commit messages match our template. The easiest way to do t git config commit.template dev/git.commit.template -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. +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. ### Make sure Tests work on Linux -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). +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). 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. ### Make sure your patch works for all supported versions of swift -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) +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) ### Make sure your code is performant diff --git a/Package.swift b/Package.swift index 1ed800aa0e..2ad8389fa4 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.2 //===----------------------------------------------------------------------===// // // This source file is part of the SwiftNIO open source project diff --git a/README.md b/README.md index 5cc72688e0..52a0f93e94 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's like [Netty](https://netty.io), but written for Swift. The SwiftNIO project is split across multiple repositories: -Repository | NIO 2 (Swift 5+) | NIO 1 (Swift 4+) +Repository | NIO 2 (Swift 5.2+) | NIO 1 (Swift 4+) --- | --- | --- [https://github.com/apple/swift-nio][repo-nio]
SwiftNIO core | `from: "2.0.0"` | `from: "1.0.0"` [https://github.com/apple/swift-nio-ssl][repo-nio-ssl]
TLS (SSL) support | `from: "2.0.0"` | `from: "1.0.0"` @@ -20,6 +20,8 @@ Repository | NIO 2 (Swift 5+) | NIO 1 (Swift 4+) [https://github.com/apple/swift-nio-transport-services][repo-nio-transport-services]
first-class support for macOS, iOS, tvOS, and watchOS | `from: "1.0.0"` | `from: "0.1.0"` [https://github.com/apple/swift-nio-ssh][repo-nio-ssh]
SSH support | `.upToNextMinor(from: "0.2.0")` | _n/a_ +NIO 2.29.0 and older support Swift 5.0+. + ### Protocol Implementations 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. #### SwiftNIO 2 -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. +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. ### Compatibility @@ -309,11 +311,11 @@ have a few prerequisites installed on your system. #### macOS -- Xcode 10.2 or newer, Xcode 11 recommended. +- Xcode 11.4 or newer, Xcode 12 recommended. ### Linux -- 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. +- 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. - netcat (for integration tests only) - lsof (for integration tests only) - shasum (for integration tests only) @@ -355,7 +357,7 @@ dnf install swift-lang /usr/bin/nc /usr/bin/lsof /usr/bin/shasum [repo-nio-ssh]: https://github.com/apple/swift-nio-ssh ### Speeding up testing -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. +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. ``` swift test --parallel diff --git a/dev/update-alloc-limits-to-last-completed-ci-build b/dev/update-alloc-limits-to-last-completed-ci-build index 8f4dec5150..619fe8b3a0 100755 --- a/dev/update-alloc-limits-to-last-completed-ci-build +++ b/dev/update-alloc-limits-to-last-completed-ci-build @@ -22,7 +22,7 @@ url_prefix=${1-"https://ci.swiftserver.group/job/swift-nio2-swift"} target_repo=${2-"$here/.."} tmpdir=$(mktemp -d /tmp/.last-build_XXXXXX) -for f in 51 52 53 54 55 -nightly; do +for f in 52 53 54 55 -nightly; do echo "swift$f" url="$url_prefix$f-prb/lastCompletedBuild/consoleFull" echo "$url" diff --git a/docker/Dockerfile b/docker/Dockerfile index 750c165d3c..3dccb6ff72 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG swift_version=5.0 +ARG swift_version=5.2 ARG ubuntu_version=bionic ARG base_image=swift:$swift_version-$ubuntu_version FROM $base_image diff --git a/docker/docker-compose.1804.50.yaml b/docker/docker-compose.1804.50.yaml deleted file mode 100644 index da3acc00b7..0000000000 --- a/docker/docker-compose.1804.50.yaml +++ /dev/null @@ -1,33 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-nio:18.04-5.0 - build: - args: - ubuntu_version: "bionic" - swift_version: "5.0" - - unit-tests: - image: swift-nio:18.04-5.0 - - integration-tests: - image: swift-nio:18.04-5.0 - - test: - image: swift-nio:18.04-5.0 - environment: - - INTEGRATION_TESTS_ARG=-f tests_0[012356789] - - performance-test: - image: swift-nio:18.04-5.0 - - shell: - image: swift-nio:18.04-5.0 - - echo: - image: swift-nio:18.04-5.0 - - http: - image: swift-nio:18.04-5.0 diff --git a/docker/docker-compose.1804.51.yaml b/docker/docker-compose.1804.51.yaml deleted file mode 100644 index 9cc6504252..0000000000 --- a/docker/docker-compose.1804.51.yaml +++ /dev/null @@ -1,65 +0,0 @@ -version: "3" - -services: - - runtime-setup: - image: swift-nio:18.04-5.1 - build: - args: - ubuntu_version: "bionic" - swift_version: "5.1" - - unit-tests: - image: swift-nio:18.04-5.1 - - integration-tests: - image: swift-nio:18.04-5.1 - - test: - image: swift-nio:18.04-5.1 - environment: - - MAX_ALLOCS_ALLOWED_1000_addHandlers=47050 - - MAX_ALLOCS_ALLOWED_1000_addHandlers_sync=40050 - - MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlercontext=9050 - - MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlername=9050 - - MAX_ALLOCS_ALLOWED_1000_addRemoveHandlers_handlertype=9050 - - MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet=32050 - - MAX_ALLOCS_ALLOWED_1000_autoReadGetAndSet_sync=0 - - MAX_ALLOCS_ALLOWED_1000_getHandlers=9050 - - MAX_ALLOCS_ALLOWED_1000_getHandlers_sync=37 - - MAX_ALLOCS_ALLOWED_1000_reqs_1_conn=30450 - - MAX_ALLOCS_ALLOWED_1000_tcpbootstraps=3050 - - MAX_ALLOCS_ALLOWED_1000_tcpconnections=171050 - - MAX_ALLOCS_ALLOWED_1000_udp_reqs=12050 - - MAX_ALLOCS_ALLOWED_1000_udpbootstraps=2050 - - MAX_ALLOCS_ALLOWED_1000_udpconnections=96050 - - MAX_ALLOCS_ALLOWED_1_reqs_1000_conn=452050 - - MAX_ALLOCS_ALLOWED_bytebuffer_lots_of_rw=2050 - - MAX_ALLOCS_ALLOWED_creating_10000_headers=10050 - - MAX_ALLOCS_ALLOWED_decode_1000_ws_frames=2050 - - MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_holding_buffer=3 - - MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_holding_buffer_with_space=3 - - MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer=3050 - - MAX_ALLOCS_ALLOWED_encode_1000_ws_frames_new_buffer_with_space=3050 - - MAX_ALLOCS_ALLOWED_future_erase_result=4050 - - MAX_ALLOCS_ALLOWED_future_lots_of_callbacks=60050 - - MAX_ALLOCS_ALLOWED_modifying_1000_circular_buffer_elements=0 - - MAX_ALLOCS_ALLOWED_modifying_byte_buffer_view=6050 - - MAX_ALLOCS_ALLOWED_ping_pong_1000_reqs_1_conn=4400 - - MAX_ALLOCS_ALLOWED_read_10000_chunks_from_file=200050 - - MAX_ALLOCS_ALLOWED_schedule_10000_tasks=90050 - - MAX_ALLOCS_ALLOWED_scheduling_10000_executions=20150 - - MAX_ALLOCS_ALLOWED_udp_1000_reqs_1_conn=12200 - - MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=188050 - - performance-test: - image: swift-nio:18.04-5.1 - - shell: - image: swift-nio:18.04-5.1 - - echo: - image: swift-nio:18.04-5.1 - - http: - image: swift-nio:18.04-5.1 diff --git a/docker/docker-compose.1604.52.yaml b/docker/docker-compose.1804.52.yaml similarity index 86% rename from docker/docker-compose.1604.52.yaml rename to docker/docker-compose.1804.52.yaml index 79e926112e..cf59d36eb1 100644 --- a/docker/docker-compose.1604.52.yaml +++ b/docker/docker-compose.1804.52.yaml @@ -3,20 +3,20 @@ version: "3" services: runtime-setup: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 build: args: - ubuntu_version: "xenial" + ubuntu_version: "bionic" swift_version: "5.2" unit-tests: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 integration-tests: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 test: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 environment: - MAX_ALLOCS_ALLOWED_1000_addHandlers=47050 - MAX_ALLOCS_ALLOWED_1000_addHandlers_sync=40050 @@ -51,17 +51,17 @@ services: - MAX_ALLOCS_ALLOWED_scheduling_10000_executions=20150 - MAX_ALLOCS_ALLOWED_udp_1000_reqs_1_conn=12200 - MAX_ALLOCS_ALLOWED_udp_1_reqs_1000_conn=188050 - - SANITIZER_ARG=--sanitize=thread + # - SANITIZER_ARG=--sanitize=thread broken on 18.04 - INTEGRATION_TESTS_ARG=-f tests_0[013-9] performance-test: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 shell: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 echo: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 http: - image: swift-nio:16.04-5.2 + image: swift-nio:18.04-5.2 diff --git a/docs/migration-guide-NIO1-to-NIO2.md b/docs/migration-guide-NIO1-to-NIO2.md index ecaa714d27..a233402fcd 100644 --- a/docs/migration-guide-NIO1-to-NIO2.md +++ b/docs/migration-guide-NIO1-to-NIO2.md @@ -4,6 +4,8 @@ This migration guide is our recommendation to migrate from NIO 1 to NIO 2. None 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. +### Note: As of NIO 2.30.0 the minimum version of Swift required is 5.2. + ## Step 1: A warning-free compile on NIO 1 with Swift 5 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. diff --git a/scripts/build_podspecs.sh b/scripts/build_podspecs.sh index 760069ebb1..97814259d1 100755 --- a/scripts/build_podspecs.sh +++ b/scripts/build_podspecs.sh @@ -99,7 +99,7 @@ Pod::Spec.new do |s| s.documentation_url = 'https://apple.github.io/swift-nio/docs/current/NIO/index.html' s.module_name = '${target#Swift}' - s.swift_version = '5.0' + s.swift_version = '5.2' s.cocoapods_version = '>=1.6.0' s.ios.deployment_target = '10.0' s.osx.deployment_target = '10.10' diff --git a/scripts/check_no_api_breakages.sh b/scripts/check_no_api_breakages.sh index 29aa38b45b..a1e2bfe0e4 100755 --- a/scripts/check_no_api_breakages.sh +++ b/scripts/check_no_api_breakages.sh @@ -47,7 +47,7 @@ function build_and_do() { function usage() { echo >&2 "Usage: $0 REPO-GITHUB-URL NEW-VERSION OLD-VERSIONS..." echo >&2 - echo >&2 "This script requires a Swift 5.1+ toolchain." + echo >&2 "This script requires a Swift 5.2+ toolchain." echo >&2 echo >&2 "Examples:" echo >&2 @@ -101,7 +101,10 @@ for old_tag in "$@"; do --input-paths "$tmpdir/api-old/$f" -input-paths "$tmpdir/api-new/$f" 2>&1 \ > "$report" 2>&1 - if ! shasum "$report" | grep -q cefc4ee5bb7bcdb7cb5a7747efa178dab3c794d5; then + # the shasum here is for an empty report, i.e. no changes + # if the shasum of the new report is different, then there's + # obviously an API change + if ! shasum "$report" | grep -q afd2a1b542b33273920d65821deddc653063c700; then echo ERROR echo >&2 "==============================" echo >&2 "ERROR: public API change in $f"