From 8cba324d6edbe9915902eadee2e18ff5a4afd1a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 15:45:19 +0200 Subject: [PATCH] Refactor the SQLite import We can not use `#if Trait` because Xcode does not enable those compiler flags. Always count on Apple for delivering the best quality software. So now we import the default SPM SQLite last, after all other cases have been excluded. The GRDB framework (GRDB.xcodeproj and GRDB via CocoaPods) is distinct from the default SPM trait, so we detect it with GRDBFRAMEWORK. --- GRDB.swift.podspec | 2 +- GRDB/Core/Configuration.swift | 11 +++++++---- GRDB/Core/Database+Schema.swift | 11 +++++++---- GRDB/Core/Database+Statements.swift | 11 +++++++---- GRDB/Core/Database.swift | 11 +++++++---- GRDB/Core/DatabaseCollation.swift | 11 +++++++---- GRDB/Core/DatabaseError.swift | 11 +++++++---- GRDB/Core/DatabaseFunction.swift | 11 +++++++---- GRDB/Core/DatabaseSnapshotPool.swift | 11 +++++++---- GRDB/Core/DatabaseValue.swift | 11 +++++++---- GRDB/Core/Row.swift | 11 +++++++---- GRDB/Core/RowDecodingError.swift | 11 +++++++---- GRDB/Core/Statement.swift | 11 +++++++---- GRDB/Core/StatementAuthorizer.swift | 11 +++++++---- GRDB/Core/StatementColumnConvertible.swift | 11 +++++++---- GRDB/Core/Support/Foundation/Data.swift | 11 +++++++---- .../Support/Foundation/DatabaseDateComponents.swift | 11 +++++++---- GRDB/Core/Support/Foundation/Date.swift | 11 +++++++---- GRDB/Core/Support/Foundation/Decimal.swift | 11 +++++++---- GRDB/Core/Support/Foundation/UUID.swift | 11 +++++++---- GRDB/Core/Support/StandardLibrary/Optional.swift | 11 +++++++---- .../Support/StandardLibrary/StandardLibrary.swift | 11 +++++++---- GRDB/Core/TransactionObserver.swift | 11 +++++++---- GRDB/Core/WALSnapshot.swift | 11 +++++++---- GRDB/Dump/DumpFormats/DebugDumpFormat.swift | 11 +++++++---- GRDB/Dump/DumpFormats/JSONDumpFormat.swift | 11 +++++++---- GRDB/Dump/DumpFormats/LineDumpFormat.swift | 11 +++++++---- GRDB/Dump/DumpFormats/ListDumpFormat.swift | 11 +++++++---- GRDB/Dump/DumpFormats/QuoteDumpFormat.swift | 11 +++++++---- GRDB/FTS/FTS5.swift | 11 +++++++---- GRDB/FTS/FTS5CustomTokenizer.swift | 11 +++++++---- GRDB/FTS/FTS5Tokenizer.swift | 11 +++++++---- GRDB/FTS/FTS5WrapperTokenizer.swift | 11 +++++++---- GRDB/Record/FetchableRecord+Decodable.swift | 11 +++++++---- Support/GRDB.xcconfig | 1 + Support/GRDBTests.xcconfig | 1 + Tests/GRDBTests/AssociationPrefetchingRowTests.swift | 11 +++++++---- Tests/GRDBTests/DataMemoryTests.swift | 11 +++++++---- Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift | 11 +++++++---- Tests/GRDBTests/DatabasePoolTests.swift | 11 +++++++---- Tests/GRDBTests/GRDBTestCase.swift | 11 +++++++---- .../StatementColumnConvertibleFetchTests.swift | 11 +++++++---- Tests/GRDBTests/UpdateStatementTests.swift | 11 +++++++---- 43 files changed, 283 insertions(+), 161 deletions(-) diff --git a/GRDB.swift.podspec b/GRDB.swift.podspec index a58b8eea3..5bc4b08c8 100644 --- a/GRDB.swift.podspec +++ b/GRDB.swift.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| ss.framework = 'Foundation' ss.library = 'sqlite3' ss.xcconfig = { - 'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5', + 'OTHER_SWIFT_FLAGS' => '$(inherited) -D SQLITE_ENABLE_FTS5 -D GRDBFRAMEWORK', } end diff --git a/GRDB/Core/Configuration.swift b/GRDB/Core/Configuration.swift index 1de641b15..933fb9c2b 100644 --- a/GRDB/Core/Configuration.swift +++ b/GRDB/Core/Configuration.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif #if !canImport(Darwin) diff --git a/GRDB/Core/Database+Schema.swift b/GRDB/Core/Database+Schema.swift index eb409a6b5..2a9a719d6 100644 --- a/GRDB/Core/Database+Schema.swift +++ b/GRDB/Core/Database+Schema.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif extension Database { diff --git a/GRDB/Core/Database+Statements.swift b/GRDB/Core/Database+Statements.swift index 86b2924e9..34a362b9d 100644 --- a/GRDB/Core/Database+Statements.swift +++ b/GRDB/Core/Database+Statements.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index d5342941e..2614602dd 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/DatabaseCollation.swift b/GRDB/Core/DatabaseCollation.swift index ea4ad3392..af59112ba 100644 --- a/GRDB/Core/DatabaseCollation.swift +++ b/GRDB/Core/DatabaseCollation.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/DatabaseError.swift b/GRDB/Core/DatabaseError.swift index bf808dbaa..78151bfca 100644 --- a/GRDB/Core/DatabaseError.swift +++ b/GRDB/Core/DatabaseError.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/DatabaseFunction.swift b/GRDB/Core/DatabaseFunction.swift index f6e6a84de..35bc52bd0 100644 --- a/GRDB/Core/DatabaseFunction.swift +++ b/GRDB/Core/DatabaseFunction.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A custom SQL function or aggregate. diff --git a/GRDB/Core/DatabaseSnapshotPool.swift b/GRDB/Core/DatabaseSnapshotPool.swift index 51d828df3..67a91c5cb 100644 --- a/GRDB/Core/DatabaseSnapshotPool.swift +++ b/GRDB/Core/DatabaseSnapshotPool.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_SNAPSHOT // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A database connection that allows concurrent accesses to an unchanging diff --git a/GRDB/Core/DatabaseValue.swift b/GRDB/Core/DatabaseValue.swift index 1c8e721f9..2459e3ba7 100644 --- a/GRDB/Core/DatabaseValue.swift +++ b/GRDB/Core/DatabaseValue.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 2daff6287..c4b639ae7 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/RowDecodingError.swift b/GRDB/Core/RowDecodingError.swift index 95575c954..025bb8035 100644 --- a/GRDB/Core/RowDecodingError.swift +++ b/GRDB/Core/RowDecodingError.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A key that is used to decode a value in a row diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index 1a203f685..6bf3a89ad 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/StatementAuthorizer.swift b/GRDB/Core/StatementAuthorizer.swift index fb27043a5..a8871726f 100644 --- a/GRDB/Core/StatementAuthorizer.swift +++ b/GRDB/Core/StatementAuthorizer.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif #if canImport(string_h) diff --git a/GRDB/Core/StatementColumnConvertible.swift b/GRDB/Core/StatementColumnConvertible.swift index dc9ec1b9b..490dffb7f 100644 --- a/GRDB/Core/StatementColumnConvertible.swift +++ b/GRDB/Core/StatementColumnConvertible.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A type that can decode itself from the low-level C interface to diff --git a/GRDB/Core/Support/Foundation/Data.swift b/GRDB/Core/Support/Foundation/Data.swift index 55d6bdb20..fd7d714a0 100644 --- a/GRDB/Core/Support/Foundation/Data.swift +++ b/GRDB/Core/Support/Foundation/Data.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift index fb861feb8..d857ecbc2 100644 --- a/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift +++ b/GRDB/Core/Support/Foundation/DatabaseDateComponents.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Support/Foundation/Date.swift b/GRDB/Core/Support/Foundation/Date.swift index 6676c065a..dadc00fd6 100644 --- a/GRDB/Core/Support/Foundation/Date.swift +++ b/GRDB/Core/Support/Foundation/Date.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Support/Foundation/Decimal.swift b/GRDB/Core/Support/Foundation/Decimal.swift index e200c6c59..70d84f3ab 100644 --- a/GRDB/Core/Support/Foundation/Decimal.swift +++ b/GRDB/Core/Support/Foundation/Decimal.swift @@ -1,11 +1,14 @@ #if !os(Linux) // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Support/Foundation/UUID.swift b/GRDB/Core/Support/Foundation/UUID.swift index 7595b53ef..54b18b2c8 100644 --- a/GRDB/Core/Support/Foundation/UUID.swift +++ b/GRDB/Core/Support/Foundation/UUID.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Core/Support/StandardLibrary/Optional.swift b/GRDB/Core/Support/StandardLibrary/Optional.swift index 0902097d9..253b06e53 100644 --- a/GRDB/Core/Support/StandardLibrary/Optional.swift +++ b/GRDB/Core/Support/StandardLibrary/Optional.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif extension Optional: StatementBinding where Wrapped: StatementBinding { diff --git a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift index d72cf3d19..f967fb837 100644 --- a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift +++ b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif // MARK: - Value Types diff --git a/GRDB/Core/TransactionObserver.swift b/GRDB/Core/TransactionObserver.swift index b9a747f8c..67212aad6 100644 --- a/GRDB/Core/TransactionObserver.swift +++ b/GRDB/Core/TransactionObserver.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif extension Database { diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index 54d8bbbcc..261f79d4e 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_SNAPSHOT // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// An instance of WALSnapshot records the state of a WAL mode database for some diff --git a/GRDB/Dump/DumpFormats/DebugDumpFormat.swift b/GRDB/Dump/DumpFormats/DebugDumpFormat.swift index b3ae31248..f957b1936 100644 --- a/GRDB/Dump/DumpFormats/DebugDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/DebugDumpFormat.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Dump/DumpFormats/JSONDumpFormat.swift b/GRDB/Dump/DumpFormats/JSONDumpFormat.swift index d5bc8cb10..42dd67dba 100644 --- a/GRDB/Dump/DumpFormats/JSONDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/JSONDumpFormat.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Dump/DumpFormats/LineDumpFormat.swift b/GRDB/Dump/DumpFormats/LineDumpFormat.swift index a71b05ca6..5111090e5 100644 --- a/GRDB/Dump/DumpFormats/LineDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/LineDumpFormat.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Dump/DumpFormats/ListDumpFormat.swift b/GRDB/Dump/DumpFormats/ListDumpFormat.swift index dc7bfdb6c..f5536641a 100644 --- a/GRDB/Dump/DumpFormats/ListDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/ListDumpFormat.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift b/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift index 3818c7c17..c605ae171 100644 --- a/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift +++ b/GRDB/Dump/DumpFormats/QuoteDumpFormat.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A format that prints one line per database row, formatting values diff --git a/GRDB/FTS/FTS5.swift b/GRDB/FTS/FTS5.swift index cfce95f2a..19f1d2d4b 100644 --- a/GRDB/FTS/FTS5.swift +++ b/GRDB/FTS/FTS5.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/FTS/FTS5CustomTokenizer.swift b/GRDB/FTS/FTS5CustomTokenizer.swift index 370f1256c..a209337a6 100644 --- a/GRDB/FTS/FTS5CustomTokenizer.swift +++ b/GRDB/FTS/FTS5CustomTokenizer.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif /// A type that implements a custom tokenizer for the ``FTS5`` full-text engine. diff --git a/GRDB/FTS/FTS5Tokenizer.swift b/GRDB/FTS/FTS5Tokenizer.swift index 7c25b6a89..35f3ae267 100644 --- a/GRDB/FTS/FTS5Tokenizer.swift +++ b/GRDB/FTS/FTS5Tokenizer.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/FTS/FTS5WrapperTokenizer.swift b/GRDB/FTS/FTS5WrapperTokenizer.swift index 5851866be..bda4ed181 100644 --- a/GRDB/FTS/FTS5WrapperTokenizer.swift +++ b/GRDB/FTS/FTS5WrapperTokenizer.swift @@ -1,11 +1,14 @@ #if SQLITE_ENABLE_FTS5 // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/GRDB/Record/FetchableRecord+Decodable.swift b/GRDB/Record/FetchableRecord+Decodable.swift index 99c2c0475..c54ab06bc 100644 --- a/GRDB/Record/FetchableRecord+Decodable.swift +++ b/GRDB/Record/FetchableRecord+Decodable.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/Support/GRDB.xcconfig b/Support/GRDB.xcconfig index d458e838c..840a9c24e 100644 --- a/Support/GRDB.xcconfig +++ b/Support/GRDB.xcconfig @@ -4,6 +4,7 @@ PRODUCT_NAME = GRDB PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.$(PRODUCT_NAME:rfc1034identifier) MODULEMAP_FILE = $(SRCROOT)/Support/module.modulemap SWIFT_VERSION = 6.1 +OTHER_SWIFT_FLAGS = $(inherited) -D GRDBFRAMEWORK // Slow compilation hunt: // OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -warn-long-expression-type-checking=100 -Xfrontend -warn-long-function-bodies=100 diff --git a/Support/GRDBTests.xcconfig b/Support/GRDBTests.xcconfig index 94ad77784..cdde445a3 100644 --- a/Support/GRDBTests.xcconfig +++ b/Support/GRDBTests.xcconfig @@ -2,4 +2,5 @@ // Tests still use the Swift 5 language mode. SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES +OTHER_SWIFT_FLAGS = $(inherited) -D GRDBFRAMEWORK OTHER_SWIFT_FLAGS = $(inherited) -enable-upcoming-feature GlobalActorIsolatedTypesUsability diff --git a/Tests/GRDBTests/AssociationPrefetchingRowTests.swift b/Tests/GRDBTests/AssociationPrefetchingRowTests.swift index ead7d89b9..c6fd39bd8 100644 --- a/Tests/GRDBTests/AssociationPrefetchingRowTests.swift +++ b/Tests/GRDBTests/AssociationPrefetchingRowTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest diff --git a/Tests/GRDBTests/DataMemoryTests.swift b/Tests/GRDBTests/DataMemoryTests.swift index 3f572fc30..1187ed250 100644 --- a/Tests/GRDBTests/DataMemoryTests.swift +++ b/Tests/GRDBTests/DataMemoryTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest diff --git a/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift b/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift index afa8bd32a..7302e2aa4 100644 --- a/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift +++ b/Tests/GRDBTests/DatabasePoolReleaseMemoryTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest diff --git a/Tests/GRDBTests/DatabasePoolTests.swift b/Tests/GRDBTests/DatabasePoolTests.swift index f510c48a2..b3f291d68 100644 --- a/Tests/GRDBTests/DatabasePoolTests.swift +++ b/Tests/GRDBTests/DatabasePoolTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest diff --git a/Tests/GRDBTests/GRDBTestCase.swift b/Tests/GRDBTests/GRDBTestCase.swift index 077dd2d46..af1df612b 100644 --- a/Tests/GRDBTests/GRDBTestCase.swift +++ b/Tests/GRDBTests/GRDBTestCase.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import Foundation diff --git a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift index cee0f6e95..02b77ec50 100644 --- a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift +++ b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest diff --git a/Tests/GRDBTests/UpdateStatementTests.swift b/Tests/GRDBTests/UpdateStatementTests.swift index 6a3233fdc..f11e35117 100644 --- a/Tests/GRDBTests/UpdateStatementTests.swift +++ b/Tests/GRDBTests/UpdateStatementTests.swift @@ -1,10 +1,13 @@ // Import C SQLite functions -#if SWIFT_PACKAGE -import GRDBSQLite -#elseif GRDBCIPHER +#if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher -#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER +#elseif GRDBFRAMEWORK // GRDB.xcodeproj or CocoaPods (standard subspec) import SQLite3 +#elseif GRDBCUSTOMSQLITE // GRDBCustom Framework +// #elseif SomeTrait +// import ... +#else // Default SPM trait must be the default. It impossible to detect from Xcode. +import GRDBSQLite #endif import XCTest