Thread
#multiplatform
    jean

    jean

    1 year ago
    I’ve been trying to configure sqldelight in my project since yesterday, but without any success so far
    plugins {
        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?
    m

    Maarten Bruggeman

    1 year ago
    update to 1.4.4 or run generateSqlDelightInterface as a gradle command. 1.4.4 automatically runs it when building
    jean

    jean

    1 year ago
    Still nothing generated 😞
    a

    alec

    1 year ago
    they need to be in
    src/main
    instead of
    src/commonMain
    jean

    jean

    1 year ago
    I still can’t access the
    MyDatabase
    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 anything
    a

    alec

    1 year ago
    your
    .sq
    files are in
    src/main/sqldelight
    ?
    jean

    jean

    1 year ago
    yes
    a

    alec

    1 year ago
    If you’re able to make a repro project please file an issue on github with a link to it
    jean

    jean

    1 year ago
    I’ve been trying to implement the driver factory regardless of the database class not being generated. I notice a few things : 1/ I couldn’t access the
    Context
    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")
        }
    }
    this import isn’t working
    import com.squareup.sqldelight.drivers.native.NativeSqliteDriver