AdrianRaFo
05/24/2019, 1:50 PMcommon module as a dependency to another common module but I'm not able to get it working. I tried with implementation, api and compileOnly but any of them give me a successful build. Could anyone helps me?Kris Wong
05/24/2019, 2:06 PMgalex
05/24/2019, 2:16 PMAdrianRaFo
05/24/2019, 2:17 PMbuild.gradleh0tk3y
05/24/2019, 2:36 PMapi or implementation dependency on another project to the commonMain source set should work: you will be able to use the declarations from the other project's commonMain, and also platform-specific declarations in the appropriate platform-specific sources of the depending project.
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(project(":foo"))
}
}
}
}
If it doesn't work for you, could you please provide more details about the project structure?AdrianRaFo
05/24/2019, 2:37 PMh0tk3y
05/24/2019, 2:39 PMcommonMain and platform-specific sources should work.AdrianRaFo
05/24/2019, 3:43 PMAdrianRaFo
05/24/2019, 3:51 PMcommonMain is not able to find the helloInit value declarated inside the separatedCommon moduleh0tk3y
05/24/2019, 3:58 PMkotlin-platform-common plugin is a part of Kotlin 1.2.x MPP tooling that is now becoming obsolete (no active development, and we have plans to deprecate it). Also, the current architecture of multiplatform projects requires that all expect declarations are provided with actual implementations within the same module, and no actual implementations can be added by a library consumer.h0tk3y
05/24/2019, 3:59 PMseparateCommon should use the kotlin-multiplatform plugin, too, and should therefore provide platform-specific implementations for all its expect declarations.h0tk3y
05/24/2019, 4:02 PMAdrianRaFo
05/24/2019, 4:02 PMAdrianRaFo
05/24/2019, 4:03 PMval only needed on the commonMain sourceSetAdrianRaFo
05/24/2019, 4:08 PM