From edc1d646f0181fe1d4fd5d230ac4cafdeb5acbe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 12:58:08 +0200 Subject: [PATCH 1/8] [BREAKING] Bump minimum Swift version to 6.1 --- .spi.yml | 2 +- .../GRDBDemo/GRDBDemo.xcodeproj/project.pbxproj | 8 ++++---- GRDB.swift.podspec | 2 +- GRDB/Record/FetchableRecord+Decodable.swift | 6 +----- Package.swift | 2 +- README.md | 4 ++-- SQLiteCustom/GRDB.xcconfig | 2 +- Support/GRDB.xcconfig | 2 +- Tests/GRDBTests/AssociationAggregateTests.swift | 4 ---- ...ssociationBelongsToDecodableRecordTests.swift | 4 ---- .../AssociationBelongsToSQLDerivationTests.swift | 6 ------ .../AssociationHasOneSQLDerivationTests.swift | 4 ---- ...ociationHasOneThroughSQLDerivationTests.swift | 4 ---- .../AssociationTableAliasTestsSQLTests.swift | 2 -- Tests/GRDBTests/CommonTableExpressionTests.swift | 16 ---------------- Tests/GRDBTests/GRDBTestCase.swift | 5 ----- .../QueryInterfaceExpressionsTests.swift | 2 -- Tests/GRDBTests/QueryInterfaceRequestTests.swift | 16 ---------------- .../TableRecord+QueryInterfaceRequestTests.swift | 14 -------------- Tests/GRDBTests/ValueObservationTests.swift | 12 ------------ Tests/SPM/PlainPackage/Package.swift | 2 +- Tests/Swift6Migration/LanguageMode6.xcconfig | 2 +- 22 files changed, 14 insertions(+), 107 deletions(-) diff --git a/.spi.yml b/.spi.yml index 672a6aac0..d72ab58e9 100644 --- a/.spi.yml +++ b/.spi.yml @@ -2,4 +2,4 @@ version: 1 builder: configs: - documentation_targets: [GRDB] - swift_version: 6.0 + swift_version: 6.1 diff --git a/Documentation/DemoApps/GRDBDemo/GRDBDemo.xcodeproj/project.pbxproj b/Documentation/DemoApps/GRDBDemo/GRDBDemo.xcodeproj/project.pbxproj index 6edc31973..599df31db 100644 --- a/Documentation/DemoApps/GRDBDemo/GRDBDemo.xcodeproj/project.pbxproj +++ b/Documentation/DemoApps/GRDBDemo/GRDBDemo.xcodeproj/project.pbxproj @@ -382,7 +382,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 6.0; + SWIFT_VERSION = 6.1; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -411,7 +411,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 6.0; + SWIFT_VERSION = 6.1; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -427,7 +427,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 6.0; + SWIFT_VERSION = 6.1; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GRDBDemo"; }; @@ -444,7 +444,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBDemoTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = NO; - SWIFT_VERSION = 6.0; + SWIFT_VERSION = 6.1; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GRDBDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/GRDBDemo"; }; diff --git a/GRDB.swift.podspec b/GRDB.swift.podspec index 70065f822..a58b8eea3 100644 --- a/GRDB.swift.podspec +++ b/GRDB.swift.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/groue/GRDB.swift.git', :tag => "v#{s.version}" } s.module_name = 'GRDB' - s.swift_versions = ['6'] + s.swift_versions = ['6.1'] s.ios.deployment_target = '13.0' s.osx.deployment_target = '10.15' s.watchos.deployment_target = '7.0' diff --git a/GRDB/Record/FetchableRecord+Decodable.swift b/GRDB/Record/FetchableRecord+Decodable.swift index 3edf3611c..99c2c0475 100644 --- a/GRDB/Record/FetchableRecord+Decodable.swift +++ b/GRDB/Record/FetchableRecord+Decodable.swift @@ -519,20 +519,16 @@ private struct SingleValueRowDecoder: SingleValueDecodingCon func decode(_ type: Int16.Type) throws -> Int16 { try columnDecoder.decode(type) } func decode(_ type: Int32.Type) throws -> Int32 { try columnDecoder.decode(type) } func decode(_ type: Int64.Type) throws -> Int64 { try columnDecoder.decode(type) } -#if compiler(>=6) @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) func decode(_ type: Int128.Type) throws -> Int128 { try columnDecoder.decode(type) } -#endif func decode(_ type: UInt.Type) throws -> UInt { try columnDecoder.decode(type) } func decode(_ type: UInt8.Type) throws -> UInt8 { try columnDecoder.decode(type) } func decode(_ type: UInt16.Type) throws -> UInt16 { try columnDecoder.decode(type) } func decode(_ type: UInt32.Type) throws -> UInt32 { try columnDecoder.decode(type) } func decode(_ type: UInt64.Type) throws -> UInt64 { try columnDecoder.decode(type) } -#if compiler(>=6) @available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *) func decode(_ type: UInt128.Type) throws -> UInt128 { try columnDecoder.decode(type) } -#endif - + func decode(_ type: T.Type) throws -> T where T: Decodable { if let type = T.self as? any FetchableRecord.Type { // Prefer FetchableRecord decoding over Decodable. diff --git a/Package.swift b/Package.swift index 36937d039..72875fe2d 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 diff --git a/README.md b/README.md index 920bd6069..4261c65e8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@

- Swift 6 + Swift 6.1 License CI Status

