jean
10/14/2020, 7:07 AMplugins {
kotlin("multiplatform") version "1.4.10"
id("com.squareup.sqldelight")
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0")
classpath ("com.squareup.sqldelight:gradle-plugin:1.4.3")
}
}
sqldelight {
database("MyDatabase") {
packageName = "com.my.package.name.sqldelight"
}
}
I also created a News.sq
file in src/commonMain/sqldelight/com/my/package/name/sqldelight
Running gradlew build
succeed but I can’t see that MyDatabase
class is generated.
Am I suppose to do anything more?Maarten Bruggeman
10/14/2020, 7:33 AMjean
10/14/2020, 8:07 AMalec
10/14/2020, 3:45 PMsrc/main
instead of src/commonMain
jean
10/14/2020, 8:03 PMMyDatabase
class, when I use it like this for example (inside src/commonMain/kotlin) :
fun createDatabase(driverFactory: DatabaseDriverFactory): MyDatabase {
val driver = driverFactory.createDriver()
return MyDatabase(driver)
}
building or running the different sqldelight tasks doesn’t change anythingalec
10/14/2020, 8:08 PM.sq
files are in src/main/sqldelight
?jean
10/14/2020, 8:38 PMalec
10/15/2020, 1:02 AMjean
10/15/2020, 8:31 AMContext
class because I was targeting the jvm for android. Now I target android()
and it required a few changes. I’m able to create the AndroidSqliteDriver
2/ The wizard for kmp library generated some weird/complex logic to figure out ios and native targets, without using the simple ios { }
target, so I changed the logic to use that now. But I can’t access NativeSqliteDriver
IntelliJ cannot find the reference even if I have the dependency:
val iosMain by getting {
dependsOn(clientCommon)
dependencies {
implementation("com.squareup.sqldelight:native-driver:1.4.4")
}
}
jean
10/15/2020, 8:40 AMimport com.squareup.sqldelight.drivers.native.NativeSqliteDriver
jean
10/15/2020, 11:19 AM