From 74fd8f02784ad0c1c82ed66c92600f8c2b5b98bc Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 6 Jan 2025 13:24:36 -0800 Subject: [PATCH 1/4] Swift 5.9 fixes/CI Since the package supports 5.9, lets ensure we have coverage. --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3a2433..7d67f07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,3 +58,17 @@ jobs: - name: Build run: swift build --swift-sdk wasm32-unknown-wasi -Xlinker -z -Xlinker stack-size=$((1024 * 1024)) + + compatibility: + name: Compatibility + strategy: + matrix: + xcode: ['15.2'] + config: ['debug', 'release'] + runs-on: macos-14 + steps: + - uses: actions/checkout@v4 + - name: Select Xcode ${{ matrix.xcode }} + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app + - name: Run ${{ matrix.config }} tests + run: swift test -c ${{ matrix.config }} From 8e0517739b2aa3d3a14046d081c7564e23a3f7ca Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 6 Jan 2025 13:26:40 -0800 Subject: [PATCH 2/4] 5.9 fixes --- Sources/Sharing/SharedContinuations.swift | 2 +- Sources/Sharing/SharedKeys/FileStorageKey.swift | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Sharing/SharedContinuations.swift b/Sources/Sharing/SharedContinuations.swift index 7cc5916..4d1ae70 100644 --- a/Sources/Sharing/SharedContinuations.swift +++ b/Sources/Sharing/SharedContinuations.swift @@ -209,7 +209,7 @@ private final class ContinuationBox: Sendable { } deinit { - let isComplete = resumeCount.withLock(\.self) > 0 + let isComplete = resumeCount.withLock { $0 } > 0 if !isComplete { reportIssue( """ diff --git a/Sources/Sharing/SharedKeys/FileStorageKey.swift b/Sources/Sharing/SharedKeys/FileStorageKey.swift index dd2e065..810417d 100644 --- a/Sources/Sharing/SharedKeys/FileStorageKey.swift +++ b/Sources/Sharing/SharedKeys/FileStorageKey.swift @@ -132,7 +132,7 @@ guard let self else { return } state.withValue { state in let modificationDate = - (try? storage.attributesOfItemAtPath(url.path)[.modificationDate] + (try? self.storage.attributesOfItemAtPath(self.url.path)[.modificationDate] as? Date) ?? Date.distantPast guard @@ -145,7 +145,7 @@ guard state.workItem == nil else { return } - subscriber.yield(with: Result { try decode(storage.load(url)) }) + subscriber.yield(with: Result { try self.decode(self.storage.load(self.url)) }) } } let deleteCancellable = try storage.fileSystemSource(url, [.delete, .rename]) { @@ -199,12 +199,12 @@ } guard let value = state.value, - let data = try? encode(value) + let data = try? self.encode(value) else { return } let result = Result { - try save( + try self.save( data: data, - url: url, + url: self.url, modificationDates: &state.modificationDates ) } From eef498d8c0fa7cc7cb1a80ac4515ed0123e0a6ea Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 6 Jan 2025 13:54:15 -0800 Subject: [PATCH 3/4] fix --- Examples/GRDBDemo/FetchKey.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/GRDBDemo/FetchKey.swift b/Examples/GRDBDemo/FetchKey.swift index fe6d37c..987ebc2 100644 --- a/Examples/GRDBDemo/FetchKey.swift +++ b/Examples/GRDBDemo/FetchKey.swift @@ -56,7 +56,7 @@ extension DependencyValues { static var testValue: any DatabaseWriter { reportIssue( """ - A blank, in-memory database is being used. To set the database that is used by the 'query' \ + A blank, in-memory database is being used. To set the database that is used by the 'fetch' \ key you can use the 'prepareDependencies' tool as soon as your app launches, such as in \ your app or scene delegate in UIKit, or the app entry point in SwiftUI: From 32c7550d1407319065e2dd6fd0d922f8b1e71704 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Mon, 6 Jan 2025 15:59:05 -0800 Subject: [PATCH 4/4] wip --- .github/workflows/ci.yml | 2 +- Sources/Sharing/Internal/Reference.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d67f07..13a0ba1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,4 +71,4 @@ jobs: - name: Select Xcode ${{ matrix.xcode }} run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app - name: Run ${{ matrix.config }} tests - run: swift test -c ${{ matrix.config }} + run: swift build -c ${{ matrix.config }} diff --git a/Sources/Sharing/Internal/Reference.swift b/Sources/Sharing/Internal/Reference.swift index 7583688..018b40c 100644 --- a/Sources/Sharing/Internal/Reference.swift +++ b/Sources/Sharing/Internal/Reference.swift @@ -420,7 +420,7 @@ extension _PersistentReference: MutableReference, Equatable where Key: SharedKey func save() async throws { saveError = nil do { - try await withUnsafeThrowingContinuation { continuation in + _ = try await withUnsafeThrowingContinuation { continuation in let key = key key.save( lock.withLock { value },