@@ -27,7 +27,7 @@ **Latest release**: October 2, 2025 • [version 7.8.0](https://github.com/groue/GRDB.swift/tree/v7.8.0) • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 6 to GRDB 7](Documentation/GRDB7MigrationGuide.md) -**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ • SQLite 3.20.0+ • Swift 6+ / Xcode 16+ +**Requirements**: iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 7.0+ • SQLite 3.20.0+ • Swift 6.1+ / Xcode 16.3+ **Contact**: diff --git a/SQLiteCustom/GRDB.xcconfig b/SQLiteCustom/GRDB.xcconfig index 85a9b5316..54f7e82a4 100755 --- a/SQLiteCustom/GRDB.xcconfig +++ b/SQLiteCustom/GRDB.xcconfig @@ -13,4 +13,4 @@ OTHER_CFLAGS = -DUSING_BUILTIN_SQLITE -DGRDBCUSTOMSQLITE $(CUSTOM_SQLLIBRARY_CFL GCC_PREPROCESSOR_DEFINITIONS = "GRDBCUSTOMSQLITE=1" OTHER_SWIFT_FLAGS = -D USING_BUILTIN_SQLITE -D GRDBCUSTOMSQLITE $(CUSTOM_OTHER_SWIFT_FLAGS) HEADER_SEARCH_PATHS = $(SRCROOT)/SQLiteCustom/src -SWIFT_VERSION = 6.0 +SWIFT_VERSION = 6.1 diff --git a/Support/GRDB.xcconfig b/Support/GRDB.xcconfig index a3fabb088..d458e838c 100644 --- a/Support/GRDB.xcconfig +++ b/Support/GRDB.xcconfig @@ -3,7 +3,7 @@ INFOPLIST_FILE = Support/Info.plist PRODUCT_NAME = GRDB PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.$(PRODUCT_NAME:rfc1034identifier) MODULEMAP_FILE = $(SRCROOT)/Support/module.modulemap -SWIFT_VERSION = 6.0 +SWIFT_VERSION = 6.1 // Slow compilation hunt: // OTHER_SWIFT_FLAGS = $(inherited) -Xfrontend -warn-long-expression-type-checking=100 -Xfrontend -warn-long-function-bodies=100 diff --git a/Tests/GRDBTests/AssociationAggregateTests.swift b/Tests/GRDBTests/AssociationAggregateTests.swift index 268172100..5037651ff 100644 --- a/Tests/GRDBTests/AssociationAggregateTests.swift +++ b/Tests/GRDBTests/AssociationAggregateTests.swift @@ -122,7 +122,6 @@ class AssociationAggregateTests: GRDBTestCase { } } - #if compiler(>=6.1) func testAggregateWithGroup_swift61() throws { let dbQueue = try makeDatabaseQueue() try dbQueue.read { db in @@ -139,7 +138,6 @@ class AssociationAggregateTests: GRDBTestCase { """) } } - #endif func testAnnotatedWithHasManyDefaultAverage() throws { let dbQueue = try makeDatabaseQueue() @@ -296,7 +294,6 @@ class AssociationAggregateTests: GRDBTestCase { } } - #if compiler(>=6.1) func testAnnotatedWithHasManyDefaultMax_Swift61() throws { let dbQueue = try makeDatabaseQueue() try dbQueue.read { db in @@ -333,7 +330,6 @@ class AssociationAggregateTests: GRDBTestCase { XCTAssertEqual(teamInfos[3].maxPlayerScore, 0) } } - #endif func testAnnotatedWithHasManyDefaultMaxJoiningRequired() throws { // It is important to have an explicit test for this technique because diff --git a/Tests/GRDBTests/AssociationBelongsToDecodableRecordTests.swift b/Tests/GRDBTests/AssociationBelongsToDecodableRecordTests.swift index 9e1518cf8..4a6a2baf8 100644 --- a/Tests/GRDBTests/AssociationBelongsToDecodableRecordTests.swift +++ b/Tests/GRDBTests/AssociationBelongsToDecodableRecordTests.swift @@ -53,14 +53,12 @@ private extension QueryInterfaceRequest { .order { [teamAlias[Team.Columns.name], $0.name] } } -#if compiler(>=6.1) func orderedByTeamName_swift61() -> QueryInterfaceRequest { let teamAlias = TableAlias() return self .joining(optional: PlayerWithOptionalTeam.team.aliased(teamAlias)) .order { [teamAlias.name, $0.name] } } -#endif } /// Test support for Decodable records @@ -190,7 +188,6 @@ class AssociationBelongsToDecodableRecordTests: GRDBTestCase { XCTAssertEqual(records[0].team.name, "Reds") } -#if compiler(>=6.1) func testRequestRefining_swift61() throws { let dbQueue = try makeDatabaseQueue() let request = Player @@ -212,5 +209,4 @@ class AssociationBelongsToDecodableRecordTests: GRDBTestCase { XCTAssertEqual(records[0].team.id, 1) XCTAssertEqual(records[0].team.name, "Reds") } -#endif } diff --git a/Tests/GRDBTests/AssociationBelongsToSQLDerivationTests.swift b/Tests/GRDBTests/AssociationBelongsToSQLDerivationTests.swift index 694d63eb1..655365491 100644 --- a/Tests/GRDBTests/AssociationBelongsToSQLDerivationTests.swift +++ b/Tests/GRDBTests/AssociationBelongsToSQLDerivationTests.swift @@ -119,7 +119,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { JOIN "b" ON "b"."id" = "a"."bid" """) } - #if compiler(>=6.1) do { let aAlias = TableAlias() let request = A @@ -135,7 +134,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { JOIN "b" ON "b"."id" = "a"."bid" """) } - #endif } } @@ -178,7 +176,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { JOIN "b" ON ("b"."id" = "a"."bid") AND ("b"."id" IN ("a"."id", "b"."id", 42)) """) } - #if compiler(>=6.1) do { let alias = TableAlias() let request = A @@ -191,7 +188,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { JOIN "b" ON ("b"."id" = "a"."bid") AND ("b"."id" IN ("a"."id", "b"."id", 42)) """) } - #endif do { let request = A.including(required: A.b.filter(key: ["id": 1])) try assertEqualSQL(db, request, """ @@ -237,7 +233,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { WHERE "b"."name" IS NOT NULL """) } - #if compiler(>=6.1) do { let bAlias = TableAlias() let request = A @@ -250,7 +245,6 @@ class AssociationBelongsToSQLDerivationTests: GRDBTestCase { WHERE "b"."name" IS NOT NULL """) } - #endif } } diff --git a/Tests/GRDBTests/AssociationHasOneSQLDerivationTests.swift b/Tests/GRDBTests/AssociationHasOneSQLDerivationTests.swift index 686fa14b7..85329f82f 100644 --- a/Tests/GRDBTests/AssociationHasOneSQLDerivationTests.swift +++ b/Tests/GRDBTests/AssociationHasOneSQLDerivationTests.swift @@ -119,7 +119,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase { JOIN "b" ON "b"."aid" = "a"."id" """) } - #if compiler(>=6.1) do { let aAlias = TableAlias() let request = A @@ -135,7 +134,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase { JOIN "b" ON "b"."aid" = "a"."id" """) } - #endif } } @@ -211,7 +209,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase { WHERE "b"."name" IS NOT NULL """) } - #if compiler(>=6.1) do { let bAlias = TableAlias() let request = A @@ -224,7 +221,6 @@ class AssociationHasOneSQLDerivationTests: GRDBTestCase { WHERE "b"."name" IS NOT NULL """) } - #endif } } diff --git a/Tests/GRDBTests/AssociationHasOneThroughSQLDerivationTests.swift b/Tests/GRDBTests/AssociationHasOneThroughSQLDerivationTests.swift index 913327259..e793a9180 100644 --- a/Tests/GRDBTests/AssociationHasOneThroughSQLDerivationTests.swift +++ b/Tests/GRDBTests/AssociationHasOneThroughSQLDerivationTests.swift @@ -138,7 +138,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase { JOIN "c" ON "c"."id" = "b"."cId" """) } - #if compiler(>=6.1) do { let aAlias = TableAlias() let request = A @@ -155,7 +154,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase { JOIN "c" ON "c"."id" = "b"."cId" """) } - #endif } } @@ -238,7 +236,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase { WHERE "c"."name" IS NOT NULL """) } - #if compiler(>=6.1) do { let cAlias = TableAlias() let request = A @@ -252,7 +249,6 @@ class AssociationHasOneThroughSQLDerivationTests: GRDBTestCase { WHERE "c"."name" IS NOT NULL """) } - #endif } } diff --git a/Tests/GRDBTests/AssociationTableAliasTestsSQLTests.swift b/Tests/GRDBTests/AssociationTableAliasTestsSQLTests.swift index c95f3a266..f7ff69f36 100644 --- a/Tests/GRDBTests/AssociationTableAliasTestsSQLTests.swift +++ b/Tests/GRDBTests/AssociationTableAliasTestsSQLTests.swift @@ -130,7 +130,6 @@ class AssociationTableAliasTestsSQLTests : GRDBTestCase { } } - #if compiler(>=6.1) func testTableAliasBasics_swift61() throws { // A table reference qualifies all unqualified selectables, expressions, and orderings @@ -208,7 +207,6 @@ class AssociationTableAliasTestsSQLTests : GRDBTestCase { } } } - #endif func testRecursiveRelationDepth1() throws { // A.include(A.parent) diff --git a/Tests/GRDBTests/CommonTableExpressionTests.swift b/Tests/GRDBTests/CommonTableExpressionTests.swift index 1d87105e4..361379974 100644 --- a/Tests/GRDBTests/CommonTableExpressionTests.swift +++ b/Tests/GRDBTests/CommonTableExpressionTests.swift @@ -101,7 +101,6 @@ class CommonTableExpressionTests: GRDBTestCase { LEFT JOIN "cte" ON "t"."id" > "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression(named: "cte", request: T.all()) let request = T.all() @@ -114,7 +113,6 @@ class CommonTableExpressionTests: GRDBTestCase { LEFT JOIN "cte" ON "t"."id" > "cte"."id" """) } - #endif // Include SQL request as a CTE do { @@ -131,7 +129,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression( named: "cte", @@ -146,7 +143,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #endif // Include a filtered SQL request as a CTE do { @@ -180,7 +176,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression( named: "cte", @@ -196,7 +191,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #endif // Include SQL request as a CTE (custom column name) do { @@ -214,7 +208,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression( named: "cte", @@ -230,7 +223,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" = "cte"."id" """) } - #endif // Include SQL request as a CTE (empty ON clause) do { @@ -261,7 +253,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" > "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression(named: "cte", request: T.all()) let request = T.all() @@ -274,7 +265,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" > "cte"."id" """) } - #endif // Include filtered CTE do { @@ -336,7 +326,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" > "cte"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression(named: "cte", request: T.all()) let request = T.all() @@ -350,7 +339,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON "t"."id" > "cte"."id" """) } - #endif // Include one CTE twice with same key but different condition (last condition wins) do { @@ -366,7 +354,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON ("t"."id" + "cte"."id") = 1 """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression(named: "cte", request: T.all()) let request = T.all() @@ -380,7 +367,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" ON ("t"."id" + "cte"."id") = 1 """) } - #endif // Include one CTE twice with different keys do { @@ -397,7 +383,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" "cte2" ON "t"."id" < "cte2"."id" """) } - #if compiler(>=6.1) do { let cte = CommonTableExpression(named: "cte", request: T.all()) let request = T.all() @@ -412,7 +397,6 @@ class CommonTableExpressionTests: GRDBTestCase { JOIN "cte" "cte2" ON "t"."id" < "cte2"."id" """) } - #endif // Chain CTE includes do { diff --git a/Tests/GRDBTests/GRDBTestCase.swift b/Tests/GRDBTests/GRDBTestCase.swift index 915702a98..077dd2d46 100644 --- a/Tests/GRDBTests/GRDBTestCase.swift +++ b/Tests/GRDBTests/GRDBTestCase.swift @@ -271,8 +271,3 @@ struct AnyValueReducerFetcher: _ValueReducerFetcher { try _fetch(db) } } - -#if compiler(<6.1) -// XCTestExpectation is Sendable starting Xcode 16.3 beta. -extension XCTestExpectation: @unchecked Sendable { } -#endif diff --git a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift index 93592c7c6..b1e7a1b4d 100644 --- a/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift +++ b/Tests/GRDBTests/QueryInterfaceExpressionsTests.swift @@ -481,7 +481,6 @@ class QueryInterfaceExpressionsTests: GRDBTestCase { SELECT * FROM "team" WHERE EXISTS (SELECT * FROM "player" WHERE "teamID" = "team"."id") """) } - #if compiler(>=6.1) do { let teamAlias = TableAlias() let player = Player.filter { $0.teamID == teamAlias.id } @@ -490,7 +489,6 @@ class QueryInterfaceExpressionsTests: GRDBTestCase { SELECT * FROM "team" WHERE EXISTS (SELECT * FROM "player" WHERE "teamID" = "team"."id") """) } - #endif } } diff --git a/Tests/GRDBTests/QueryInterfaceRequestTests.swift b/Tests/GRDBTests/QueryInterfaceRequestTests.swift index 43e510b95..cf93a8f6e 100644 --- a/Tests/GRDBTests/QueryInterfaceRequestTests.swift +++ b/Tests/GRDBTests/QueryInterfaceRequestTests.swift @@ -415,7 +415,6 @@ class QueryInterfaceRequestTests: GRDBTestCase { JOIN "author" ON "author"."id" = "book"."authorId" """) } - #if compiler(>=6.1) do { let alias = TableAlias() let request = Book @@ -435,7 +434,6 @@ class QueryInterfaceRequestTests: GRDBTestCase { JOIN "author" ON "author"."id" = "book"."authorId" """) } - #endif } } @@ -912,11 +910,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age }), "SELECT * FROM \"readers\" ORDER BY \"age\"") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age)), "SELECT * FROM \"readers\" ORDER BY \"age\"") - #endif XCTAssertEqual( sql(dbQueue, tableRequest.order(Columns.age.asc)), @@ -924,11 +920,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.asc }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.asc)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC") - #endif XCTAssertEqual( sql(dbQueue, tableRequest.order(Columns.age.desc)), @@ -936,11 +930,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.desc }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.desc)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC") - #endif XCTAssertEqual( sql(dbQueue, tableRequest.order(Columns.age, Columns.name.desc)), @@ -963,11 +955,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.ascNullsLast }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.ascNullsLast)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #endif XCTAssertEqual( sql(dbQueue, tableRequest.order(Columns.age.descNullsFirst)), @@ -975,11 +965,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.descNullsFirst }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.descNullsFirst)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #endif #elseif !GRDBCIPHER if #available(iOS 14, macOS 10.16, tvOS 14, *) { XCTAssertEqual( @@ -988,11 +976,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.ascNullsLast }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.ascNullsLast)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #endif XCTAssertEqual( sql(dbQueue, tableRequest.order(Columns.age.descNullsFirst)), @@ -1000,11 +986,9 @@ class QueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, tableRequest.order { $0.age.descNullsFirst }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, tableRequest.order(\.age.descNullsFirst)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #endif } #endif } diff --git a/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift b/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift index 8df2e73a6..a40d67b05 100644 --- a/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift +++ b/Tests/GRDBTests/TableRecord+QueryInterfaceRequestTests.swift @@ -303,11 +303,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age }), "SELECT * FROM \"readers\" ORDER BY \"age\"") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age)), "SELECT * FROM \"readers\" ORDER BY \"age\"") - #endif XCTAssertEqual( sql(dbQueue, Reader.order(Columns.age.asc)), @@ -315,11 +313,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.asc }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.asc)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC") - #endif XCTAssertEqual( sql(dbQueue, Reader.order(Columns.age.desc)), @@ -327,11 +323,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.desc }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.desc)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC") - #endif XCTAssertEqual( sql(dbQueue, Reader.order(Columns.age, Columns.name.desc)), @@ -354,11 +348,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.ascNullsLast }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.ascNullsLast)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #endif XCTAssertEqual( sql(dbQueue, Reader.order(Columns.age.descNullsFirst)), @@ -366,11 +358,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.descNullsFirst }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.descNullsFirst)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #endif #elseif !GRDBCIPHER if #available(iOS 14, macOS 10.16, tvOS 14, *) { XCTAssertEqual( @@ -379,11 +369,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.ascNullsLast }), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.ascNullsLast)), "SELECT * FROM \"readers\" ORDER BY \"age\" ASC NULLS LAST") - #endif XCTAssertEqual( sql(dbQueue, Reader.order(Columns.age.descNullsFirst)), @@ -391,11 +379,9 @@ class TableRecordQueryInterfaceRequestTests: GRDBTestCase { XCTAssertEqual( sql(dbQueue, Reader.order { $0.age.descNullsFirst }), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #if compiler(>=6.1) XCTAssertEqual( sql(dbQueue, Reader.order(\.age.descNullsFirst)), "SELECT * FROM \"readers\" ORDER BY \"age\" DESC NULLS FIRST") - #endif } #endif } diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index ae5c09ff8..d1aa1250f 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -952,11 +952,7 @@ class ValueObservationTests: GRDBTestCase { XCTAssertEqual(counts.sorted(), counts) // Observation was ended -#if compiler(>=5.8) await fulfillment(of: [cancellationExpectation], timeout: 2) -#else - wait(for: [cancellationExpectation], timeout: 2) -#endif } try await AsyncTest(test).run { try DatabaseQueue() } @@ -993,11 +989,7 @@ class ValueObservationTests: GRDBTestCase { XCTAssertEqual(counts.sorted(), counts) // Observation was ended -#if compiler(>=5.8) await fulfillment(of: [cancellationExpectation], timeout: 2) -#else - wait(for: [cancellationExpectation], timeout: 2) -#endif } try await AsyncTest(test).run { try DatabaseQueue() } @@ -1043,11 +1035,7 @@ class ValueObservationTests: GRDBTestCase { XCTAssertEqual(cancelledValue, "cancelled loop") // Make sure observation was cancelled as well -#if compiler(>=5.8) await fulfillment(of: [cancellationExpectation], timeout: 2) -#else - wait(for: [cancellationExpectation], timeout: 2) -#endif } try await AsyncTest(test).run { try DatabaseQueue() } diff --git a/Tests/SPM/PlainPackage/Package.swift b/Tests/SPM/PlainPackage/Package.swift index 6b6996999..001925b4d 100644 --- a/Tests/SPM/PlainPackage/Package.swift +++ b/Tests/SPM/PlainPackage/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 PackageDescription diff --git a/Tests/Swift6Migration/LanguageMode6.xcconfig b/Tests/Swift6Migration/LanguageMode6.xcconfig index 3ce1f8ea2..2a034a2d5 100644 --- a/Tests/Swift6Migration/LanguageMode6.xcconfig +++ b/Tests/Swift6Migration/LanguageMode6.xcconfig @@ -1,5 +1,5 @@ // Swift 6 mode -SWIFT_VERSION = 6.0 +SWIFT_VERSION = 6.1 // Recommended settings // SWIFT_UPCOMING_FEATURE_INFER_SENDABLE_FROM_CAPTURES = YES From 5cc85a98f3962d214f020328d90858343a3623c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 13:16:51 +0200 Subject: [PATCH 2/8] Only depend on GRDBSQLite when the default GRDBSQLite trait is active. --- Package.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 72875fe2d..b6c3c2e84 100644 --- a/Package.swift +++ b/Package.swift @@ -42,13 +42,19 @@ let package = Package( .library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]), ], dependencies: dependencies, + traits: [ + "GRDBSQLite", + .default(enabledTraits: ["GRDBSQLite"]), + ], targets: [ .systemLibrary( name: "GRDBSQLite", providers: [.apt(["libsqlite3-dev"])]), .target( name: "GRDB", - dependencies: ["GRDBSQLite"], + dependencies: [ + .target("GRDBSQLite", traits: ["GRDBSQLite"]), + ], path: "GRDB", resources: [.copy("PrivacyInfo.xcprivacy")], cSettings: cSettings, From 9a98ed6292880f80ff8abb5275ca34a99feb7d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 13:27:40 +0200 Subject: [PATCH 3/8] Enable SQLITE_ENABLE_SNAPSHOT in the GRDBSQLite trait, on Darwin platforms --- Package.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index b6c3c2e84..fdd896959 100644 --- a/Package.swift +++ b/Package.swift @@ -4,8 +4,18 @@ import Foundation import PackageDescription +let darwinPlatforms: [Platform] = [ + .iOS, + .macOS, + .macCatalyst, + .tvOS, + .visionOS, + .watchOS, +] var swiftSettings: [SwiftSetting] = [ .define("SQLITE_ENABLE_FTS5"), + // SQLite snapshots are available on the system SQLite on Darwin platforms. + .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), ] var cSettings: [CSetting] = [] var dependencies: [PackageDescription.Package.Dependency] = [] @@ -41,11 +51,11 @@ let package = Package( .library(name: "GRDB", targets: ["GRDB"]), .library(name: "GRDB-dynamic", type: .dynamic, targets: ["GRDB"]), ], - dependencies: dependencies, traits: [ "GRDBSQLite", .default(enabledTraits: ["GRDBSQLite"]), ], + dependencies: dependencies, targets: [ .systemLibrary( name: "GRDBSQLite", @@ -53,7 +63,7 @@ let package = Package( .target( name: "GRDB", dependencies: [ - .target("GRDBSQLite", traits: ["GRDBSQLite"]), + .target(name: "GRDBSQLite", condition: .when(traits: ["GRDBSQLite"])), ], path: "GRDB", resources: [.copy("PrivacyInfo.xcprivacy")], From d06c9ed6b51b1d7a683902bf0a60cef676baa3ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 13:28:13 +0200 Subject: [PATCH 4/8] Enable SQLITE_ENABLE_SNAPSHOT in the Xcode GRDB framework --- Support/GRDBDeploymentTarget.xcconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Support/GRDBDeploymentTarget.xcconfig b/Support/GRDBDeploymentTarget.xcconfig index eb0e48eac..4c43433c8 100644 --- a/Support/GRDBDeploymentTarget.xcconfig +++ b/Support/GRDBDeploymentTarget.xcconfig @@ -2,7 +2,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 13.0 MACOSX_DEPLOYMENT_TARGET = 10.15 TVOS_DEPLOYMENT_TARGET = 13.0 WATCHOS_DEPLOYMENT_TARGET = 7.0 -OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5 +OTHER_SWIFT_FLAGS = $(inherited) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_SNAPSHOT //// Compile with all opt-in APIs //GCC_PREPROCESSOR_DEFINITIONS = $(inherited) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1 From b1b83abd8be52321199f744d179939d2d91eddd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 13:30:08 +0200 Subject: [PATCH 5/8] Simplify the compiler checks for the availability of SQLite snapshots --- GRDB/Core/DatabasePool.swift | 4 +- GRDB/Core/DatabaseSnapshotPool.swift | 2 +- GRDB/Core/WALSnapshot.swift | 14 +----- GRDB/Core/WALSnapshotTransaction.swift | 2 +- .../Observers/ValueConcurrentObserver.swift | 2 +- .../DatabaseReaderReadPublisherTests.swift | 12 ++--- .../DatabaseAbortedTransactionTests.swift | 4 +- .../DatabaseConfigurationTests.swift | 4 +- Tests/GRDBTests/DatabasePoolTests.swift | 8 ++-- Tests/GRDBTests/DatabaseReaderTests.swift | 48 +++++++++---------- .../GRDBTests/DatabaseSnapshotPoolTests.swift | 2 +- .../ValueObservationPrintTests.swift | 8 ++-- Tests/GRDBTests/ValueObservationTests.swift | 10 ++-- 13 files changed, 54 insertions(+), 66 deletions(-) diff --git a/GRDB/Core/DatabasePool.swift b/GRDB/Core/DatabasePool.swift index 21b5db750..d4634cee6 100644 --- a/GRDB/Core/DatabasePool.swift +++ b/GRDB/Core/DatabasePool.swift @@ -684,7 +684,7 @@ extension DatabasePool: DatabaseReader { // MARK: - WAL Snapshot Transactions -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT /// Returns a long-lived WAL snapshot transaction on a reader connection. func walSnapshotTransaction() throws -> WALSnapshotTransaction { guard let readerPool else { @@ -950,7 +950,7 @@ extension DatabasePool { purpose: "snapshot.\(databaseSnapshotCountMutex.increment())") } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT /// Creates a database snapshot that allows concurrent accesses to an /// unchanging database content, as it exists at the moment the snapshot /// is created. diff --git a/GRDB/Core/DatabaseSnapshotPool.swift b/GRDB/Core/DatabaseSnapshotPool.swift index 29820afe8..51d828df3 100644 --- a/GRDB/Core/DatabaseSnapshotPool.swift +++ b/GRDB/Core/DatabaseSnapshotPool.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // Import C SQLite functions #if SWIFT_PACKAGE import GRDBSQLite diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index a8c0168a7..54d8bbbcc 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // Import C SQLite functions #if SWIFT_PACKAGE import GRDBSQLite @@ -16,18 +16,6 @@ import SQLite3 /// actual observation. This class has no other purpose, and is not intended to /// become public. /// -/// It does not work with SQLCipher, because SQLCipher does not support -/// `SQLITE_ENABLE_SNAPSHOT` correctly: we have linker errors. -/// See . -/// -/// With custom SQLite builds, it only works if `SQLITE_ENABLE_SNAPSHOT` -/// is defined. -/// -/// With system SQLite, it works because the SDK exposes the C apis and -/// since XCode 14. -/// -/// Yes, this is an awfully complex logic. -/// /// See . final class WALSnapshot: @unchecked Sendable { // @unchecked because sqlite3_snapshot has no threading requirements. diff --git a/GRDB/Core/WALSnapshotTransaction.swift b/GRDB/Core/WALSnapshotTransaction.swift index 9e961bde3..2caeb69a3 100644 --- a/GRDB/Core/WALSnapshotTransaction.swift +++ b/GRDB/Core/WALSnapshotTransaction.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT /// A long-live read-only WAL transaction. /// /// `WALSnapshotTransaction` **takes ownership** of its reader diff --git a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift index 9cc507ddf..22f124a71 100644 --- a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift +++ b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift @@ -276,7 +276,7 @@ extension ValueConcurrentObserver { } } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT extension ValueConcurrentObserver { /// Synchronously starts the observation, and returns the initial value. /// diff --git a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift index 9d7f4a813..fbc35dcaa 100644 --- a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift +++ b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift @@ -40,7 +40,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -141,7 +141,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } @@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -213,7 +213,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -250,7 +250,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -274,7 +274,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } diff --git a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift index 1ac85a08f..974386bdf 100644 --- a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift +++ b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift @@ -40,7 +40,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -85,7 +85,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/DatabaseConfigurationTests.swift b/Tests/GRDBTests/DatabaseConfigurationTests.swift index 64a09cf51..f00acecbb 100644 --- a/Tests/GRDBTests/DatabaseConfigurationTests.swift +++ b/Tests/GRDBTests/DatabaseConfigurationTests.swift @@ -27,7 +27,7 @@ class DatabaseConfigurationTests: GRDBTestCase { try pool.makeSnapshot().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 5) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try pool.makeSnapshotPool().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 6) #endif @@ -74,7 +74,7 @@ class DatabaseConfigurationTests: GRDBTestCase { XCTFail("Expected TestError") } catch is TestError { } -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT do { errorMutex.store(TestError()) _ = try pool.makeSnapshotPool() diff --git a/Tests/GRDBTests/DatabasePoolTests.swift b/Tests/GRDBTests/DatabasePoolTests.swift index e1ab57bbd..f510c48a2 100644 --- a/Tests/GRDBTests/DatabasePoolTests.swift +++ b/Tests/GRDBTests/DatabasePoolTests.swift @@ -50,7 +50,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -74,7 +74,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -100,7 +100,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -123,7 +123,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") diff --git a/Tests/GRDBTests/DatabaseReaderTests.swift b/Tests/GRDBTests/DatabaseReaderTests.swift index ca5a10378..205f596e7 100644 --- a/Tests/GRDBTests/DatabaseReaderTests.swift +++ b/Tests/GRDBTests/DatabaseReaderTests.swift @@ -46,7 +46,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -87,7 +87,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -106,7 +106,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -152,7 +152,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -176,7 +176,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -196,7 +196,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -243,7 +243,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -272,7 +272,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -292,7 +292,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -312,7 +312,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -339,7 +339,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshotPool()) #endif } @@ -358,7 +358,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -375,7 +375,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -410,7 +410,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -443,7 +443,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -481,7 +481,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -523,7 +523,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -558,7 +558,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -591,7 +591,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -629,7 +629,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -671,7 +671,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -719,7 +719,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) diff --git a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift index 3235f5db9..4d1dc5f55 100644 --- a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT import XCTest import GRDB diff --git a/Tests/GRDBTests/ValueObservationPrintTests.swift b/Tests/GRDBTests/ValueObservationPrintTests.swift index 9ed1a4433..dc77bc822 100644 --- a/Tests/GRDBTests/ValueObservationPrintTests.swift +++ b/Tests/GRDBTests/ValueObservationPrintTests.swift @@ -55,7 +55,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -92,7 +92,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -168,7 +168,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index d1aa1250f..e1b4c62a5 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -462,7 +462,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -516,7 +516,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -543,7 +543,7 @@ class ValueObservationTests: GRDBTestCase { // MARK: - Snapshot Observation -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT func testDatabaseSnapshotPoolObservation() throws { let dbPool = try makeDatabasePool() try dbPool.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") } @@ -1065,7 +1065,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "initialValue") -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice @@ -1123,7 +1123,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "") -#if SQLITE_ENABLE_SNAPSHOT || (!GRDBCUSTOMSQLITE && !GRDBCIPHER) +#if SQLITE_ENABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice From 17e1683b66570127b0b7a03fb6a26a13aa06bdce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 4 Oct 2025 14:00:49 +0200 Subject: [PATCH 6/8] Bump CI to macOS 15 and Xcode 16.4 --- .github/workflows/CI.yml | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d262a8272..6f453ec23 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,4 +1,4 @@ -# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md +# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md name: "GRDB CI" @@ -40,17 +40,17 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 destination: "platform=macOS" name: "macOS" - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - destination: "OS=18.1,name=iPhone 16 Pro" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + destination: "OS=18.5,name=iPhone 16 Pro" name: "iOS" - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - destination: "OS=18.1,name=Apple TV" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + destination: "OS=18.5,name=Apple TV" name: "tvOS" steps: - uses: actions/checkout@v5 @@ -66,9 +66,9 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - name: "Xcode 16.1" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + name: "Xcode 16.4" steps: - uses: actions/checkout@v5 - name: ${{ matrix.name }} @@ -83,9 +83,9 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - name: "Xcode 16.1" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + name: "Xcode 16.4" steps: - uses: actions/checkout@v5 - name: ${{ matrix.name }} @@ -100,9 +100,9 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - name: "Xcode 16.1" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + name: "Xcode 16.4" steps: - uses: actions/checkout@v5 - name: ${{ matrix.name }} @@ -117,9 +117,9 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - name: "Xcode 16.1" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + name: "Xcode 16.4" steps: - uses: actions/checkout@v5 - name: ${{ matrix.name }} @@ -134,9 +134,9 @@ jobs: fail-fast: false matrix: include: - - xcode: "Xcode_16.1.app" - runsOn: macOS-14 - name: "Xcode 16.1" + - xcode: "Xcode_16.4.app" + runsOn: macOS-15 + name: "Xcode 16.4" steps: - uses: actions/checkout@v5 - name: ${{ matrix.name }} 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 7/8] 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 From 361a482b1e8e7fb5ff9aed049d0f7a30cdd10373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sun, 12 Oct 2025 14:03:09 +0200 Subject: [PATCH 8/8] Enable SQLITE_ENABLE_SNAPSHOT by default and introduce SQLITE_DISABLE_SNAPSHOT --- GRDB/Core/DatabasePool.swift | 4 +- GRDB/Core/DatabaseSnapshotPool.swift | 2 +- GRDB/Core/WALSnapshot.swift | 2 +- GRDB/Core/WALSnapshotTransaction.swift | 2 +- .../Observers/ValueConcurrentObserver.swift | 2 +- Package.swift | 9 +++- .../DatabaseReaderReadPublisherTests.swift | 12 ++--- .../DatabaseAbortedTransactionTests.swift | 4 +- .../DatabaseConfigurationTests.swift | 4 +- Tests/GRDBTests/DatabasePoolTests.swift | 8 ++-- Tests/GRDBTests/DatabaseReaderTests.swift | 48 +++++++++---------- .../GRDBTests/DatabaseSnapshotPoolTests.swift | 2 +- .../ValueObservationPrintTests.swift | 8 ++-- Tests/GRDBTests/ValueObservationTests.swift | 10 ++-- 14 files changed, 61 insertions(+), 56 deletions(-) diff --git a/GRDB/Core/DatabasePool.swift b/GRDB/Core/DatabasePool.swift index d4634cee6..08f4c2610 100644 --- a/GRDB/Core/DatabasePool.swift +++ b/GRDB/Core/DatabasePool.swift @@ -684,7 +684,7 @@ extension DatabasePool: DatabaseReader { // MARK: - WAL Snapshot Transactions -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// Returns a long-lived WAL snapshot transaction on a reader connection. func walSnapshotTransaction() throws -> WALSnapshotTransaction { guard let readerPool else { @@ -950,7 +950,7 @@ extension DatabasePool { purpose: "snapshot.\(databaseSnapshotCountMutex.increment())") } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// Creates a database snapshot that allows concurrent accesses to an /// unchanging database content, as it exists at the moment the snapshot /// is created. diff --git a/GRDB/Core/DatabaseSnapshotPool.swift b/GRDB/Core/DatabaseSnapshotPool.swift index 67a91c5cb..4604c9c2c 100644 --- a/GRDB/Core/DatabaseSnapshotPool.swift +++ b/GRDB/Core/DatabaseSnapshotPool.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Import C SQLite functions #if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher diff --git a/GRDB/Core/WALSnapshot.swift b/GRDB/Core/WALSnapshot.swift index 261f79d4e..729a8ac80 100644 --- a/GRDB/Core/WALSnapshot.swift +++ b/GRDB/Core/WALSnapshot.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Import C SQLite functions #if GRDBCIPHER // CocoaPods (SQLCipher subspec) import SQLCipher diff --git a/GRDB/Core/WALSnapshotTransaction.swift b/GRDB/Core/WALSnapshotTransaction.swift index 2caeb69a3..22f6c90a7 100644 --- a/GRDB/Core/WALSnapshotTransaction.swift +++ b/GRDB/Core/WALSnapshotTransaction.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT /// A long-live read-only WAL transaction. /// /// `WALSnapshotTransaction` **takes ownership** of its reader diff --git a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift index 22f124a71..d75b89c73 100644 --- a/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift +++ b/GRDB/ValueObservation/Observers/ValueConcurrentObserver.swift @@ -276,7 +276,7 @@ extension ValueConcurrentObserver { } } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT extension ValueConcurrentObserver { /// Synchronously starts the observation, and returns the initial value. /// diff --git a/Package.swift b/Package.swift index fdd896959..9d0c79554 100644 --- a/Package.swift +++ b/Package.swift @@ -14,8 +14,13 @@ let darwinPlatforms: [Platform] = [ ] var swiftSettings: [SwiftSetting] = [ .define("SQLITE_ENABLE_FTS5"), - // SQLite snapshots are available on the system SQLite on Darwin platforms. - .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), + // Until Xcode has proper support for package traits, we must enable + // SQLITE_ENABLE_SNAPSHOT by default so that Xcode projects that build + // a Darwin app can depend on GRDB and profit from WAL snapshots. + // Package traits who want to disable snapshots must set SQLITE_DISABLE_SNAPSHOT. + // TODO: when Xcode support traits, remove all mentions of SQLITE_DISABLE_SNAPSHOT and update as below: + // .define("SQLITE_ENABLE_SNAPSHOT", .when(platforms: darwinPlatforms, traits: ["GRDBSQLite"])), + .define("SQLITE_ENABLE_SNAPSHOT"), ] var cSettings: [CSetting] = [] var dependencies: [PackageDescription.Package.Dependency] = [] diff --git a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift index fbc35dcaa..baefd0dcd 100644 --- a/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift +++ b/Tests/GRDBCombineTests/DatabaseReaderReadPublisherTests.swift @@ -40,7 +40,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -141,7 +141,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } @@ -177,7 +177,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -213,7 +213,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -250,7 +250,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try setUp(DatabaseQueue(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)) } try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try setUp(DatabasePool(path: $0)).makeSnapshotPool() } #endif } @@ -274,7 +274,7 @@ class DatabaseReaderReadPublisherTests : XCTestCase { try Test(test).runAtTemporaryDatabasePath { try DatabaseQueue(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0) } try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshot() } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try Test(test).runAtTemporaryDatabasePath { try DatabasePool(path: $0).makeSnapshotPool() } #endif } diff --git a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift index 974386bdf..3d3654f2a 100644 --- a/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift +++ b/Tests/GRDBTests/DatabaseAbortedTransactionTests.swift @@ -40,7 +40,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -85,7 +85,7 @@ class DatabaseAbortedTransactionTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/DatabaseConfigurationTests.swift b/Tests/GRDBTests/DatabaseConfigurationTests.swift index f00acecbb..f0739ba1c 100644 --- a/Tests/GRDBTests/DatabaseConfigurationTests.swift +++ b/Tests/GRDBTests/DatabaseConfigurationTests.swift @@ -27,7 +27,7 @@ class DatabaseConfigurationTests: GRDBTestCase { try pool.makeSnapshot().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 5) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try pool.makeSnapshotPool().read { _ in } XCTAssertEqual(connectionCountMutex.load(), 6) #endif @@ -74,7 +74,7 @@ class DatabaseConfigurationTests: GRDBTestCase { XCTFail("Expected TestError") } catch is TestError { } -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT do { errorMutex.store(TestError()) _ = try pool.makeSnapshotPool() diff --git a/Tests/GRDBTests/DatabasePoolTests.swift b/Tests/GRDBTests/DatabasePoolTests.swift index b3f291d68..f8192e58f 100644 --- a/Tests/GRDBTests/DatabasePoolTests.swift +++ b/Tests/GRDBTests/DatabasePoolTests.swift @@ -53,7 +53,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -77,7 +77,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -103,7 +103,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") @@ -126,7 +126,7 @@ class DatabasePoolTests: GRDBTestCase { XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-wal")) XCTAssertTrue(fm.fileExists(atPath: dbPool.path + "-shm")) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // A non-empty wal file makes sure ValueObservation can use wal snapshots. // See let walURL = URL(fileURLWithPath: dbPool.path + "-wal") diff --git a/Tests/GRDBTests/DatabaseReaderTests.swift b/Tests/GRDBTests/DatabaseReaderTests.swift index 205f596e7..d469ecf80 100644 --- a/Tests/GRDBTests/DatabaseReaderTests.swift +++ b/Tests/GRDBTests/DatabaseReaderTests.swift @@ -46,7 +46,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -68,7 +68,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -87,7 +87,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -106,7 +106,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -152,7 +152,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(setup(makeDatabaseQueue())) try await test(setup(makeDatabasePool())) try await test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -176,7 +176,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue())) try test(setup(makeDatabasePool())) try test(setup(makeDatabasePool()).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool()).makeSnapshotPool()) #endif } @@ -196,7 +196,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -243,7 +243,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -272,7 +272,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -292,7 +292,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -312,7 +312,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(makeDatabaseQueue()) try test(makeDatabasePool()) try test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -339,7 +339,7 @@ class DatabaseReaderTests : GRDBTestCase { try test(setup(makeDatabaseQueue(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration()))) try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(setup(makeDatabasePool(configuration: Configuration())).makeSnapshotPool()) #endif } @@ -358,7 +358,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -375,7 +375,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif } @@ -410,7 +410,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -443,7 +443,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -481,7 +481,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -523,7 +523,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -558,7 +558,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -591,7 +591,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -629,7 +629,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -671,7 +671,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) @@ -719,7 +719,7 @@ class DatabaseReaderTests : GRDBTestCase { try await test(makeDatabaseQueue()) try await test(makeDatabasePool()) try await test(makeDatabasePool().makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try await test(makeDatabasePool().makeSnapshotPool()) #endif try await test(AnyDatabaseReader(makeDatabaseQueue())) diff --git a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift index 4d1dc5f55..54305e5c3 100644 --- a/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift +++ b/Tests/GRDBTests/DatabaseSnapshotPoolTests.swift @@ -1,4 +1,4 @@ -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT import XCTest import GRDB diff --git a/Tests/GRDBTests/ValueObservationPrintTests.swift b/Tests/GRDBTests/ValueObservationPrintTests.swift index dc77bc822..149fafb22 100644 --- a/Tests/GRDBTests/ValueObservationPrintTests.swift +++ b/Tests/GRDBTests/ValueObservationPrintTests.swift @@ -55,7 +55,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -92,7 +92,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -130,7 +130,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } @@ -168,7 +168,7 @@ class ValueObservationPrintTests: GRDBTestCase { try test(makeDatabaseQueue(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config)) try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshot()) -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT try test(makeDatabasePool(filename: "test", configuration: config).makeSnapshotPool()) #endif } diff --git a/Tests/GRDBTests/ValueObservationTests.swift b/Tests/GRDBTests/ValueObservationTests.swift index e1b4c62a5..03202b448 100644 --- a/Tests/GRDBTests/ValueObservationTests.swift +++ b/Tests/GRDBTests/ValueObservationTests.swift @@ -462,7 +462,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -516,7 +516,7 @@ class ValueObservationTests: GRDBTestCase { } let expectedCounts: [Int] -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT // Optimization available expectedCounts = [0, 1] #else @@ -543,7 +543,7 @@ class ValueObservationTests: GRDBTestCase { // MARK: - Snapshot Observation -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT func testDatabaseSnapshotPoolObservation() throws { let dbPool = try makeDatabasePool() try dbPool.write { try $0.execute(sql: "CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT)") } @@ -1065,7 +1065,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "initialValue") -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice @@ -1123,7 +1123,7 @@ class ValueObservationTests: GRDBTestCase { } let initialValueExpectation = self.expectation(description: "") -#if SQLITE_ENABLE_SNAPSHOT +#if SQLITE_ENABLE_SNAPSHOT && !SQLITE_DISABLE_SNAPSHOT initialValueExpectation.assertForOverFulfill = true #else // ValueObservation on DatabasePool will notify the first value twice