icerockdev / moko-widgets-template

Template project of a Mobile (Android & iOS) Kotlin MultiPlatform project with the MOKO widgets and other MOKO libs
https://moko.icerock.dev/
Apache License 2.0
10 stars 1 forks source link

Connect new library(SQLDelight) to MOKO-Widgets-Template build.gradle.kts #5

Closed Diy2210 closed 4 years ago

Diy2210 commented 4 years ago

Hi, i try connect SQLDelight to my app using MOKO-Widgets-Template, but after generates Gradle - MyApp(root) - Tasks - sqldelight result: Task :mpp-library:generateAndroidDebugServerBaseInterface NO-SOURCE!!! How correct connect new library to MOKO? Or which SQL library to use MPP with MOKO-Widgets-Template?

build.gradle.kts plugins { id("com.android.library") id("org.jetbrains.kotlin.multiplatform") id("dev.icerock.mobile.multiplatform") id("dev.icerock.mobile.multiplatform-resources") id("com.squareup.sqldelight") }

sqldelight { database("ServerBase") { packageName = "org.example.mpp" sourceFolders = listOf("mpp-library/src/commonMain/kotlin/sqldelight") // schemaOutputDirectory = file("build/dbs") } // linkSqlite = false }

android { compileSdkVersion(Versions.Android.compileSdk)

defaultConfig {
    minSdkVersion(Versions.Android.minSdk)
    targetSdkVersion(Versions.Android.targetSdk)
}

}

val mppLibs = listOf( Deps.Libs.MultiPlatform.mokoResources, Deps.Libs.MultiPlatform.mokoWidgets, )

setupFramework( exports = mppLibs )

dependencies { mppLibrary(Deps.Libs.MultiPlatform.kotlinStdLib) mppLibrary(Deps.Libs.MultiPlatform.coroutines) mppLibrary(Deps.Libs.MultiPlatform.ktorClient) androidLibrary(Deps.Libs.Android.lifecycle) mppLibs.forEach { mppLibrary(it) } }

multiplatformResources { multiplatformResourcesPackage = "org.example.library" }

Tetraquark commented 4 years ago

It looks like there is problem connecting SQLDelight in your build.gradle file. The first problem is that the directory for the .sq files is specified incorrectly inside block sqldelight. Just put here only directory name:

ServerBase {
    packageName = "org.example.mpp"
    sourceFolders = ["sqldelight"]
}

And then you can add .sq files into directory mpp-library/src/commonMain/kotlin/sqldelight/org/example/mpp.

Diy2210 commented 4 years ago

Tnx!