From 917d433deb0f3ed09110e2beda2449fd7452bec1 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 10 Mar 2024 18:17:04 -0700 Subject: [PATCH] Fix several build issues. --- Account/Package.swift | 3 +- .../CloudKitArticlesZoneDelegate.swift | 1 + .../CloudKitSendStatusOperation.swift | 1 + .../Feedbin/FeedbinAccountDelegate.swift | 81 ++++++++++--------- ...eedlyIngestStreamArticleIdsOperation.swift | 1 + ...UpdateAccountFeedsWithItemsOperation.swift | 1 + .../ReaderAPI/ReaderAPIAccountDelegate.swift | 1 + Articles/Package.swift | 1 + ArticlesDatabase/Package.swift | 3 + NetNewsWire.xcodeproj/project.pbxproj | 28 +++++++ Secrets/Package.swift | 1 + Shared/SmartFeeds/SmartFeed.swift | 1 + Shared/SmartFeeds/SmartFeedDelegate.swift | 1 + Shared/Timeline/FetchRequestOperation.swift | 1 + SyncDatabase/Package.swift | 3 + 15 files changed, 91 insertions(+), 37 deletions(-) diff --git a/Account/Package.swift b/Account/Package.swift index 9d1f8c1f3..001214d39 100644 --- a/Account/Package.swift +++ b/Account/Package.swift @@ -7,7 +7,8 @@ let package = Package( products: [ .library( name: "Account", - targets: ["Account"]), + type: .dynamic, + targets: ["Account"]), ], dependencies: [ .package(url: "https://github.com/Ranchero-Software/RSCore.git", .upToNextMinor(from: "1.0.0")), diff --git a/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift b/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift index 96ac57b5b..a5462e036 100644 --- a/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift +++ b/Account/Sources/Account/CloudKit/CloudKitArticlesZoneDelegate.swift @@ -15,6 +15,7 @@ import CloudKit import SyncDatabase import Articles import ArticlesDatabase +import Database class CloudKitArticlesZoneDelegate: CloudKitZoneDelegate { diff --git a/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift b/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift index ff1ddb344..dc997a23c 100644 --- a/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift +++ b/Account/Sources/Account/CloudKit/CloudKitSendStatusOperation.swift @@ -12,6 +12,7 @@ import os.log import RSCore import RSWeb import SyncDatabase +import Database class CloudKitSendStatusOperation: MainThreadOperation { diff --git a/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift b/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift index 6041660cd..1ac8e0d6f 100644 --- a/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift @@ -1163,54 +1163,63 @@ private extension FeedbinAccountDelegate { os_log(.debug, log: log, "Refreshing missing articles...") account.fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate { result in - - func process(_ fetchedArticleIDs: Set) { - let group = DispatchGroup() - var errorOccurred = false - - let articleIDs = Array(fetchedArticleIDs) - let chunkedArticleIDs = articleIDs.chunked(into: 100) - for chunk in chunkedArticleIDs { - group.enter() - self.caller.retrieveEntries(articleIDs: chunk) { result in + Task { @MainActor in - switch result { - case .success(let entries): + @MainActor func process(_ fetchedArticleIDs: Set) { + let group = DispatchGroup() + var errorOccurred = false - self.processEntries(account: account, entries: entries) { error in - group.leave() - if error != nil { - errorOccurred = true + let articleIDs = Array(fetchedArticleIDs) + let chunkedArticleIDs = articleIDs.chunked(into: 100) + + for chunk in chunkedArticleIDs { + group.enter() + self.caller.retrieveEntries(articleIDs: chunk) { result in + + switch result { + case .success(let entries): + + self.processEntries(account: account, entries: entries) { error in + + Task { @MainActor in + + group.leave() + if error != nil { + errorOccurred = true + } + } } - } - case .failure(let error): - errorOccurred = true - os_log(.error, log: self.log, "Refresh missing articles failed: %@.", error.localizedDescription) - group.leave() + case .failure(let error): + errorOccurred = true + os_log(.error, log: self.log, "Refresh missing articles failed: %@.", error.localizedDescription) + group.leave() + } + } + } + + group.notify(queue: DispatchQueue.main) { + Task { @MainActor in + self.refreshProgress.completeTask() + os_log(.debug, log: self.log, "Done refreshing missing articles.") + if errorOccurred { + completion(.failure(FeedbinAccountDelegateError.unknown)) + } else { + completion(.success(())) + } } } } - group.notify(queue: DispatchQueue.main) { + switch result { + case .success(let fetchedArticleIDs): + process(fetchedArticleIDs) + case .failure(let error): self.refreshProgress.completeTask() - os_log(.debug, log: self.log, "Done refreshing missing articles.") - if errorOccurred { - completion(.failure(FeedbinAccountDelegateError.unknown)) - } else { - completion(.success(())) - } + completion(.failure(error)) } } - - switch result { - case .success(let fetchedArticleIDs): - process(fetchedArticleIDs) - case .failure(let error): - self.refreshProgress.completeTask() - completion(.failure(error)) - } } } diff --git a/Account/Sources/Account/Feedly/Operations/FeedlyIngestStreamArticleIdsOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlyIngestStreamArticleIdsOperation.swift index 02dc9af61..0e077f8c7 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlyIngestStreamArticleIdsOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlyIngestStreamArticleIdsOperation.swift @@ -9,6 +9,7 @@ import Foundation import os.log import Secrets +import Database /// Ensure a status exists for every article id the user might be interested in. /// diff --git a/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift b/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift index ea8dcace4..9c597ca12 100644 --- a/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift +++ b/Account/Sources/Account/Feedly/Operations/FeedlyUpdateAccountFeedsWithItemsOperation.swift @@ -9,6 +9,7 @@ import Foundation import RSParser import os.log +import Database /// Combine the articles with their feeds for a specific account. final class FeedlyUpdateAccountFeedsWithItemsOperation: FeedlyOperation { diff --git a/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift b/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift index bc3743c99..df810c095 100644 --- a/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift +++ b/Account/Sources/Account/ReaderAPI/ReaderAPIAccountDelegate.swift @@ -13,6 +13,7 @@ import RSWeb import SyncDatabase import os.log import Secrets +import Database public enum ReaderAPIAccountDelegateError: LocalizedError { case unknown diff --git a/Articles/Package.swift b/Articles/Package.swift index 0861d37cb..b62dad2c0 100644 --- a/Articles/Package.swift +++ b/Articles/Package.swift @@ -7,6 +7,7 @@ let package = Package( products: [ .library( name: "Articles", + type: .dynamic, targets: ["Articles"]), ], dependencies: [ diff --git a/ArticlesDatabase/Package.swift b/ArticlesDatabase/Package.swift index 0e307c7af..3ae04aa01 100644 --- a/ArticlesDatabase/Package.swift +++ b/ArticlesDatabase/Package.swift @@ -12,6 +12,7 @@ var dependencies: [Package.Dependency] = [ dependencies.append(contentsOf: [ .package(path: "../Articles"), .package(path: "../Database"), + .package(path: "../FMDB"), ]) #else dependencies.append(contentsOf: [ @@ -25,6 +26,7 @@ let package = Package( products: [ .library( name: "ArticlesDatabase", + type: .dynamic, targets: ["ArticlesDatabase"]), ], dependencies: dependencies, @@ -36,6 +38,7 @@ let package = Package( "Database", "RSParser", "Articles", + "FMDB", ]), ] ) diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 155cf3a60..63f219054 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -661,6 +661,8 @@ 847120D92B8AE6AF00BBFC34 /* UTType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847120D62B8AE6AF00BBFC34 /* UTType+Extensions.swift */; }; 8472058120142E8900AD578B /* FeedInspectorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8472058020142E8900AD578B /* FeedInspectorViewController.swift */; }; 8477ACBE22238E9500DF7F37 /* SearchFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8477ACBD22238E9500DF7F37 /* SearchFeedDelegate.swift */; }; + 8479ABE32B9E906E00F84C4D /* Database in Frameworks */ = {isa = PBXBuildFile; productRef = 8479ABE22B9E906E00F84C4D /* Database */; }; + 8479ABE52B9E907400F84C4D /* FMDB in Frameworks */ = {isa = PBXBuildFile; productRef = 8479ABE42B9E907400F84C4D /* FMDB */; }; 847CD6CA232F4CBF00FAC46D /* IconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847CD6C9232F4CBF00FAC46D /* IconView.swift */; }; 847E64A02262783000E00365 /* NSAppleEventDescriptor+UserRecordFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847E64942262782F00E00365 /* NSAppleEventDescriptor+UserRecordFields.swift */; }; 848362FF2262A30E00DA1D35 /* template.html in Resources */ = {isa = PBXBuildFile; fileRef = 848362FE2262A30E00DA1D35 /* template.html */; }; @@ -668,6 +670,8 @@ 848363052262A3CC00DA1D35 /* AddFolderSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 848363032262A3CC00DA1D35 /* AddFolderSheet.xib */; }; 848363082262A3DD00DA1D35 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 848363062262A3DD00DA1D35 /* Main.storyboard */; }; 8483630B2262A3F000DA1D35 /* RenameSheet.xib in Resources */ = {isa = PBXBuildFile; fileRef = 848363092262A3F000DA1D35 /* RenameSheet.xib */; }; + 8485654F2B9E90FD00F4BAE0 /* Database in Frameworks */ = {isa = PBXBuildFile; productRef = 8485654E2B9E90FD00F4BAE0 /* Database */; }; + 848565512B9E910200F4BAE0 /* FMDB in Frameworks */ = {isa = PBXBuildFile; productRef = 848565502B9E910200F4BAE0 /* FMDB */; }; 848B937221C8C5540038DC0D /* CrashReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848B937121C8C5540038DC0D /* CrashReporter.swift */; }; 848D578E21543519005FFAD5 /* PasteboardFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848D578D21543519005FFAD5 /* PasteboardFeed.swift */; }; 848F6AE51FC29CFB002D422E /* FaviconDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848F6AE41FC29CFA002D422E /* FaviconDownloader.swift */; }; @@ -1617,6 +1621,8 @@ 51E4DB082425F9EB0091EB5B /* CloudKit.framework in Frameworks */, 513F32742593EE6F0003048F /* ArticlesDatabase in Frameworks */, 513F327A2593EE6F0003048F /* SyncDatabase in Frameworks */, + 848565512B9E910200F4BAE0 /* FMDB in Frameworks */, + 8485654F2B9E90FD00F4BAE0 /* Database in Frameworks */, 5138E93A24D33E5600AFF0FE /* RSTree in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1630,6 +1636,7 @@ 51A737C524DB19B50015FA66 /* RSWeb in Frameworks */, 514C16DE24D2EF15009A3AFA /* RSTree in Frameworks */, 5132775E2590FC640064F1E7 /* Articles in Frameworks */, + 8479ABE32B9E906E00F84C4D /* Database in Frameworks */, 513277612590FC640064F1E7 /* ArticlesDatabase in Frameworks */, 51C4CFF624D37DD500AF9874 /* Secrets in Frameworks */, 51A737AE24DB19730015FA66 /* RSCore in Frameworks */, @@ -1637,6 +1644,7 @@ 179C39EA26F76B0500D4E741 /* Zip in Frameworks */, 51E4DAED2425F6940091EB5B /* CloudKit.framework in Frameworks */, 514C16E124D2EF38009A3AFA /* RSCoreResources in Frameworks */, + 8479ABE52B9E907400F84C4D /* FMDB in Frameworks */, 514C16CE24D2E63F009A3AFA /* Account in Frameworks */, 519CA8E525841DB700EB079A /* CrashReporter in Frameworks */, ); @@ -2975,6 +2983,8 @@ 513F32762593EE6F0003048F /* Secrets */, 513F32792593EE6F0003048F /* SyncDatabase */, 179D280A26F6F93D003B2E0A /* Zip */, + 8485654E2B9E90FD00F4BAE0 /* Database */, + 848565502B9E910200F4BAE0 /* FMDB */, ); productName = "NetNewsWire-iOS"; productReference = 840D617C2029031C009BC708 /* NetNewsWire.app */; @@ -3016,6 +3026,8 @@ 513277602590FC640064F1E7 /* ArticlesDatabase */, 513277632590FC640064F1E7 /* SyncDatabase */, 179C39E926F76B0500D4E741 /* Zip */, + 8479ABE22B9E906E00F84C4D /* Database */, + 8479ABE42B9E907400F84C4D /* FMDB */, ); productName = NetNewsWire; productReference = 849C64601ED37A5D003D8FC0 /* NetNewsWire.app */; @@ -5017,6 +5029,22 @@ package = 653813412680E2DA007A082C /* XCRemoteSwiftPackageReference "RSCore" */; productName = RSCore; }; + 8479ABE22B9E906E00F84C4D /* Database */ = { + isa = XCSwiftPackageProductDependency; + productName = Database; + }; + 8479ABE42B9E907400F84C4D /* FMDB */ = { + isa = XCSwiftPackageProductDependency; + productName = FMDB; + }; + 8485654E2B9E90FD00F4BAE0 /* Database */ = { + isa = XCSwiftPackageProductDependency; + productName = Database; + }; + 848565502B9E910200F4BAE0 /* FMDB */ = { + isa = XCSwiftPackageProductDependency; + productName = FMDB; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 849C64581ED37A5D003D8FC0 /* Project object */; diff --git a/Secrets/Package.swift b/Secrets/Package.swift index fb86119be..a85d30e9c 100644 --- a/Secrets/Package.swift +++ b/Secrets/Package.swift @@ -7,6 +7,7 @@ let package = Package( products: [ .library( name: "Secrets", + type: .dynamic, targets: ["Secrets"] ) ], diff --git a/Shared/SmartFeeds/SmartFeed.swift b/Shared/SmartFeeds/SmartFeed.swift index c5bba3244..88e1af3f5 100644 --- a/Shared/SmartFeeds/SmartFeed.swift +++ b/Shared/SmartFeeds/SmartFeed.swift @@ -11,6 +11,7 @@ import RSCore import Articles import ArticlesDatabase import Account +import Database final class SmartFeed: PseudoFeed { diff --git a/Shared/SmartFeeds/SmartFeedDelegate.swift b/Shared/SmartFeeds/SmartFeedDelegate.swift index 7f37a2ae6..d634df341 100644 --- a/Shared/SmartFeeds/SmartFeedDelegate.swift +++ b/Shared/SmartFeeds/SmartFeedDelegate.swift @@ -11,6 +11,7 @@ import Account import Articles import ArticlesDatabase import RSCore +import Database protocol SmartFeedDelegate: SidebarItemIdentifiable, DisplayNameProvider, ArticleFetcher, SmallIconProvider { var fetchType: FetchType { get } diff --git a/Shared/Timeline/FetchRequestOperation.swift b/Shared/Timeline/FetchRequestOperation.swift index bfaab1439..8195755c9 100644 --- a/Shared/Timeline/FetchRequestOperation.swift +++ b/Shared/Timeline/FetchRequestOperation.swift @@ -10,6 +10,7 @@ import Foundation import RSCore import Account import Articles +import Database // Main thread only. // Runs an asynchronous fetch. diff --git a/SyncDatabase/Package.swift b/SyncDatabase/Package.swift index 6852d9605..1380b8804 100644 --- a/SyncDatabase/Package.swift +++ b/SyncDatabase/Package.swift @@ -9,6 +9,7 @@ var dependencies: [Package.Dependency] = [ dependencies.append(contentsOf: [ .package(path: "../Articles"), .package(path: "../Database"), + .package(path: "../FMDB"), ]) #else dependencies.append(contentsOf: [ @@ -22,6 +23,7 @@ let package = Package( products: [ .library( name: "SyncDatabase", + type: .dynamic, targets: ["SyncDatabase"]), ], dependencies: dependencies, @@ -32,6 +34,7 @@ let package = Package( "RSCore", "Database", "Articles", + "FMDB" ], swiftSettings: [ .enableExperimentalFeature("StrictConcurrency")