From 958138e7013a1a48fe0333546b5ecc46fbbd3443 Mon Sep 17 00:00:00 2001 From: Chris Brind Date: Thu, 7 Mar 2024 12:59:31 +0000 Subject: [PATCH] move suggestions to its own package --- Package.swift | 18 ++++++++++++++++++ .../Suggestions/APIResult.swift | 0 .../Suggestions/Bookmark.swift | 0 .../Suggestions/HistorySuggestion.swift | 0 .../Suggestions/Query.swift | 0 .../Suggestions/Score.swift | 0 .../Suggestions/Suggestion.swift | 0 .../Suggestions/SuggestionLoading.swift | 0 .../Suggestions/SuggestionProcessing.swift | 0 .../Suggestions/SuggestionResult.swift | 0 .../APIResultTests.swift | 2 +- .../BookmarkMock.swift | 2 +- .../HistoryEntryMock.swift | 2 +- .../ScoreTests.swift | 2 +- .../SuggestionLoadingTests.swift | 2 +- .../SuggestionProcessingTests.swift | 2 +- .../SuggestionResultTests.swift | 2 +- .../SuggestionTests.swift | 2 +- 18 files changed, 26 insertions(+), 8 deletions(-) rename Sources/{BrowserServicesKit => }/Suggestions/APIResult.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/Bookmark.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/HistorySuggestion.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/Query.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/Score.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/Suggestion.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/SuggestionLoading.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/SuggestionProcessing.swift (100%) rename Sources/{BrowserServicesKit => }/Suggestions/SuggestionResult.swift (100%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/APIResultTests.swift (98%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/BookmarkMock.swift (95%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/HistoryEntryMock.swift (96%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/ScoreTests.swift (98%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/SuggestionLoadingTests.swift (99%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/SuggestionProcessingTests.swift (98%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/SuggestionResultTests.swift (96%) rename Tests/{BrowserServicesKitTests/Suggestions => SuggestionsTests}/SuggestionTests.swift (99%) diff --git a/Package.swift b/Package.swift index 8666d3c1d..2bd4896ef 100644 --- a/Package.swift +++ b/Package.swift @@ -35,6 +35,7 @@ let package = Package( .library(name: "SecureStorage", targets: ["SecureStorage"]), .library(name: "Subscription", targets: ["Subscription"]), .library(name: "History", targets: ["History"]), + .library(name: "Suggestions", targets: ["Suggestions"]), ], dependencies: [ .package(url: "https://github.com/duckduckgo/duckduckgo-autofill.git", exact: "10.1.0"), @@ -112,6 +113,16 @@ let package = Package( ], plugins: [swiftlintPlugin] ), + .target( + name: "Suggestions", + dependencies: [ + "Common" + ], + swiftSettings: [ + .define("DEBUG", .when(configuration: .debug)) + ], + plugins: [swiftlintPlugin] + ), .executableTarget( name: "BookmarksTestDBBuilder", dependencies: [ @@ -340,6 +351,13 @@ let package = Package( ], plugins: [swiftlintPlugin] ), + .testTarget( + name: "SuggestionsTests", + dependencies: [ + "Suggestions", + ], + plugins: [swiftlintPlugin] + ), .testTarget( name: "BookmarksTests", dependencies: [ diff --git a/Sources/BrowserServicesKit/Suggestions/APIResult.swift b/Sources/Suggestions/APIResult.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/APIResult.swift rename to Sources/Suggestions/APIResult.swift diff --git a/Sources/BrowserServicesKit/Suggestions/Bookmark.swift b/Sources/Suggestions/Bookmark.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/Bookmark.swift rename to Sources/Suggestions/Bookmark.swift diff --git a/Sources/BrowserServicesKit/Suggestions/HistorySuggestion.swift b/Sources/Suggestions/HistorySuggestion.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/HistorySuggestion.swift rename to Sources/Suggestions/HistorySuggestion.swift diff --git a/Sources/BrowserServicesKit/Suggestions/Query.swift b/Sources/Suggestions/Query.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/Query.swift rename to Sources/Suggestions/Query.swift diff --git a/Sources/BrowserServicesKit/Suggestions/Score.swift b/Sources/Suggestions/Score.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/Score.swift rename to Sources/Suggestions/Score.swift diff --git a/Sources/BrowserServicesKit/Suggestions/Suggestion.swift b/Sources/Suggestions/Suggestion.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/Suggestion.swift rename to Sources/Suggestions/Suggestion.swift diff --git a/Sources/BrowserServicesKit/Suggestions/SuggestionLoading.swift b/Sources/Suggestions/SuggestionLoading.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/SuggestionLoading.swift rename to Sources/Suggestions/SuggestionLoading.swift diff --git a/Sources/BrowserServicesKit/Suggestions/SuggestionProcessing.swift b/Sources/Suggestions/SuggestionProcessing.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/SuggestionProcessing.swift rename to Sources/Suggestions/SuggestionProcessing.swift diff --git a/Sources/BrowserServicesKit/Suggestions/SuggestionResult.swift b/Sources/Suggestions/SuggestionResult.swift similarity index 100% rename from Sources/BrowserServicesKit/Suggestions/SuggestionResult.swift rename to Sources/Suggestions/SuggestionResult.swift diff --git a/Tests/BrowserServicesKitTests/Suggestions/APIResultTests.swift b/Tests/SuggestionsTests/APIResultTests.swift similarity index 98% rename from Tests/BrowserServicesKitTests/Suggestions/APIResultTests.swift rename to Tests/SuggestionsTests/APIResultTests.swift index e9b8b5e13..2bd57ea53 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/APIResultTests.swift +++ b/Tests/SuggestionsTests/APIResultTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class APIResultTests: XCTestCase { diff --git a/Tests/BrowserServicesKitTests/Suggestions/BookmarkMock.swift b/Tests/SuggestionsTests/BookmarkMock.swift similarity index 95% rename from Tests/BrowserServicesKitTests/Suggestions/BookmarkMock.swift rename to Tests/SuggestionsTests/BookmarkMock.swift index 8ff102aa3..4e45133a8 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/BookmarkMock.swift +++ b/Tests/SuggestionsTests/BookmarkMock.swift @@ -17,7 +17,7 @@ // import Foundation -@testable import BrowserServicesKit +@testable import Suggestions struct BookmarkMock: Bookmark { diff --git a/Tests/BrowserServicesKitTests/Suggestions/HistoryEntryMock.swift b/Tests/SuggestionsTests/HistoryEntryMock.swift similarity index 96% rename from Tests/BrowserServicesKitTests/Suggestions/HistoryEntryMock.swift rename to Tests/SuggestionsTests/HistoryEntryMock.swift index 80b8ef405..9ee160608 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/HistoryEntryMock.swift +++ b/Tests/SuggestionsTests/HistoryEntryMock.swift @@ -18,7 +18,7 @@ import Foundation -@testable import BrowserServicesKit +@testable import Suggestions struct HistoryEntryMock: HistorySuggestion { diff --git a/Tests/BrowserServicesKitTests/Suggestions/ScoreTests.swift b/Tests/SuggestionsTests/ScoreTests.swift similarity index 98% rename from Tests/BrowserServicesKitTests/Suggestions/ScoreTests.swift rename to Tests/SuggestionsTests/ScoreTests.swift index 0a10c12a2..5aceab89b 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/ScoreTests.swift +++ b/Tests/SuggestionsTests/ScoreTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class ScoreTests: XCTestCase { diff --git a/Tests/BrowserServicesKitTests/Suggestions/SuggestionLoadingTests.swift b/Tests/SuggestionsTests/SuggestionLoadingTests.swift similarity index 99% rename from Tests/BrowserServicesKitTests/Suggestions/SuggestionLoadingTests.swift rename to Tests/SuggestionsTests/SuggestionLoadingTests.swift index eee9fef40..4a4f74b28 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/SuggestionLoadingTests.swift +++ b/Tests/SuggestionsTests/SuggestionLoadingTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class SuggestionLoadingTests: XCTestCase { diff --git a/Tests/BrowserServicesKitTests/Suggestions/SuggestionProcessingTests.swift b/Tests/SuggestionsTests/SuggestionProcessingTests.swift similarity index 98% rename from Tests/BrowserServicesKitTests/Suggestions/SuggestionProcessingTests.swift rename to Tests/SuggestionsTests/SuggestionProcessingTests.swift index 0863b0240..dea573f49 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/SuggestionProcessingTests.swift +++ b/Tests/SuggestionsTests/SuggestionProcessingTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class SuggestionProcessingTests: XCTestCase { diff --git a/Tests/BrowserServicesKitTests/Suggestions/SuggestionResultTests.swift b/Tests/SuggestionsTests/SuggestionResultTests.swift similarity index 96% rename from Tests/BrowserServicesKitTests/Suggestions/SuggestionResultTests.swift rename to Tests/SuggestionsTests/SuggestionResultTests.swift index 2ad800591..9dabab776 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/SuggestionResultTests.swift +++ b/Tests/SuggestionsTests/SuggestionResultTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class SuggestionResultTests: XCTestCase { diff --git a/Tests/BrowserServicesKitTests/Suggestions/SuggestionTests.swift b/Tests/SuggestionsTests/SuggestionTests.swift similarity index 99% rename from Tests/BrowserServicesKitTests/Suggestions/SuggestionTests.swift rename to Tests/SuggestionsTests/SuggestionTests.swift index 6f6eaa02a..93e5b4354 100644 --- a/Tests/BrowserServicesKitTests/Suggestions/SuggestionTests.swift +++ b/Tests/SuggestionsTests/SuggestionTests.swift @@ -17,7 +17,7 @@ // import XCTest -@testable import BrowserServicesKit +@testable import Suggestions final class SuggestionTests: XCTestCase {