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 672a6aac06..d72ab58e99 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 6edc319733..599df31db1 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 70065f8228..a58b8eea32 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 3edf3611ce..99c2c0475f 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 36937d039a..72875fe2d4 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 920bd60690..4261c65e8f 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 85a9b53165..54f7e82a4e 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 a3fabb0887..d458e838c5 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 2681721008..5037651ff2 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 9e1518cf81..4a6a2baf80 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 694d63eb10..655365491e 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 686fa14b78..85329f82f0 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 9133272592..e793a9180c 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 c95f3a266a..f7ff69f36c 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 1d87105e46..3613799744 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 915702a986..077dd2d469 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 93592c7c69..b1e7a1b4d7 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 43e510b958..cf93a8f6e5 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 8df2e73a60..a40d67b05a 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 ae5c09ff83..d1aa1250ff 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 6b69969994..001925b4db 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 3ce1f8ea29..2a034a2d5f 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 72875fe2d4..b6c3c2e84b 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 b6c3c2e84b..fdd8969594 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 eb0e48eac5..4c43433c89 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 21b5db7508..d4634cee6b 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 29820afe80..51d828df38 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 a8c0168a73..54d8bbbcca 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 9e961bde34..2caeb69a3e 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 9cc507ddfd..22f124a71d 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 9d7f4a813f..fbc35dcaa2 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 1ac85a08fe..974386bdf9 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 64a09cf513..f00acecbb5 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 e1ab57bbd5..f510c48a23 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 ca5a103784..205f596e7a 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 3235f5db9e..4d1dc5f55b 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 9ed1a44333..dc77bc8221 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 d1aa1250ff..e1b4c62a5b 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 d262a8272f..6f453ec23a 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 a58b8eea32..5bc4b08c87 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 1de641b151..933fb9c2b8 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 eb409a6b5e..2a9a719d66 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 86b2924e92..34a362b9dc 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 d5342941e2..2614602ddd 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 ea4ad33922..af59112bab 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 bf808dbaa5..78151bfca8 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 f6e6a84deb..35bc52bd0d 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 51d828df38..67a91c5cb0 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 1c8e721f98..2459e3ba75 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 2daff62874..c4b639ae79 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 95575c954b..025bb8035e 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 1a203f6850..6bf3a89ad4 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 fb27043a50..a8871726fe 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 dc9ec1b9bb..490dffb7f7 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 55d6bdb20f..fd7d714a01 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 fb861feb8a..d857ecbc24 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 6676c065ae..dadc00fd65 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 e200c6c596..70d84f3ab7 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 7595b53ef6..54b18b2c80 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 0902097d9a..253b06e53d 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 d72cf3d197..f967fb8375 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 b9a747f8cc..67212aad65 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 54d8bbbcca..261f79d4e4 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 b3ae312485..f957b1936c 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 d5bc8cb10b..42dd67dba3 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 a71b05ca69..5111090e5d 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 dc7bfdb6c3..f5536641a1 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 3818c7c17e..c605ae1715 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 cfce95f2aa..19f1d2d4bc 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 370f1256c5..a209337a6c 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 7c25b6a890..35f3ae2672 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 5851866be7..bda4ed1813 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 99c2c0475f..c54ab06bcc 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 d458e838c5..840a9c24ef 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 94ad777847..cdde445a31 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 ead7d89b92..c6fd39bd8a 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 3f572fc304..1187ed2504 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 afa8bd32a5..7302e2aa42 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 f510c48a23..b3f291d68a 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 077dd2d469..af1df612be 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 cee0f6e954..02b77ec50c 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 6a3233fdc8..f11e351176 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 d4634cee6b..08f4c26106 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 67a91c5cb0..4604c9c2cb 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 261f79d4e4..729a8ac805 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 2caeb69a3e..22f6c90a76 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 22f124a71d..d75b89c731 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 fdd8969594..9d0c79554f 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 fbc35dcaa2..baefd0dcd6 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 974386bdf9..3d3654f2a2 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 f00acecbb5..f0739ba1c7 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 b3f291d68a..f8192e58f8 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 205f596e7a..d469ecf801 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 4d1dc5f55b..54305e5c3f 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 dc77bc8221..149fafb221 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 e1b4c62a5b..03202b4480 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