I have modularized my shared code, so currently I have a shared
module (kmp), and inside this module I have shared:core
and shared:database
(both multiplatform too).
If I set up the database in the shared module it works: I place my AppDatabase.sq in the commonMain folder in shared, in sqldelight/com/example/kmmbase/database/ and the schema is correctly generated.
On the other hand, if I try to move it to the shared:database
module it does not generate the schema, and the driver won't compile. I add the AppDatabase.sq file to the same path but now in the commonMain of the shared:database
module, and I move the sqldelight plugin and gradle config from the shared
gradle file to the shared:database
gradle file.
The gradle config I have is as follows:
sqldelight {
database("AppDatabase") {
packageName = "com.example.kmmbase.database"
sourceFolders = listOf("sqldelight")
}
}
I've tried different locations for the .sq file, and on each one I match the gradle config's packageName:
- sqldelight/com/example/kmmbase/shared/
- sqldelight/com/example/kmmbase/database/
- sqldelight/com/example/database/
- sqldelight/com/example/database/database/
- sqldelight/database/
- ...
Any idea of what I could be doing wrong?
Edit: here's a repo with the code.