In the past we are working on a kotlin multiplatform project for mobile devices which uses sqldelight for database access.
Now we want to add some native desktop targets like mingwX64 and linuxX64 but currently sqldelight doesn't available for these targets so we want to use other libraries to handle the database access on the desktop. But how to set up the sqldelight configuration to only work with android and iOS targets?
The current build.gradle.kts looks like this:
plugins {
kotlin("multiplatform")
id("com.squareup.sqldelight")
id("kotlinx-serialization")
id("com.android.library")
}
android {
...
}
sqldelight {
database("Database") {
packageName = "foo.bar
schemaOutputDirectory = file("src/foo
}
}
kotlin {
// Targets
val android = android()
val iosX64 = iosX64()
val jvm = jvm()
val linuxX64 = linuxX64()
val windows = mingwX64()
...
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib"))
//implementation("com.squareup.sqldelight:runtime:${rootProject.ext["sqldelightVersion"]}")
}
}
...
}
Because of: plugins { id("com.squareup.sqldelight")
the sqldelight runtime automatical added to the dependecies for linux and windows.
Thank you and best regards