Kotlin-dsl gradle, multi-platform project, minimal example


#1
  1. I am aware of https://github.com/gradle/kotlin-dsl/tree/master/samples and have read through the .kts files in the four multiplatform- folders .

  2. I have gradle + multiplatform kotlin working. My standard setup is:
    foobar-common/build.gradle
    foobar-jvm/build.gradle (expectedBy(":foobar-common"))
    foobar-js/build.grade (expectedBy(":foobar-common")

  3. The gradle/kotlin-dsl/samples/multiplatform-* examples confuse me, as I don’t see the X-common, X-js, X-jvm directory structure.

  4. I have tried converting my existing build.gradle to build.gradle.kts … but it’s not clear to me how various lines should be convertedc.

Question: Is there a minimal gradle kotlin-dsl example which follows the

X-common/
X-jvm/
X-js/

directory structure?

Thanks!


#2

They do? There aren’t any. You confused them with multi-project. As far as I can tell none of those examples have a multi-platform setup. This should not matter however.
You can follow those examples on how to setup the project structure. I guess you have to replace the plugin from kotlin("jvm") to kotlin("common"). I don’t know what exactly it is. You might need to experiment with the name a bit until you get it right. Then in the dependencies I guess you do exactly the same as you would using Groovy except with a slightly different syntax expectedBy(project(":-common"))