From 2ebe8ae3298f53083a3403d2bc8c2625a2625e20 Mon Sep 17 00:00:00 2001 From: JP Simard Date: Thu, 4 Jun 2026 15:26:42 -0400 Subject: [PATCH] Fix Database not resolving via `import SQLiteData` under whole-module builds SQLiteData re-exports selected GRDB types via scoped imports in `Internal/Exports.swift` (e.g. `@_exported import class GRDB.Database`). 1.6.3 also added non-exported scoped imports of the same declaration (`public import class GRDB.Database`) in `CloudKit/PrimaryKeyMigration.swift` and `StructuredQueries+GRDB/CustomFunctions.swift`, both of which sort before `Internal/Exports.swift` in compilation order. Under whole-module compilation, swiftc dedupes scoped imports of the same declaration keeping the first occurrence in file order, which silently drops the `@_exported` flag. Downstream modules then fail to resolve `Database` via `import SQLiteData` with `cannot find type 'Database' in scope`. This only reproduces under WMO (`swift build -c release`); debug builds compile incrementally and are unaffected. Mark those scoped imports `@_exported` as well so the dedup keeps an exported entry regardless of file order. This is a no-op for consumers: `GRDB.Database` is already intentionally re-exported by `Internal/Exports.swift`. A whole-module `public import GRDB` is not an option because GRDB's `DatabaseFunction` class would collide with StructuredQueries' `DatabaseFunction` protocol used in `CustomFunctions.swift`. --- Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift | 2 +- Sources/SQLiteData/StructuredQueries+GRDB/CustomFunctions.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift b/Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift index 098a3ea1..ff4dcd40 100644 --- a/Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift +++ b/Sources/SQLiteData/CloudKit/PrimaryKeyMigration.swift @@ -1,7 +1,7 @@ #if canImport(CloudKit) && canImport(CryptoKit) import CryptoKit public import Foundation - public import class GRDB.Database + @_exported import class GRDB.Database public import StructuredQueriesCore public import StructuredQueriesSQLite diff --git a/Sources/SQLiteData/StructuredQueries+GRDB/CustomFunctions.swift b/Sources/SQLiteData/StructuredQueries+GRDB/CustomFunctions.swift index 12ccb4e5..f3156868 100644 --- a/Sources/SQLiteData/StructuredQueries+GRDB/CustomFunctions.swift +++ b/Sources/SQLiteData/StructuredQueries+GRDB/CustomFunctions.swift @@ -1,5 +1,5 @@ import Foundation -public import class GRDB.Database +@_exported import class GRDB.Database import GRDBSQLite public import StructuredQueriesSQLiteCore