From 8ac581c2a9feea834a69f80d25581ca53fb76312 Mon Sep 17 00:00:00 2001 From: Paul Kraft Date: Fri, 3 May 2024 20:00:34 +0200 Subject: [PATCH 1/4] Enable Strict Concurrency Checking --- Package.swift | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 4dd409a3..5b63f45b 100644 --- a/Package.swift +++ b/Package.swift @@ -10,6 +10,15 @@ import PackageDescription +#if swift(<6) +let swiftSettings: [SwiftSetting] = [ + .enableExperimentalFeature("SwiftConcurrency") +] +#else +let swiftSettings: [SwiftSetting] = [ + .enableUpcomingFeature("SwiftConcurrency") +] +#endif let package = Package( name: "Spezi", @@ -35,13 +44,15 @@ let package = Package( dependencies: [ .product(name: "SpeziFoundation", package: "SpeziFoundation"), .product(name: "XCTRuntimeAssertions", package: "XCTRuntimeAssertions") - ] + ], + swiftSettings: swiftSettings ), .target( name: "XCTSpezi", dependencies: [ .target(name: "Spezi") - ] + ], + swiftSettings: swiftSettings ), .testTarget( name: "SpeziTests", @@ -49,7 +60,8 @@ let package = Package( .target(name: "Spezi"), .target(name: "XCTSpezi"), .product(name: "XCTRuntimeAssertions", package: "XCTRuntimeAssertions") - ] + ], + swiftSettings: swiftSettings ) ] ) From cada96dfbbc84fced0bf9d67467670aa7d69a9b4 Mon Sep 17 00:00:00 2001 From: Paul Kraft Date: Mon, 6 May 2024 12:35:24 +0200 Subject: [PATCH 2/4] Set SWIFT_STRICT_CONCURRENCY to complete for all targets of UITests.xcodeproj --- Tests/UITests/UITests.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Tests/UITests/UITests.xcodeproj/project.pbxproj b/Tests/UITests/UITests.xcodeproj/project.pbxproj index ea344483..11b5300b 100644 --- a/Tests/UITests/UITests.xcodeproj/project.pbxproj +++ b/Tests/UITests/UITests.xcodeproj/project.pbxproj @@ -398,6 +398,7 @@ SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = complete; TVOS_DEPLOYMENT_TARGET = 17.0; XROS_DEPLOYMENT_TARGET = 1.0; }; @@ -456,6 +457,7 @@ SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_STRICT_CONCURRENCY = complete; TVOS_DEPLOYMENT_TARGET = 17.0; VALIDATE_PRODUCT = YES; XROS_DEPLOYMENT_TARGET = 1.0; @@ -553,6 +555,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,7"; TEST_TARGET_NAME = TestApp; @@ -578,6 +581,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_STRICT_CONCURRENCY = complete; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3,7"; TEST_TARGET_NAME = TestApp; From c4ff2137009480fddc7ea485af62d1a882a0ff86 Mon Sep 17 00:00:00 2001 From: Paul Kraft Date: Tue, 14 May 2024 16:53:29 +0200 Subject: [PATCH 3/4] Specify warningsAsErrors to true by using the github actions introduced in the feature/warnings-as-errors branch --- .github/workflows/build-and-test.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e63c38c0..1df6b6d5 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -18,60 +18,66 @@ on: jobs: buildandtest_ios: name: Build and Test Swift Package iOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' scheme: Spezi-Package resultBundle: Spezi-Package-iOS.xcresult artifactname: Spezi-Package-iOS.xcresult + warningsAsErrors: true buildandtest_watchos: name: Build and Test Swift Package watchOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' scheme: Spezi-Package destination: 'platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)' resultBundle: Spezi-Package-watchOS.xcresult artifactname: Spezi-Package-watchOS.xcresult + warningsAsErrors: true buildandtest_visionos: name: Build and Test Swift Package visionOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' scheme: Spezi-Package destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: Spezi-Package-visionOS.xcresult artifactname: Spezi-Package-visionOS.xcresult + warningsAsErrors: true buildandtest_tvos: name: Build and Test Swift Package tvOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' scheme: Spezi-Package destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation)' resultBundle: Spezi-Package-tvOS.xcresult artifactname: Spezi-Package-tvOS.xcresult + warningsAsErrors: true buildandtest_macos: name: Build and Test Swift Package macOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' scheme: Spezi-Package destination: 'platform=macOS,arch=arm64' resultBundle: Spezi-Package-macOS.xcresult artifactname: Spezi-Package-macOS.xcresult + warningsAsErrors: true buildandtestuitests_ios: name: Build and Test UI Tests iOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' path: Tests/UITests scheme: TestApp resultBundle: TestApp-iOS.xcresult artifactname: TestApp-iOS.xcresult + warningsAsErrors: true buildandtestuitests_visionos: name: Build and Test UI Tests visionOS - uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@feature/warnings-as-errors with: runsonlabels: '["macOS", "self-hosted"]' path: Tests/UITests @@ -79,9 +85,10 @@ jobs: destination: 'platform=visionOS Simulator,name=Apple Vision Pro' resultBundle: TestApp-visionOS.xcresult artifactname: TestApp-visionOS.xcresult + warningsAsErrors: true uploadcoveragereport: name: Upload Coverage Report needs: [buildandtest_ios, buildandtest_watchos, buildandtest_visionos, buildandtest_tvos, buildandtest_macos, buildandtestuitests_ios, buildandtestuitests_visionos] - uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2 + uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@feature/warnings-as-errors with: coveragereports: Spezi-Package-iOS.xcresult Spezi-Package-watchOS.xcresult Spezi-Package-visionOS.xcresult Spezi-Package-tvOS.xcresult Spezi-Package-macOS.xcresult TestApp-iOS.xcresult TestApp-visionOS.xcresult From 928d808f7835cee335a1ff101a1735fd98ece97c Mon Sep 17 00:00:00 2001 From: Paul Kraft Date: Tue, 14 May 2024 17:26:58 +0200 Subject: [PATCH 4/4] Add empty line after import statements --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 5b63f45b..580151f0 100644 --- a/Package.swift +++ b/Package.swift @@ -10,6 +10,7 @@ import PackageDescription + #if swift(<6) let swiftSettings: [SwiftSetting] = [ .enableExperimentalFeature("SwiftConcurrency")