From 93915e3574aa16c5335cd3560a88c8983bb0c075 Mon Sep 17 00:00:00 2001 From: Florian Friedrich Date: Wed, 18 Sep 2024 15:16:18 +0200 Subject: [PATCH] Add Swift 6.0 support --- .github/workflows/docs.yml | 2 +- .github/workflows/swift-test.yml | 8 ++-- Package.swift | 12 ++---- Package@swift-5.10.swift | 41 +++++++++++++++++++ Package@swift-5.9.swift | 2 +- .../Scope+CustomStringConvertible.swift | 5 +++ 6 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 Package@swift-5.10.swift diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 606b746..5d2ce86 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-generate-and-publish-docs.yml@main with: os: ubuntu - swift-version: '5.10' + swift-version: '6.0' organisation: ${{ github.repository_owner }} repository: ${{ github.event.repository.name }} pages-branch: gh-pages diff --git a/.github/workflows/swift-test.yml b/.github/workflows/swift-test.yml index 8c12b26..497bdd8 100644 --- a/.github/workflows/swift-test.yml +++ b/.github/workflows/swift-test.yml @@ -12,10 +12,10 @@ permissions: jobs: variables: outputs: - max-supported-swift-version: '5.10' + max-supported-swift-version: '6.0' xcode-scheme: auth-scope xcode-platform-version: latest - fail-if-codecov-fails: true + fail-if-codecov-fails: 'true' runs-on: ubuntu-latest steps: - run: exit 0 @@ -25,7 +25,7 @@ jobs: strategy: matrix: os: [ macOS, ubuntu ] - swift-version-offset: [ 0, 1 ] + swift-version-offset: [ 0, 1, 2 ] uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-spm.yml@main with: os: ${{ matrix.os }} @@ -46,7 +46,7 @@ jobs: - tvOS - watchOS - visionOS - swift-version-offset: [ 0, 1 ] + swift-version-offset: [ 0, 1, 2 ] uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-xcode.yml@main with: xcode-scheme: ${{ needs.variables.outputs.xcode-scheme }} diff --git a/Package.swift b/Package.swift index 822b25d..5352168 100644 --- a/Package.swift +++ b/Package.swift @@ -1,19 +1,13 @@ -// swift-tools-version:5.10 +// swift-tools-version:6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let swiftSettings: Array = [ - .enableUpcomingFeature("ConciseMagicFile"), + .swiftLanguageMode(.v6), .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("BareSlashRegexLiterals"), - .enableUpcomingFeature("DisableOutwardActorInference"), - .enableUpcomingFeature("IsolatedDefaultValues"), - .enableUpcomingFeature("DeprecateApplicationMain"), - .enableExperimentalFeature("StrictConcurrency"), + .enableUpcomingFeature("InternalImportsByDefault"), .enableExperimentalFeature("GlobalConcurrency"), -// .enableExperimentalFeature("AccessLevelOnImport"), -// .enableExperimentalFeature("VariadicGenerics"), ] let package = Package( diff --git a/Package@swift-5.10.swift b/Package@swift-5.10.swift new file mode 100644 index 0000000..ace12d9 --- /dev/null +++ b/Package@swift-5.10.swift @@ -0,0 +1,41 @@ +// swift-tools-version:5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let swiftSettings: Array = [ + .enableUpcomingFeature("ConciseMagicFile"), + .enableUpcomingFeature("ExistentialAny"), + .enableUpcomingFeature("BareSlashRegexLiterals"), + .enableUpcomingFeature("DisableOutwardActorInference"), + .enableUpcomingFeature("IsolatedDefaultValues"), + .enableUpcomingFeature("DeprecateApplicationMain"), + .enableExperimentalFeature("StrictConcurrency"), + .enableExperimentalFeature("GlobalConcurrency"), + .enableExperimentalFeature("AccessLevelOnImport"), +// .enableExperimentalFeature("VariadicGenerics"), +] + +let package = Package( + name: "auth-scope", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "AuthScope", + targets: ["AuthScope"]), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target( + name: "AuthScope", + swiftSettings: swiftSettings), + .testTarget( + name: "AuthScopeTests", + dependencies: ["AuthScope"], + swiftSettings: swiftSettings), + ] +) diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift index eb59944..65ef87f 100644 --- a/Package@swift-5.9.swift +++ b/Package@swift-5.9.swift @@ -9,7 +9,7 @@ let swiftSettings: Array = [ .enableUpcomingFeature("BareSlashRegexLiterals"), .enableUpcomingFeature("DisableOutwardActorInference"), .enableExperimentalFeature("StrictConcurrency"), -// .enableExperimentalFeature("AccessLevelOnImport"), + .enableExperimentalFeature("AccessLevelOnImport"), // .enableExperimentalFeature("VariadicGenerics"), ] diff --git a/Sources/AuthScope/Scope+CustomStringConvertible.swift b/Sources/AuthScope/Scope+CustomStringConvertible.swift index 02b2c53..b39bc91 100644 --- a/Sources/AuthScope/Scope+CustomStringConvertible.swift +++ b/Sources/AuthScope/Scope+CustomStringConvertible.swift @@ -7,3 +7,8 @@ extension Scope: CustomStringConvertible, CustomDebugStringConvertible { "Scope<\(AccessRange.self)> { \(accessRanges.lazy.map(\.rawValue).sorted().joined(separator: ", ")) }" } } + +#if swift(>=6.0) +@DebugDescription +extension Scope {} +#endif