Does anyone know if I am missing anything or has ...
# multiplatform
m
Does anyone know if I am missing anything or has another explanation why it won’t work?
n
At first glance, isn't it related to https://github.com/cashapp/sqldelight/issues/1992 ?
m
Thanks for your fast response! I will try if it helps.
m
@Matteo Wohlrapp
can't resolve the imports for the objects I declared in the buildSrc
- What exactly do you have in your buildSrc directory? Is it only
buidSrc/build.gradle.kts
file or there are also some custom gradle scripts? If the issue is related with the custom gradle scripts from your buildSrc directory then try to add a dependency section to the
buidSrc/build.gradle.kts
file and add dependencies for the plugins that are used by your custom scripts in buildSrc dir, for example:
Copy code
plugins {
    `kotlin-dsl`
}

repositories {
    gradlePluginPortal()
    jcenter()
    google()
    mavenCentral()
}

dependencies {
    implementation("com.android.tools.build:gradle:4.1.1")
    implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.21")
     ...
}
m
@mdabrowski89 thanks for your response, but I don’t have multiple gradle scripts. I have a kotlin file with objects which contain the dependencies I use in the source set. I already removed it from my gradle because it doesn’t work, but thats how I did it:
Copy code
sourceSets["commonMain"].dependencies {
    implementation(kotlin("stdlib-common", com.example.buildsrc.Versions.kotlin))
    implementation(Deps.SqlDelight.runtime)
    implementation(Deps.Ktor.commonCore)
    implementation(Deps.Ktor.commonJson)
    implementation(Deps.Ktor.commonLogging)
    implementation(Deps.Coroutines.jdk)
    implementation(Deps.stately)
    implementation(Deps.multiplatformSettings)
    implementation(Deps.koinCore)
    implementation(Deps.Ktor.commonSerialization)
    api(Deps.kermit)
    implementation("org.jetbrains.kotlinx:atomicfu:0.14.4")
    implementation("com.squareup.sqldelight:coroutines-extensions:1.4.3")
}
and the corresponding objects:
Copy code
object Deps {
    val app_compat_x = "androidx.appcompat:appcompat:1.1.0"
    val material_x = "com.google.android.material:material:1.1.0"
    val core_ktx = "androidx.core:core-ktx:1.2.0"
    val constraintlayout = "androidx.constraintlayout:constraintlayout:1.1.3"
    val recyclerView = "androidx.recyclerview:recyclerview:1.1.0"
    val android_gradle_plugin = "com.android.tools.build:gradle:${Versions.android_gradle_plugin}"
    val junit = "junit:junit:${Versions.junit}"
    val stately = "co.touchlab:stately-common:${Versions.stately}"
    val multiplatformSettings = "com.russhwolf:multiplatform-settings:${Versions.multiplatformSettings}"
    val multiplatformSettingsTest = "com.russhwolf:multiplatform-settings-test:${Versions.multiplatformSettings}"
    val koinCore = "org.koin:koin-core:${Versions.koin}"
    val koinTest = "org.koin:koin-test:${Versions.koin}"
    val cocoapodsext = "co.touchlab:kotlinnativecocoapods:${Versions.cocoapodsext}"
    val kermit = "co.touchlab:kermit:${Versions.kermit}"
    val lifecycle_viewmodel = "android.arch.lifecycle:viewmodel:${Versions.lifecycle}"
    val lifecycle_viewmodel_extensions = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.lifecycle}"
    val lifecycle_livedata = "android.arch.lifecycle:livedata:${Versions.lifecycle}"
    val lifecycle_extension = "android.arch.lifecycle:extensions:${Versions.lifecycle}"
    val karmok = "co.touchlab:karmok-library:${Versions.karmok}"
    val robolectric = "org.robolectric:robolectric:${Versions.robolectric}"
}
m
@Matteo Wohlrapp Where exactly did you put file with
object Deps { …  }
?
If I placed it in
buildSrc/src/main/kotlin/
directory then the object Deps is visible from the shared module build.gradle.kts script
m
I put it in buildSrc/src/main/kotlin. It was working for android, but when I ran ./gradlew podspec it failed.