From e0a765d8555114fcc1cae8d704e1dfa2d265c448 Mon Sep 17 00:00:00 2001 From: Ryo Aoyama Date: Thu, 21 Sep 2023 17:27:27 +0900 Subject: [PATCH] Add support for Xcode 14.3.1 and drop support for lower (#79) * Update CI environment * Update dev packages * Add some docc options that newly available * Fix compilation warning * Update Swift/Xcode versions * Use smaller machine on CI * Update testing devices * Check cancellation --- .github/workflows/docs.yml | 7 ++++--- .github/workflows/test.yml | 6 +++--- Examples/App.xcodeproj/project.pbxproj | 7 ++++--- .../xcshareddata/xcschemes/iOS.xcscheme | 2 +- Makefile | 4 ++++ Package.resolved | 16 ++++++++-------- Package.swift | 8 ++++---- README.md | 4 ++-- .../Core/Loader/AsyncSequenceAtomLoader.swift | 4 +++- .../Atoms/Core/Loader/PublisherAtomLoader.swift | 4 +++- Sources/Atoms/Core/StoreContext.swift | 4 +++- .../AtomsTests/Atom/AsyncSequenceAtomTests.swift | 2 +- Tests/AtomsTests/Atom/PublisherAtomTests.swift | 2 +- scripts/swift-run.sh | 4 ++-- scripts/test.sh | 6 +++--- 15 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9fcc86cb..213ff0ce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,12 +7,13 @@ on: types: [published] workflow_dispatch: +env: + DEVELOPER_DIR: /Applications/Xcode_14.3.1.app + jobs: publish-docs: name: Publish Documentation - runs-on: macos-12 - env: - DEVELOPER_DIR: /Applications/Xcode_14.2.app + runs-on: macos-13 steps: - uses: actions/checkout@v2 - name: Build docs diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ddca8fd3..2d684d2d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,12 +10,12 @@ on: workflow_dispatch: env: - DEVELOPER_DIR: /Applications/Xcode_14.2.app + DEVELOPER_DIR: /Applications/Xcode_14.3.1.app jobs: test: name: Test - runs-on: macos-12 + runs-on: macos-13 strategy: matrix: platform: @@ -36,7 +36,7 @@ jobs: validation: name: Validation - runs-on: macos-12 + runs-on: macos-13 steps: - uses: actions/checkout@v2 - name: Show environments diff --git a/Examples/App.xcodeproj/project.pbxproj b/Examples/App.xcodeproj/project.pbxproj index 38209d8b..9e15897a 100644 --- a/Examples/App.xcodeproj/project.pbxproj +++ b/Examples/App.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -187,7 +187,8 @@ 6B590BF25178DC7D824D09CE /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1200; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1430; TargetAttributes = { 0B9FD0BB6D9928064433FF9B = { ProvisioningStyle = Manual; @@ -204,7 +205,7 @@ }; }; buildConfigurationList = B3FD05C59F197F398A0B04AB /* Build configuration list for PBXProject "App" */; - compatibilityVersion = "Xcode 11.0"; + compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( diff --git a/Examples/App.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme b/Examples/App.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme index f9d70c95..c9bb9858 100644 --- a/Examples/App.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme +++ b/Examples/App.xcodeproj/xcshareddata/xcschemes/iOS.xcscheme @@ -1,6 +1,6 @@ : RefreshableAtomL do { for try await element in sequence { - phase = .success(element) + if !Task.isCancelled { + phase = .success(element) + } } } catch { diff --git a/Sources/Atoms/Core/Loader/PublisherAtomLoader.swift b/Sources/Atoms/Core/Loader/PublisherAtomLoader.swift index c44db760..24783334 100644 --- a/Sources/Atoms/Core/Loader/PublisherAtomLoader.swift +++ b/Sources/Atoms/Core/Loader/PublisherAtomLoader.swift @@ -42,7 +42,9 @@ public struct PublisherAtomLoader: RefreshableAtomLoader { var phase = Value.suspending for await result in results { - phase = AsyncPhase(result) + if !Task.isCancelled { + phase = AsyncPhase(result) + } } return phase diff --git a/Sources/Atoms/Core/StoreContext.swift b/Sources/Atoms/Core/StoreContext.swift index 1ec996db..49b509b1 100644 --- a/Sources/Atoms/Core/StoreContext.swift +++ b/Sources/Atoms/Core/StoreContext.swift @@ -365,7 +365,9 @@ private extension StoreContext { // have not yet been updated and are still old when dependent atoms read it. // As a workaround, the update is executed in the next run loop // so that the downstream atoms can receive the object that's already updated. - RunLoop.current.perform(notifyUpdate) + RunLoop.current.perform { + notifyUpdate() + } } } diff --git a/Tests/AtomsTests/Atom/AsyncSequenceAtomTests.swift b/Tests/AtomsTests/Atom/AsyncSequenceAtomTests.swift index bf556b5c..88de325a 100644 --- a/Tests/AtomsTests/Atom/AsyncSequenceAtomTests.swift +++ b/Tests/AtomsTests/Atom/AsyncSequenceAtomTests.swift @@ -110,7 +110,7 @@ final class AsyncSequenceAtomTests: XCTestCase { let phase = await refreshTask.value - XCTAssertEqual(phase.value, 1) + XCTAssertTrue(phase.isSuspending) XCTAssertEqual(updateCount, 0) } diff --git a/Tests/AtomsTests/Atom/PublisherAtomTests.swift b/Tests/AtomsTests/Atom/PublisherAtomTests.swift index 4cad206f..cf4445a3 100644 --- a/Tests/AtomsTests/Atom/PublisherAtomTests.swift +++ b/Tests/AtomsTests/Atom/PublisherAtomTests.swift @@ -109,7 +109,7 @@ final class PublisherAtomTests: XCTestCase { let phase = await refreshTask.value - XCTAssertEqual(phase, .success(1)) + XCTAssertEqual(phase, .suspending) XCTAssertEqual(updateCount, 0) } diff --git a/scripts/swift-run.sh b/scripts/swift-run.sh index a9eda37a..c0e16987 100755 --- a/scripts/swift-run.sh +++ b/scripts/swift-run.sh @@ -3,7 +3,7 @@ set -eu function swift_build() { - SWIFTUI_ATOM_PROPERTIES_DEVELOPMENT=1 swift build -c release --only-use-versions-from-resolved-file $@ + SWIFTUI_ATOM_PROPERTIES_DEVELOPMENT=1 swift build -c release $@ } PACKAGE=$1 @@ -29,7 +29,7 @@ if [[ ! -f $BIN || $checksum != $(cat $CHECKSUM_FILE 2>/dev/null) ]]; then if [[ -e ${SWIFT_PACKAGE_RESOURCES:-} ]]; then echo "Copying $SWIFT_PACKAGE_RESOURCES..." - cp -R $SWIFT_PACKAGE_RESOURCES $BIN_DIR + cp -Rf $SWIFT_PACKAGE_RESOURCES $BIN_DIR fi echo "$checksum" >"$CHECKSUM_FILE" diff --git a/scripts/test.sh b/scripts/test.sh index e0046bff..4b6d7167 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -9,16 +9,16 @@ pushd "$(cd $(dirname $0)/.. && pwd)" &>/dev/null case $PLATFORM in ios) - platform="iOS Simulator,name=iPhone 13 Pro" + platform="iOS Simulator,name=iPhone 14 Pro" ;; macos) platform="macOS" ;; tvos) - platform="tvOS Simulator,name=Apple TV 4K (at 1080p) (2nd generation)" + platform="tvOS Simulator,name=Apple TV 4K (3rd generation)" ;; watchos) - platform="watchOS Simulator,name=Apple Watch Series 7 (45mm)" + platform="watchOS Simulator,name=Apple Watch Ultra (49mm)" ;; esac