Skip to content

Commit

Permalink
Move to Swift 5.9 as the minimum version (#394)
Browse files Browse the repository at this point in the history
### Motivation

Part of addressing
#75 and
#119.

### Modifications

Bumped Swift tools version to 5.9 and made the `ExistentialAny` build
setting unconditional.

### Result

Building the package requires 5.9 now.

### Test Plan

Ran tests, all passed when using a Swift 5.9 toolchain.
  • Loading branch information
czechboy0 authored Nov 27, 2023
1 parent e6134b4 commit 972adfd
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Examples/GreetingService/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.8
// swift-tools-version:5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
Expand Down
2 changes: 1 addition & 1 deletion IntegrationTest/Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.8
// swift-tools-version:5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
Expand Down
10 changes: 3 additions & 7 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.8
// swift-tools-version:5.9
//===----------------------------------------------------------------------===//
//
// This source file is part of the SwiftOpenAPIGenerator open source project
Expand All @@ -16,22 +16,18 @@ import Foundation
import PackageDescription

// General Swift-settings for all targets.
var swiftSettings: [SwiftSetting] = []

#if swift(>=5.9)
swiftSettings.append(
var swiftSettings: [SwiftSetting] = [
// https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md
// Require `any` for existential types.
.enableUpcomingFeature("ExistentialAny")
)
]

// Strict concurrency is enabled in CI; use this environment variable to enable it locally.
if ProcessInfo.processInfo.environment["SWIFT_OPENAPI_STRICT_CONCURRENCY"].flatMap(Bool.init) ?? false {
swiftSettings.append(contentsOf: [
.define("SWIFT_OPENAPI_STRICT_CONCURRENCY"), .enableExperimentalFeature("StrictConcurrency"),
])
}
#endif

let package = Package(
name: "swift-openapi-generator",
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Choose one of the transports listed below, or create your own by adopting the `C
| Generator versions | Supported OpenAPI versions | Minimum Swift version |
| -------- | ------- | ----- |
| `0.1.0` ... `0.1.11` | 3.0 | 5.8 |
| `0.1.12` ... `main` | 3.0, 3.1 | 5.8 |
| `0.1.12` ... `0.3.5` | 3.0, 3.1 | 5.8 |
| `1.0.0-alpha.1` ... `main` | 3.0, 3.1 | 5.9 |

### Supported platforms and minimum versions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ Choose one of the transports listed below, or create your own by adopting the `C
| Generator versions | Supported OpenAPI versions | Minimum Swift version |
| -------- | ------- | ----- |
| `0.1.0` ... `0.1.11` | 3.0 | 5.8 |
| `0.1.12` ... `main` | 3.0, 3.1 | 5.8 |
| `0.1.12` ... `0.3.5` | 3.0, 3.1 | 5.8 |
| `1.0.0-alpha.1` ... `main` | 3.0, 3.1 | 5.9 |

See also <doc:Supported-OpenAPI-features>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ fileprivate extension CompatibilityTest {
XCTAssertNoThrow(try FileManager.default.createDirectory(at: packageDir, withIntermediateDirectories: true))
let packageSwiftPath = packageDir.appendingPathComponent("Package.swift", isDirectory: false)
let packageSwiftContents = """
// swift-tools-version:5.8
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "\(packageName)",
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG swift_version=5.8
ARG swift_version=5.9
ARG ubuntu_version=jammy
ARG base_image=swift:${swift_version}-${ubuntu_version}

Expand Down
18 changes: 0 additions & 18 deletions docker/docker-compose.2204.58.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# % docker-compose \
# -f docker/docker-compose.yaml \
# -f docker/docker-compose.2204.58.yaml \
# -f docker/docker-compose.2204.59.yaml \
# run test
#
version: "3"
Expand Down

0 comments on commit 972adfd

Please sign in to comment.