diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f657f8ffcf..8f4c7a4319 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -73,6 +73,23 @@ jobs: - uses: actions/checkout@v4 - name: ${{ matrix.name }} run: make test_SPM test_install_SPM + SPMSQLCipher: + name: SPM + runs-on: ${{ matrix.runsOn }} + env: + DEVELOPER_DIR: "/Applications/${{ matrix.xcode }}/Contents/Developer" + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - xcode: "Xcode_16.3.app" + runsOn: macOS-15 + name: "Xcode 16.3" + steps: + - uses: actions/checkout@v4 + - name: ${{ matrix.name }} + run: GRDBCIPHER=1 swift test SQLCipher3: name: SQLCipher3 runs-on: ${{ matrix.runsOn }} @@ -141,4 +158,4 @@ jobs: - uses: actions/checkout@v4 - name: ${{ matrix.name }} run: make test_universal_xcframework - \ No newline at end of file + diff --git a/GRDB/Core/Configuration.swift b/GRDB/Core/Configuration.swift index 9e4e165010..2f8216f09e 100644 --- a/GRDB/Core/Configuration.swift +++ b/GRDB/Core/Configuration.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Database+Schema.swift b/GRDB/Core/Database+Schema.swift index ff8f9bf1d8..8a83be2fd7 100644 --- a/GRDB/Core/Database+Schema.swift +++ b/GRDB/Core/Database+Schema.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Database+Statements.swift b/GRDB/Core/Database+Statements.swift index f4d98fc143..0e204dc254 100644 --- a/GRDB/Core/Database+Statements.swift +++ b/GRDB/Core/Database+Statements.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index 92948c31c3..66ae4301b8 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/DatabaseCollation.swift b/GRDB/Core/DatabaseCollation.swift index 6748874c8b..47abb79c82 100644 --- a/GRDB/Core/DatabaseCollation.swift +++ b/GRDB/Core/DatabaseCollation.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/DatabaseError.swift b/GRDB/Core/DatabaseError.swift index bf808dbaa5..8609ee6a4f 100644 --- a/GRDB/Core/DatabaseError.swift +++ b/GRDB/Core/DatabaseError.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/DatabaseFunction.swift b/GRDB/Core/DatabaseFunction.swift index 9e2c03ed2f..f32e7cbb4a 100644 --- a/GRDB/Core/DatabaseFunction.swift +++ b/GRDB/Core/DatabaseFunction.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/DatabaseSnapshotPool.swift b/GRDB/Core/DatabaseSnapshotPool.swift index 20398c5562..b5cc8c668d 100644 --- a/GRDB/Core/DatabaseSnapshotPool.swift +++ b/GRDB/Core/DatabaseSnapshotPool.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/DatabaseValue.swift b/GRDB/Core/DatabaseValue.swift index 1c8e721f98..df7009e699 100644 --- a/GRDB/Core/DatabaseValue.swift +++ b/GRDB/Core/DatabaseValue.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 8d39236bdc..aefda132fb 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/RowDecodingError.swift b/GRDB/Core/RowDecodingError.swift index ed82c1f891..7c9d5e37ba 100644 --- a/GRDB/Core/RowDecodingError.swift +++ b/GRDB/Core/RowDecodingError.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index be07f9eaf2..05c9f34d3b 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/StatementAuthorizer.swift b/GRDB/Core/StatementAuthorizer.swift index fb27043a50..c54b666030 100644 --- a/GRDB/Core/StatementAuthorizer.swift +++ b/GRDB/Core/StatementAuthorizer.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif @@ -11,6 +11,8 @@ import SQLite3 import string_h #elseif os(Linux) import Glibc +#elseif canImport(Android) +import Android #elseif os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS) import Darwin #elseif os(Windows) diff --git a/GRDB/Core/StatementColumnConvertible.swift b/GRDB/Core/StatementColumnConvertible.swift index d16c038429..46ab569702 100644 --- a/GRDB/Core/StatementColumnConvertible.swift +++ b/GRDB/Core/StatementColumnConvertible.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/Foundation/Data.swift b/GRDB/Core/Support/Foundation/Data.swift index 55d6bdb20f..cf11f5d8ce 100644 --- a/GRDB/Core/Support/Foundation/Data.swift +++ b/GRDB/Core/Support/Foundation/Data.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift index fb861feb8a..56f675bd47 100644 --- a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift +++ b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/Foundation/Date.swift b/GRDB/Core/Support/Foundation/Date.swift index 6676c065ae..247dd2e1ee 100644 --- a/GRDB/Core/Support/Foundation/Date.swift +++ b/GRDB/Core/Support/Foundation/Date.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/Foundation/Decimal.swift b/GRDB/Core/Support/Foundation/Decimal.swift index e200c6c596..e9a60d7e39 100644 --- a/GRDB/Core/Support/Foundation/Decimal.swift +++ b/GRDB/Core/Support/Foundation/Decimal.swift @@ -1,9 +1,9 @@ #if !os(Linux) // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/Foundation/NSNumber.swift b/GRDB/Core/Support/Foundation/NSNumber.swift index 1c5778c19e..5c2846a169 100644 --- a/GRDB/Core/Support/Foundation/NSNumber.swift +++ b/GRDB/Core/Support/Foundation/NSNumber.swift @@ -1,4 +1,4 @@ -#if !os(Linux) && !os(Windows) +#if !os(Linux) && !os(Windows) && !os(Android) import Foundation private let integerRoundingBehavior = NSDecimalNumberHandler( diff --git a/GRDB/Core/Support/Foundation/URL.swift b/GRDB/Core/Support/Foundation/URL.swift index 6db66ec3b8..145f2046ea 100644 --- a/GRDB/Core/Support/Foundation/URL.swift +++ b/GRDB/Core/Support/Foundation/URL.swift @@ -1,6 +1,6 @@ import Foundation -#if !os(Linux) && !os(Windows) +#if !os(Linux) && !os(Windows) && !os(Android) /// NSURL stores its absoluteString in the database. extension NSURL: DatabaseValueConvertible { diff --git a/GRDB/Core/Support/Foundation/UUID.swift b/GRDB/Core/Support/Foundation/UUID.swift index 7595b53ef6..7bf62de67a 100644 --- a/GRDB/Core/Support/Foundation/UUID.swift +++ b/GRDB/Core/Support/Foundation/UUID.swift @@ -1,15 +1,15 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif import Foundation -#if !os(Linux) && !os(Windows) +#if !os(Linux) && !os(Windows) && !os(Android) /// NSUUID adopts DatabaseValueConvertible extension NSUUID: DatabaseValueConvertible { /// Returns a BLOB database value containing the uuid bytes. diff --git a/GRDB/Core/Support/StandardLibrary/Optional.swift b/GRDB/Core/Support/StandardLibrary/Optional.swift index 0902097d9a..6628ba4f2e 100644 --- a/GRDB/Core/Support/StandardLibrary/Optional.swift +++ b/GRDB/Core/Support/StandardLibrary/Optional.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift index 8a4c5a7d83..6ee5ede586 100644 --- a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift +++ b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/TransactionObserver.swift b/GRDB/Core/TransactionObserver.swift index e277f4431e..d801f8c96a 100644 --- a/GRDB/Core/TransactionObserver.swift +++ b/GRDB/Core/TransactionObserver.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index a8c0168a73..1a5206e214 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Dump/DumpFormats/DebugDumpFormat.swift b/GRDB/Dump/DumpFormats/DebugDumpFormat.swift index b3ae312485..631ac7b282 100644 --- a/GRDB/Dump/DumpFormats/DebugDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/DebugDumpFormat.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Dump/DumpFormats/JSONDumpFormat.swift b/GRDB/Dump/DumpFormats/JSONDumpFormat.swift index d5bc8cb10b..5f15c310a3 100644 --- a/GRDB/Dump/DumpFormats/JSONDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/JSONDumpFormat.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Dump/DumpFormats/LineDumpFormat.swift b/GRDB/Dump/DumpFormats/LineDumpFormat.swift index a71b05ca69..355677471d 100644 --- a/GRDB/Dump/DumpFormats/LineDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/LineDumpFormat.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Dump/DumpFormats/ListDumpFormat.swift b/GRDB/Dump/DumpFormats/ListDumpFormat.swift index dc7bfdb6c3..a2c62412b3 100644 --- a/GRDB/Dump/DumpFormats/ListDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/ListDumpFormat.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift b/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift index 3818c7c17e..8f350780bb 100644 --- a/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/FTS/FTS5.swift b/GRDB/FTS/FTS5.swift index 26ad268f7f..c7258a7d8d 100644 --- a/GRDB/FTS/FTS5.swift +++ b/GRDB/FTS/FTS5.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/FTS/FTS5CustomTokenizer.swift b/GRDB/FTS/FTS5CustomTokenizer.swift index 370f1256c5..c0efe9aae2 100644 --- a/GRDB/FTS/FTS5CustomTokenizer.swift +++ b/GRDB/FTS/FTS5CustomTokenizer.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/FTS/FTS5Tokenizer.swift b/GRDB/FTS/FTS5Tokenizer.swift index e4aecc36f5..a2a58b7713 100644 --- a/GRDB/FTS/FTS5Tokenizer.swift +++ b/GRDB/FTS/FTS5Tokenizer.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/FTS/FTS5WrapperTokenizer.swift b/GRDB/FTS/FTS5WrapperTokenizer.swift index 5851866be7..9d892d23e3 100644 --- a/GRDB/FTS/FTS5WrapperTokenizer.swift +++ b/GRDB/FTS/FTS5WrapperTokenizer.swift @@ -1,9 +1,9 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/GRDB/Record/FetchableRecord+Decodable.swift b/GRDB/Record/FetchableRecord+Decodable.swift index a4c6e423b2..23b7591997 100644 --- a/GRDB/Record/FetchableRecord+Decodable.swift +++ b/GRDB/Record/FetchableRecord+Decodable.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Package.swift b/Package.swift index 36937d039a..b27e6b0790 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:6.0 +// swift-tools-version:6.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import Foundation @@ -27,6 +27,12 @@ if ProcessInfo.processInfo.environment["SPI_BUILDER"] == "1" { dependencies.append(.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")) } +// whether the "GRDBCIPHER" should be enabled by default; used for testing +var GRDBCIPHERENV = (ProcessInfo.processInfo.environment["GRDBCIPHER"] ?? "0") != "0" +var GRDBDependencies: [Target.Dependency] = ["GRDBSQLite"] +GRDBDependencies += [.product(name: "SQLCipher", package: "swift-sqlcipher", condition: .when(traits: ["GRDBCIPHER"]))] +dependencies.append(.package(url: "https://github.com/skiptools/swift-sqlcipher.git", from: "1.3.0")) + let package = Package( name: "GRDB", defaultLocalization: "en", // for tests @@ -41,6 +47,10 @@ let package = Package( .library(name: "GRDB", targets: ["GRDB"]), .library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]), ], + traits: [ + .trait(name: "GRDBCIPHER", description: "Use the SQLCipher library rather than the vendored SQLite"), + .default(enabledTraits: GRDBCIPHERENV ? ["GRDBCIPHER"] : []) // GRDBCIPHER is not enabled by default + ], dependencies: dependencies, targets: [ .systemLibrary( @@ -48,7 +58,7 @@ let package = Package( providers: [.apt(["libsqlite3-dev"])]), .target( name: "GRDB", - dependencies: ["GRDBSQLite"], + dependencies: GRDBDependencies, path: "GRDB", resources: [.copy("PrivacyInfo.xcprivacy")], cSettings: cSettings, @@ -85,3 +95,23 @@ let package = Package( ], swiftLanguageModes: [.v6] ) + +// The GRDB_PERFORMANCE_TESTS environment variable enables +// the performance tests to be included in the package, which can be run with: +// GRDB_PERFORMANCE_TESTS=1 swift test --filter GRDBPerformanceTests +if ProcessInfo.processInfo.environment["GRDB_PERFORMANCE_TESTS"] == "1" { + package.targets.append( + Target.testTarget( + name: "GRDBPerformanceTests", + dependencies: ["GRDB"], + path: "Tests/Performance/GRDBPerformance", + cSettings: cSettings, + swiftSettings: swiftSettings + [ + // Tests still use the Swift 5 language mode. + .swiftLanguageMode(.v5), + .enableUpcomingFeature("InferSendableFromCaptures"), + .enableUpcomingFeature("GlobalActorIsolatedTypesUsability"), + ]) + ) +} + diff --git a/Tests/GRDBCombineTests/Support.swift b/Tests/GRDBCombineTests/Support.swift index 6d35dd7718..e386e4f065 100644 --- a/Tests/GRDBCombineTests/Support.swift +++ b/Tests/GRDBCombineTests/Support.swift @@ -1,5 +1,6 @@ #if canImport(Combine) import Combine +#endif import Foundation import XCTest @@ -99,6 +100,7 @@ final class AsyncTest { } } +#if canImport(Combine) public func assertNoFailure( _ completion: Subscribers.Completion, file: StaticString = #file, diff --git a/Tests/GRDBTests/AssociationPrefetchingRowTests.swift b/Tests/GRDBTests/AssociationPrefetchingRowTests.swift index ead7d89b92..69aeb09ed4 100644 --- a/Tests/GRDBTests/AssociationPrefetchingRowTests.swift +++ b/Tests/GRDBTests/AssociationPrefetchingRowTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/CGFloatTests.swift b/Tests/GRDBTests/CGFloatTests.swift index 1bcfaaa582..c21267e74e 100644 --- a/Tests/GRDBTests/CGFloatTests.swift +++ b/Tests/GRDBTests/CGFloatTests.swift @@ -1,3 +1,4 @@ +#if canImport(CoreGraphics) import XCTest import CoreGraphics import GRDB @@ -21,3 +22,4 @@ class CGFloatTests: GRDBTestCase { } } } +#endif diff --git a/Tests/GRDBTests/DataMemoryTests.swift b/Tests/GRDBTests/DataMemoryTests.swift index 3f572fc304..5b4e9aaf76 100644 --- a/Tests/GRDBTests/DataMemoryTests.swift +++ b/Tests/GRDBTests/DataMemoryTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/DatabaseAggregateTests.swift b/Tests/GRDBTests/DatabaseAggregateTests.swift index 3a881b90ed..5dfeac238f 100644 --- a/Tests/GRDBTests/DatabaseAggregateTests.swift +++ b/Tests/GRDBTests/DatabaseAggregateTests.swift @@ -382,9 +382,11 @@ class DatabaseAggregateTests: GRDBTestCase { XCTFail("Expected DatabaseError") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_ERROR) + #if canImport(ObjectiveC) // non-Darwin platforms bridge NSError differently and do not set the message the same XCTAssertTrue(error.message!.contains("CustomErrorDomain")) XCTAssertTrue(error.message!.contains("123")) XCTAssertTrue(error.message!.contains("custom error message")) + #endif } } } @@ -470,9 +472,11 @@ class DatabaseAggregateTests: GRDBTestCase { XCTFail("Expected DatabaseError") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_ERROR) + #if canImport(ObjectiveC) // non-Darwin platforms bridge NSError differently and do not set the message the same XCTAssertTrue(error.message!.contains("CustomErrorDomain")) XCTAssertTrue(error.message!.contains("123")) XCTAssertTrue(error.message!.contains("custom error message")) + #endif } } } diff --git a/Tests/GRDBTests/DatabaseErrorTests.swift b/Tests/GRDBTests/DatabaseErrorTests.swift index e968b44074..1d1a1460ee 100644 --- a/Tests/GRDBTests/DatabaseErrorTests.swift +++ b/Tests/GRDBTests/DatabaseErrorTests.swift @@ -216,6 +216,9 @@ class DatabaseErrorTests: GRDBTestCase { } func testNSErrorBridging() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSError bridging works differently on non-Darwin platforms") + #else let dbQueue = try makeDatabaseQueue() try dbQueue.inDatabase { db in try db.create(table: "parents") { $0.column("id", .integer).primaryKey() } @@ -229,5 +232,6 @@ class DatabaseErrorTests: GRDBTestCase { XCTAssertNotNil(error.localizedFailureReason) } } + #endif } } diff --git a/Tests/GRDBTests/DatabaseFunctionTests.swift b/Tests/GRDBTests/DatabaseFunctionTests.swift index 4c670bbd8a..f614ef660a 100644 --- a/Tests/GRDBTests/DatabaseFunctionTests.swift +++ b/Tests/GRDBTests/DatabaseFunctionTests.swift @@ -336,9 +336,11 @@ class DatabaseFunctionTests: GRDBTestCase { XCTFail("Expected DatabaseError") } catch let error as DatabaseError { XCTAssertEqual(error.resultCode, .SQLITE_ERROR) + #if canImport(ObjectiveC) // non-Darwin platforms bridge NSError differently and do not set the message the same XCTAssertTrue(error.message!.contains("CustomErrorDomain")) XCTAssertTrue(error.message!.contains("123")) XCTAssertTrue(error.message!.contains("custom error message")) + #endif } } } diff --git a/Tests/GRDBTests/DatabaseMigratorTests.swift b/Tests/GRDBTests/DatabaseMigratorTests.swift index b82d221d03..6a05c5517f 100644 --- a/Tests/GRDBTests/DatabaseMigratorTests.swift +++ b/Tests/GRDBTests/DatabaseMigratorTests.swift @@ -43,9 +43,13 @@ class DatabaseMigratorTests : GRDBTestCase { func testEmptyMigratorPublisher() throws { func test(writer: some DatabaseWriter) throws { let migrator = DatabaseMigrator() + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let publisher = migrator.migratePublisher(writer) let recorder = publisher.record() try wait(for: recorder.single, timeout: 1) + #endif } try Test(test).run { try DatabaseQueue() } @@ -175,6 +179,9 @@ class DatabaseMigratorTests : GRDBTestCase { } do { + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let publisher = migrator.migratePublisher(writer) let recorder = publisher.record() try wait(for: recorder.single, timeout: 1) @@ -182,9 +189,13 @@ class DatabaseMigratorTests : GRDBTestCase { XCTAssertTrue(try db.tableExists("persons")) XCTAssertTrue(try db.tableExists("pets")) } + #endif } do { + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let publisher = migrator2.migratePublisher(writer) let recorder = publisher.record() try wait(for: recorder.single, timeout: 1) @@ -192,6 +203,7 @@ class DatabaseMigratorTests : GRDBTestCase { XCTAssertTrue(try db.tableExists("persons")) XCTAssertFalse(try db.tableExists("pets")) } + #endif } } @@ -205,6 +217,9 @@ class DatabaseMigratorTests : GRDBTestCase { let migrator = DatabaseMigrator() let expectation = self.expectation(description: "") let semaphore = DispatchSemaphore(value: 0) + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let cancellable = migrator.migratePublisher(writer).sink( receiveCompletion: { _ in }, receiveValue: { _ in @@ -215,6 +230,7 @@ class DatabaseMigratorTests : GRDBTestCase { semaphore.signal() waitForExpectations(timeout: 5, handler: nil) cancellable.cancel() + #endif } try Test(test).run { try DatabaseQueue() } @@ -228,6 +244,9 @@ class DatabaseMigratorTests : GRDBTestCase { migrator.registerMigration("first", migrate: { _ in }) let expectation = self.expectation(description: "") let semaphore = DispatchSemaphore(value: 0) + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let cancellable = migrator.migratePublisher(writer).sink( receiveCompletion: { _ in }, receiveValue: { _ in @@ -238,6 +257,7 @@ class DatabaseMigratorTests : GRDBTestCase { semaphore.signal() waitForExpectations(timeout: 5, handler: nil) cancellable.cancel() + #endif } try Test(test).run { try DatabaseQueue() } @@ -246,11 +266,14 @@ class DatabaseMigratorTests : GRDBTestCase { } func testMigratorPublisherDefaultScheduler() throws { - func test(writer: Writer) { + func test(writer: Writer) throws { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) let expectation = self.expectation(description: "") expectation.expectedFulfillmentCount = 2 // value + completion + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let cancellable = migrator.migratePublisher(writer).sink( receiveCompletion: { completion in dispatchPrecondition(condition: .onQueue(.main)) @@ -263,6 +286,7 @@ class DatabaseMigratorTests : GRDBTestCase { waitForExpectations(timeout: 5, handler: nil) cancellable.cancel() + #endif } try Test(test).run { try DatabaseQueue() } @@ -271,12 +295,15 @@ class DatabaseMigratorTests : GRDBTestCase { } func testMigratorPublisherCustomScheduler() throws { - func test(writer: Writer) { + func test(writer: Writer) throws { var migrator = DatabaseMigrator() migrator.registerMigration("first", migrate: { _ in }) let queue = DispatchQueue(label: "test") let expectation = self.expectation(description: "") expectation.expectedFulfillmentCount = 2 // value + completion + #if !canImport(Combine) + throw XCTSkip("Combine not supported on platform") + #else let cancellable = migrator.migratePublisher(writer, receiveOn: queue).sink( receiveCompletion: { completion in dispatchPrecondition(condition: .onQueue(queue)) @@ -289,6 +316,7 @@ class DatabaseMigratorTests : GRDBTestCase { waitForExpectations(timeout: 5, handler: nil) cancellable.cancel() + #endif } try Test(test).run { try DatabaseQueue() } diff --git a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift index 7d2478545b..9af17aa562 100644 --- a/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift +++ b/Tests/GRDBTests/DatabasePoolConcurrencyTests.swift @@ -879,8 +879,10 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.writer") + #endif } let s1 = DispatchSemaphore(value: 0) @@ -892,9 +894,11 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.reader.1") - + #endif + _ = s1.signal() _ = s2.wait(timeout: .distantFuture) } @@ -908,8 +912,10 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.reader.2") + #endif } } let blocks = [block1, block2] @@ -927,8 +933,10 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.writer") + #endif } let s1 = DispatchSemaphore(value: 0) @@ -940,9 +948,11 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.reader.1") - + #endif + _ = s1.signal() _ = s2.wait(timeout: .distantFuture) } @@ -956,8 +966,10 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.reader.2") + #endif } } let blocks = [block1, block2] @@ -1055,6 +1067,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // > because DISPATCH_QUEUE_OVERCOMMIT is not a public API. I don't // > know of a way to get a reference to the overcommit queue using // > only public APIs. + #if !canImport(Darwin) + throw XCTSkip("__dispatch_get_global_queue unavailable") + #else let DISPATCH_QUEUE_OVERCOMMIT: UInt = 2 let targetQueue = __dispatch_get_global_queue( Int(qos.qosClass.rawValue.rawValue), @@ -1068,6 +1083,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { try dbPool.read { _ in dispatchPrecondition(condition: .onQueue(targetQueue)) } + #endif } try test(qos: .background) @@ -1254,6 +1270,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // MARK: - Concurrent opening func testConcurrentOpening() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSFileCoordinator unavailable") + #else for _ in 0..<50 { let dbDirectoryName = "DatabasePoolConcurrencyTests-\(ProcessInfo.processInfo.globallyUniqueString)" let directoryURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true) @@ -1277,6 +1296,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { XCTAssert(poolError ?? coordinatorError == nil) } } + #endif } // MARK: - NSFileCoordinator sample code tests @@ -1284,6 +1304,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // Test for sample code in Documentation.docc/DatabaseSharing.md. // This test passes if this method compiles private func openSharedDatabase(at databaseURL: URL) throws -> DatabasePool { + #if !canImport(ObjectiveC) + throw XCTSkip("NSFileCoordinator unavailable") + #else let coordinator = NSFileCoordinator(filePresenter: nil) var coordinatorError: NSError? var dbPool: DatabasePool? @@ -1299,6 +1322,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { throw error } return dbPool! + #endif } // Test for sample code in Documentation.docc/DatabaseSharing.md. @@ -1313,6 +1337,9 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { // Test for sample code in Documentation.docc/DatabaseSharing.md. // This test passes if this method compiles private func openSharedReadOnlyDatabase(at databaseURL: URL) throws -> DatabasePool? { + #if !canImport(ObjectiveC) + throw XCTSkip("NSFileCoordinator unavailable") + #else let coordinator = NSFileCoordinator(filePresenter: nil) var coordinatorError: NSError? var dbPool: DatabasePool? @@ -1328,6 +1355,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase { throw error } return dbPool + #endif } // Test for sample code in Documentation.docc/DatabaseSharing.md. diff --git a/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift b/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift index afa8bd32a5..5ee6dc28dd 100644 --- a/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift +++ b/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/DatabasePoolTests.swift b/Tests/GRDBTests/DatabasePoolTests.swift index e1ab57bbd5..1da50d7277 100644 --- a/Tests/GRDBTests/DatabasePoolTests.swift +++ b/Tests/GRDBTests/DatabasePoolTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/DatabaseQueueTests.swift b/Tests/GRDBTests/DatabaseQueueTests.swift index c22be83261..094491d8a8 100644 --- a/Tests/GRDBTests/DatabaseQueueTests.swift +++ b/Tests/GRDBTests/DatabaseQueueTests.swift @@ -131,8 +131,10 @@ class DatabaseQueueTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabaseQueue") + #endif } } @@ -146,8 +148,10 @@ class DatabaseQueueTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador") + #endif } } @@ -239,6 +243,9 @@ class DatabaseQueueTests: GRDBTestCase { // > because DISPATCH_QUEUE_OVERCOMMIT is not a public API. I don't // > know of a way to get a reference to the overcommit queue using // > only public APIs. + #if !canImport(Darwin) + throw XCTSkip("__dispatch_get_global_queue unavailable") + #else let DISPATCH_QUEUE_OVERCOMMIT: UInt = 2 let targetQueue = __dispatch_get_global_queue( Int(qos.qosClass.rawValue.rawValue), @@ -252,6 +259,7 @@ class DatabaseQueueTests: GRDBTestCase { try dbQueue.read { _ in dispatchPrecondition(condition: .onQueue(targetQueue)) } + #endif } try test(qos: .background) diff --git a/Tests/GRDBTests/DatabaseRegionObservationTests.swift b/Tests/GRDBTests/DatabaseRegionObservationTests.swift index 3ffdfc39eb..7574c6a0b3 100644 --- a/Tests/GRDBTests/DatabaseRegionObservationTests.swift +++ b/Tests/GRDBTests/DatabaseRegionObservationTests.swift @@ -2,6 +2,7 @@ import XCTest import GRDB class DatabaseRegionObservationTests: GRDBTestCase { + #if canImport(Combine) // Test passes if it compiles. // See func testAnyDatabaseWriter(writer: any DatabaseWriter) throws { @@ -10,7 +11,8 @@ class DatabaseRegionObservationTests: GRDBTestCase { _ = observation.start(in: writer, onError: { _ in }, onChange: { _ in }) _ = observation.publisher(in: writer) } - + #endif + func testDatabaseRegionObservation_FullDatabase() throws { let dbQueue = try makeDatabaseQueue() try dbQueue.write { diff --git a/Tests/GRDBTests/DatabaseSnapshotTests.swift b/Tests/GRDBTests/DatabaseSnapshotTests.swift index 1cb422ecdd..39b6ff9a7a 100644 --- a/Tests/GRDBTests/DatabaseSnapshotTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotTests.swift @@ -232,8 +232,10 @@ class DatabaseSnapshotTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.snapshot.1") + #endif } let snapshot2 = try dbPool.makeSnapshot() @@ -243,8 +245,10 @@ class DatabaseSnapshotTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "GRDB.DatabasePool.snapshot.2") + #endif } } @@ -259,8 +263,10 @@ class DatabaseSnapshotTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.snapshot.1") + #endif } let snapshot2 = try dbPool.makeSnapshot() @@ -270,8 +276,10 @@ class DatabaseSnapshotTests: GRDBTestCase { // This test CAN break in future releases: the dispatch queue labels // are documented to be a debug-only tool. + #if canImport(Darwin) // __dispatch_queue_get_label unavailable on non-Darwin platforms let label = String(utf8String: __dispatch_queue_get_label(nil)) XCTAssertEqual(label, "Toreador.snapshot.2") + #endif } } diff --git a/Tests/GRDBTests/FailureTestCase.swift b/Tests/GRDBTests/FailureTestCase.swift index 9dfb9770ba..18fd24ae4a 100644 --- a/Tests/GRDBTests/FailureTestCase.swift +++ b/Tests/GRDBTests/FailureTestCase.swift @@ -4,8 +4,9 @@ import XCTest /// A XCTestCase subclass that can test its own failures. class FailureTestCase: XCTestCase { private struct Failure: Hashable { + #if canImport(Darwin) let issue: XCTIssue - + func issue(prefix: String = "") -> XCTIssue { if prefix.isEmpty { return issue @@ -19,11 +20,11 @@ class FailureTestCase: XCTestCase { attachments: issue.attachments) } } - + private var description: String { return issue.compactDescription } - + func hash(into hasher: inout Hasher) { hasher.combine(0) } @@ -31,12 +32,16 @@ class FailureTestCase: XCTestCase { static func == (lhs: Failure, rhs: Failure) -> Bool { lhs.description.hasPrefix(rhs.description) || rhs.description.hasPrefix(lhs.description) } + #endif } private var recordedFailures: [Failure] = [] private var isRecordingFailures = false - func assertFailure(_ prefixes: String..., file: StaticString = #file, line: UInt = #line, _ execute: () throws -> Void) rethrows { + func assertFailure(_ prefixes: String..., file: StaticString = #file, line: UInt = #line, _ execute: () throws -> Void) throws { + #if !canImport(Darwin) + throw XCTSkip("XCTIssue unavailable on non-Darwin platforms") + #else let recordedFailures = try recordingFailures(execute) if prefixes.isEmpty { if recordedFailures.isEmpty { @@ -68,6 +73,7 @@ class FailureTestCase: XCTestCase { recordedFailures: recordedFailures, expectedFailures: expectedFailures) } + #endif } override func setUp() { @@ -75,7 +81,8 @@ class FailureTestCase: XCTestCase { isRecordingFailures = false recordedFailures = [] } - + + #if canImport(Darwin) override func record(_ issue: XCTIssue) { if isRecordingFailures { recordedFailures.append(Failure(issue: issue)) @@ -83,7 +90,7 @@ class FailureTestCase: XCTestCase { super.record(issue) } } - + private func recordingFailures(_ execute: () throws -> Void) rethrows -> [Failure] { let oldRecordingFailures = isRecordingFailures let oldRecordedFailures = recordedFailures @@ -120,6 +127,7 @@ class FailureTestCase: XCTestCase { } } } + #endif } // MARK: - Tests @@ -128,62 +136,62 @@ class FailureTestCaseTests: FailureTestCase { func testEmptyTest() { } - func testExpectedAnyFailure() { - assertFailure { + func testExpectedAnyFailure() throws { + try assertFailure { XCTFail("foo") } - assertFailure { + try assertFailure { XCTFail("foo") XCTFail("bar") } } - func testMissingAnyFailure() { - assertFailure("No failure did happen") { - assertFailure { + func testMissingAnyFailure() throws { + try assertFailure("No failure did happen") { + try assertFailure { } } } - func testExpectedFailure() { - assertFailure("failed - foo") { + func testExpectedFailure() throws { + try assertFailure("failed - foo") { XCTFail("foo") } } - func testExpectedFailureMatchesOnPrefix() { - assertFailure("failed - foo") { + func testExpectedFailureMatchesOnPrefix() throws { + try assertFailure("failed - foo") { XCTFail("foobarbaz") } } - func testOrderOfExpectedFailureIsIgnored() { - assertFailure("failed - foo", "failed - bar") { + func testOrderOfExpectedFailureIsIgnored() throws { + try assertFailure("failed - foo", "failed - bar") { XCTFail("foo") XCTFail("bar") } - assertFailure("failed - bar", "failed - foo") { + try assertFailure("failed - bar", "failed - foo") { XCTFail("foo") XCTFail("bar") } } - func testExpectedFailureCanBeRepeated() { - assertFailure("failed - foo", "failed - foo", "failed - bar") { + func testExpectedFailureCanBeRepeated() throws { + try assertFailure("failed - foo", "failed - foo", "failed - bar") { XCTFail("foo") XCTFail("bar") XCTFail("foo") } } - func testExactNumberOfRepetitionIsRequired() { - assertFailure("Failure did not happen: failed - foo") { - assertFailure("failed - foo", "failed - foo") { + func testExactNumberOfRepetitionIsRequired() throws { + try assertFailure("Failure did not happen: failed - foo") { + try assertFailure("failed - foo", "failed - foo") { XCTFail("foo") } } - assertFailure("failed - foo") { - assertFailure("failed - foo", "failed - foo") { + try assertFailure("failed - foo") { + try assertFailure("failed - foo", "failed - foo") { XCTFail("foo") XCTFail("foo") XCTFail("foo") @@ -191,16 +199,16 @@ class FailureTestCaseTests: FailureTestCase { } } - func testUnexpectedFailure() { - assertFailure("Failure did not happen: failed - foo") { - assertFailure("failed - foo") { + func testUnexpectedFailure() throws { + try assertFailure("Failure did not happen: failed - foo") { + try assertFailure("failed - foo") { } } } - func testMissedFailure() { - assertFailure("failed - bar") { - assertFailure("failed - foo") { + func testMissedFailure() throws { + try assertFailure("failed - bar") { + try assertFailure("failed - foo") { XCTFail("foo") XCTFail("bar") } diff --git a/Tests/GRDBTests/FoundationNSDecimalNumberTests.swift b/Tests/GRDBTests/FoundationNSDecimalNumberTests.swift index 0013a7056b..681a0af1fb 100644 --- a/Tests/GRDBTests/FoundationNSDecimalNumberTests.swift +++ b/Tests/GRDBTests/FoundationNSDecimalNumberTests.swift @@ -3,8 +3,10 @@ import GRDB class FoundationNSDecimalNumberTests: GRDBTestCase { - func testNSDecimalNumberPreservesIntegerValues() { - + func testNSDecimalNumberPreservesIntegerValues() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else enum Storage { case integer case double @@ -54,9 +56,13 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { // Int64.min - 1 XCTAssertEqual(storage(NSDecimalNumber(string: "-9223372036854775809")), .double) + #endif } func testNSDecimalNumberDatabaseRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else let dbQueue = try makeDatabaseQueue() func roundTrip(_ value: NSDecimalNumber) throws -> Bool { guard let back = try dbQueue.inDatabase({ try NSDecimalNumber.fetchOne($0, sql: "SELECT ?", arguments: [value]) }) else { @@ -68,9 +74,13 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { XCTAssertTrue(try roundTrip(NSDecimalNumber(value: Int32.min + 1))) XCTAssertTrue(try roundTrip(NSDecimalNumber(value: Double(10000000.01)))) + #endif } - func testNSDecimalNumberDatabaseValueRoundTrip() { + func testNSDecimalNumberDatabaseValueRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else func roundTrip(_ value: NSDecimalNumber) -> Bool { let dbValue = value.databaseValue @@ -84,18 +94,26 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { XCTAssertTrue(roundTrip(NSDecimalNumber(value: Int32.min + 1))) XCTAssertTrue(roundTrip(NSDecimalNumber(value: Double(10000000.01)))) + #endif } - func testNSDecimalNumberFromDatabaseValueFailure() { + func testNSDecimalNumberFromDatabaseValueFailure() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else let databaseValue_Null = DatabaseValue.null let databaseValue_String = "foo".databaseValue let databaseValue_Blob = "bar".data(using: .utf8)!.databaseValue XCTAssertNil(NSDecimalNumber.fromDatabaseValue(databaseValue_Null)) XCTAssertNil(NSDecimalNumber.fromDatabaseValue(databaseValue_String)) XCTAssertNil(NSDecimalNumber.fromDatabaseValue(databaseValue_Blob)) + #endif } func testNSDecimalNumberDecodingFromInt64() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else func test(_ value: Int64, isDecodedAs number: NSDecimalNumber) throws { XCTAssertEqual(NSDecimalNumber(value: value), number) @@ -114,9 +132,13 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { try test(9223372036854775806, isDecodedAs: NSDecimalNumber(string: "9223372036854775806")) try test(-9223372036854775807, isDecodedAs: NSDecimalNumber(string: "-9223372036854775807")) try test(-9223372036854775808, isDecodedAs: NSDecimalNumber(string: "-9223372036854775808")) + #endif } func testNSDecimalNumberDecodingFromDouble() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else func test(_ value: Double, isDecodedAs number: NSDecimalNumber) throws { XCTAssertEqual(NSDecimalNumber(value: value), number) @@ -132,9 +154,13 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { try test(0.25, isDecodedAs: NSDecimalNumber(string: "0.25")) try test(1, isDecodedAs: NSDecimalNumber(string: "1")) try test(-1, isDecodedAs: NSDecimalNumber(string: "-1")) + #endif } func testNSDecimalNumberDecodingFromText() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSDecimalNumber unavailable") + #else func test(_ value: String, isDecodedAs number: NSDecimalNumber) throws { XCTAssertEqual(NSDecimalNumber(string: value), number) @@ -155,5 +181,6 @@ class FoundationNSDecimalNumberTests: GRDBTestCase { try test("-9223372036854775807", isDecodedAs: NSDecimalNumber(string: "-9223372036854775807")) try test("-9223372036854775808", isDecodedAs: NSDecimalNumber(string: "-9223372036854775808")) try test("18446744073709551615", isDecodedAs: NSDecimalNumber(string: "18446744073709551615")) + #endif } } diff --git a/Tests/GRDBTests/FoundationNSNumberTests.swift b/Tests/GRDBTests/FoundationNSNumberTests.swift index ff5d3df350..298f781a8f 100644 --- a/Tests/GRDBTests/FoundationNSNumberTests.swift +++ b/Tests/GRDBTests/FoundationNSNumberTests.swift @@ -3,7 +3,10 @@ import GRDB class FoundationNSNumberTests: GRDBTestCase { - func testNSNumberDatabaseValueToSwiftType() { + func testNSNumberDatabaseValueToSwiftType() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSNumber unavailable") + #else enum Storage { case integer case double @@ -130,9 +133,13 @@ class FoundationNSNumberTests: GRDBTestCase { XCTAssertEqual(storage(number), .integer) XCTAssertEqual(Bool.fromDatabaseValue(number.databaseValue), false) } + #endif } func testNSNumberDatabaseRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSNumber unavailable") + #else let dbQueue = try makeDatabaseQueue() func roundTrip(_ value: NSNumber) throws -> Bool { guard let back = try dbQueue.inDatabase({ try NSNumber.fetchOne($0, sql: "SELECT ?", arguments: [value]) }) else { @@ -144,9 +151,13 @@ class FoundationNSNumberTests: GRDBTestCase { XCTAssertTrue(try roundTrip(NSNumber(value: Int32.min + 1))) XCTAssertTrue(try roundTrip(NSNumber(value: Double(10000000.01)))) + #endif } - func testNSNumberDatabaseValueRoundTrip() { + func testNSNumberDatabaseValueRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSNumber unavailable") + #else func roundTrip(_ value: NSNumber) -> Bool { let dbValue = value.databaseValue @@ -160,18 +171,26 @@ class FoundationNSNumberTests: GRDBTestCase { XCTAssertTrue(roundTrip(NSNumber(value: Int32.min + 1))) XCTAssertTrue(roundTrip(NSNumber(value: Double(10000000.01)))) + #endif } - func testNSNumberFromDatabaseValueFailure() { + func testNSNumberFromDatabaseValueFailure() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSNumber unavailable") + #else let databaseValue_Null = DatabaseValue.null let databaseValue_String = "foo".databaseValue let databaseValue_Blob = "bar".data(using: .utf8)!.databaseValue XCTAssertNil(NSNumber.fromDatabaseValue(databaseValue_Null)) XCTAssertNil(NSNumber.fromDatabaseValue(databaseValue_String)) XCTAssertNil(NSNumber.fromDatabaseValue(databaseValue_Blob)) + #endif } func testNSNumberDecodingFromText() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSNumber unavailable") + #else func test(_ value: String, isDecodedAs number: NSDecimalNumber) throws { let decodedFromDatabaseValue = NSNumber.fromDatabaseValue(value.databaseValue) as? NSDecimalNumber XCTAssertEqual(decodedFromDatabaseValue, number) @@ -190,5 +209,6 @@ class FoundationNSNumberTests: GRDBTestCase { try test("-9223372036854775807", isDecodedAs: NSDecimalNumber(value: -9223372036854775807)) try test("-9223372036854775808", isDecodedAs: NSDecimalNumber(value: -9223372036854775808)) try test("18446744073709551615", isDecodedAs: NSDecimalNumber(value: UInt64(18446744073709551615))) + #endif } } diff --git a/Tests/GRDBTests/FoundationNSURLTests.swift b/Tests/GRDBTests/FoundationNSURLTests.swift index 180698a42c..52f7d2cd96 100644 --- a/Tests/GRDBTests/FoundationNSURLTests.swift +++ b/Tests/GRDBTests/FoundationNSURLTests.swift @@ -4,6 +4,9 @@ import GRDB class FoundationNSURLTests: GRDBTestCase { func testNSURLDatabaseRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSURL unavailable") + #else let dbQueue = try makeDatabaseQueue() func roundTrip(_ value: NSURL) throws -> Bool { guard let back = try dbQueue.inDatabase({ try NSURL.fetchOne($0, sql: "SELECT ?", arguments: [value]) }) else { @@ -15,9 +18,13 @@ class FoundationNSURLTests: GRDBTestCase { XCTAssertTrue(try roundTrip(NSURL(string: "https://github.com/groue/GRDB.swift")!)) XCTAssertTrue(try roundTrip(NSURL(fileURLWithPath: NSTemporaryDirectory()))) + #endif } - func testNSURLDatabaseValueRoundTrip() { + func testNSURLDatabaseValueRoundTrip() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSURL unavailable") + #else func roundTrip(_ value: NSURL) -> Bool { @@ -32,9 +39,13 @@ class FoundationNSURLTests: GRDBTestCase { XCTAssertTrue(roundTrip(NSURL(string: "https://github.com/groue/GRDB.swift")!)) XCTAssertTrue(roundTrip(NSURL(fileURLWithPath: NSTemporaryDirectory()))) + #endif } - func testNSURLFromDatabaseValueFailure() { + func testNSURLFromDatabaseValueFailure() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSURL unavailable") + #else let databaseValue_Null = DatabaseValue.null let databaseValue_Int64 = Int64(1).databaseValue let databaseValue_Double = Double(100000.1).databaseValue @@ -43,6 +54,7 @@ class FoundationNSURLTests: GRDBTestCase { XCTAssertNil(NSURL.fromDatabaseValue(databaseValue_Int64)) XCTAssertNil(NSURL.fromDatabaseValue(databaseValue_Double)) XCTAssertEqual(NSURL.fromDatabaseValue(databaseValue_Blob)!.absoluteString, "bar") + #endif } } diff --git a/Tests/GRDBTests/FoundationNSUUIDTests.swift b/Tests/GRDBTests/FoundationNSUUIDTests.swift index cc7243ce86..c87606f9e2 100644 --- a/Tests/GRDBTests/FoundationNSUUIDTests.swift +++ b/Tests/GRDBTests/FoundationNSUUIDTests.swift @@ -2,6 +2,7 @@ import XCTest import GRDB class FoundationNSUUIDTests: GRDBTestCase { + #if canImport(ObjectiveC) private func assert(_ value: (any DatabaseValueConvertible)?, isDecodedAs expectedUUID: NSUUID?) throws { try makeDatabaseQueue().read { db in if let expectedUUID { @@ -16,8 +17,12 @@ class FoundationNSUUIDTests: GRDBTestCase { let decodedUUID = NSUUID.fromDatabaseValue(value?.databaseValue ?? .null) XCTAssertEqual(decodedUUID, expectedUUID) } - + #endif + private func assertRoundTrip(_ uuid: UUID) throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSUUID unavailable") + #else let string = uuid.uuidString var uuid_t = uuid.uuid let data = withUnsafeBytes(of: &uuid_t) { @@ -29,15 +34,23 @@ class FoundationNSUUIDTests: GRDBTestCase { try assert(uuid, isDecodedAs: uuid as NSUUID) try assert(uuid as NSUUID, isDecodedAs: uuid as NSUUID) try assert(data, isDecodedAs: uuid as NSUUID) + #endif } func testSuccess() throws { try assertRoundTrip(UUID(uuidString: "56e7d8d3-e9e4-48b6-968e-8d102833af00")!) try assertRoundTrip(UUID()) + #if !canImport(ObjectiveC) + throw XCTSkip("NSUUID unavailable") + #else try assert("abcdefghijklmnop".data(using: .utf8)!, isDecodedAs: NSUUID(uuidString: "61626364-6566-6768-696A-6B6C6D6E6F70")) + #endif } func testFailure() throws { + #if !canImport(ObjectiveC) + throw XCTSkip("NSUUID unavailable") + #else try assert(nil, isDecodedAs: nil) try assert(DatabaseValue.null, isDecodedAs: nil) try assert(1, isDecodedAs: nil) @@ -48,5 +61,6 @@ class FoundationNSUUIDTests: GRDBTestCase { try assert("bar".data(using: .utf8)!, isDecodedAs: nil) try assert("abcdefghijklmno".data(using: .utf8)!, isDecodedAs: nil) try assert("abcdefghijklmnopq".data(using: .utf8)!, isDecodedAs: nil) + #endif } } diff --git a/Tests/GRDBTests/FoundationURLTests.swift b/Tests/GRDBTests/FoundationURLTests.swift index 3a042653c6..6dbe5f6142 100644 --- a/Tests/GRDBTests/FoundationURLTests.swift +++ b/Tests/GRDBTests/FoundationURLTests.swift @@ -42,7 +42,7 @@ class FoundationURLTests: GRDBTestCase { XCTAssertNil(URL.fromDatabaseValue(databaseValue_Null)) XCTAssertNil(URL.fromDatabaseValue(databaseValue_Int64)) XCTAssertNil(URL.fromDatabaseValue(databaseValue_Double)) - XCTAssertEqual(URL.fromDatabaseValue(databaseValue_Blob)!.absoluteString, "bar") + XCTAssertEqual(URL.fromDatabaseValue(databaseValue_Blob)?.absoluteString, "bar") } } diff --git a/Tests/GRDBTests/FoundationUUIDTests.swift b/Tests/GRDBTests/FoundationUUIDTests.swift index 9adfc228a4..8ecb921ad8 100644 --- a/Tests/GRDBTests/FoundationUUIDTests.swift +++ b/Tests/GRDBTests/FoundationUUIDTests.swift @@ -28,7 +28,9 @@ class FoundationUUIDTests: GRDBTestCase { try assert(string.lowercased(), isDecodedAs: uuid) try assert(string.uppercased(), isDecodedAs: uuid) try assert(uuid, isDecodedAs: uuid) + #if canImport(ObjectiveC) try assert(uuid as NSUUID, isDecodedAs: uuid) + #endif try assert(data, isDecodedAs: uuid) } diff --git a/Tests/GRDBTests/GRDBTestCase.swift b/Tests/GRDBTests/GRDBTestCase.swift index c93a23ad5c..05a0baa426 100644 --- a/Tests/GRDBTests/GRDBTestCase.swift +++ b/Tests/GRDBTests/GRDBTestCase.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift index cee0f6e954..21b19a5c92 100644 --- a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift +++ b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/UpdateStatementTests.swift b/Tests/GRDBTests/UpdateStatementTests.swift index 6a3233fdc8..ba7f6bc2da 100644 --- a/Tests/GRDBTests/UpdateStatementTests.swift +++ b/Tests/GRDBTests/UpdateStatementTests.swift @@ -1,8 +1,8 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER import SQLCipher +#elseif SWIFT_PACKAGE +import GRDBSQLite #elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER import SQLite3 #endif diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index ae5c09ff83..e98440ccf5 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -890,7 +890,8 @@ class ValueObservationTests: GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) } - + + #if canImport(Darwin) // @MainActor test cases don't compile non-Darwin platforms: "call to main actor-isolated instance method 'test_mainActor_observation()' in a synchronous nonisolated(unsafe) context" // MARK: - Main Actor @MainActor func test_mainActor_observation() throws { let dbQueue = try makeDatabaseQueue() @@ -924,6 +925,7 @@ class ValueObservationTests: GRDBTestCase { wait(for: [expectation], timeout: 2) } } + #endif // MARK: - Async Await diff --git a/Tests/Performance/GRDBPerformance/FetchPositionalValuesTests.swift b/Tests/Performance/GRDBPerformance/FetchPositionalValuesTests.swift index 72b41d0e04..47b6557ccd 100644 --- a/Tests/Performance/GRDBPerformance/FetchPositionalValuesTests.swift +++ b/Tests/Performance/GRDBPerformance/FetchPositionalValuesTests.swift @@ -1,6 +1,10 @@ import XCTest import GRDB +#if GRDBCIPHER +import SQLCipher +#else import SQLite3 +#endif #if GRDB_COMPARE import SQLite #endif diff --git a/Tests/Performance/GRDBPerformance/FetchRecordStructTests.swift b/Tests/Performance/GRDBPerformance/FetchRecordStructTests.swift index 13387d5e1d..446a18e6b5 100644 --- a/Tests/Performance/GRDBPerformance/FetchRecordStructTests.swift +++ b/Tests/Performance/GRDBPerformance/FetchRecordStructTests.swift @@ -1,6 +1,10 @@ import XCTest import GRDB +#if GRDBCIPHER +import SQLCipher +#else import SQLite3 +#endif #if GRDB_COMPARE import SQLite #endif diff --git a/Tests/Performance/GRDBPerformance/InsertPositionalValuesTests.swift b/Tests/Performance/GRDBPerformance/InsertPositionalValuesTests.swift index ec6edb99b1..9ba3449121 100644 --- a/Tests/Performance/GRDBPerformance/InsertPositionalValuesTests.swift +++ b/Tests/Performance/GRDBPerformance/InsertPositionalValuesTests.swift @@ -1,6 +1,10 @@ import XCTest import GRDB +#if GRDBCIPHER +import SQLCipher +#else import SQLite3 +#endif #if GRDB_COMPARE import SQLite #endif