I’m creating a KMP project, targeting Desktop and ...
# compose-desktop
a
I’m creating a KMP project, targeting Desktop and Android for now, IOS in the future. Shall I create a KMM project first and add a Desktop target after that? How do i get started? I’m following: https://kotlinlang.org/docs/kmm-create-first-app.html. Thanks
s
Without having a firm grasp of gradle, the build logic can be a little confusing. At the end of the day - you are adding and configuring 2 gradle plugins that know how to play nicely together. the kotlin multiplatform plugin and the jetbrains compose plugin. You can add them and configure them however you like, but I recommend just grabbing a sample and modifying it for your first project. If you don’t have a good understanding of gradle, it can be a little overwhelming getting everything setup.
a
Thanks for the tip @spierce7. I’ll need to get a good grasp of Gradle.. Are the offical docs good?
s
yeah - but they are very large. Gradle is a JVM application that you configure with code to tell how to build your application.
There are 2 languages you can use to write Gradle scripts. Groovy (which is the oldest and was there since the beginning), and Kotlin Script Gradle (which was added a few years ago). I recommend just using the kotlin side of Gradle. You can tell if it’s a Gradle Groovy file if it ends with
.gradle
and can tell if it’s a Kotlin Script Gradle file if it ends with
gradle.kts
k
Thanks for this question and the answers! I had the same dilemma. I've started making a Desktop app, and hope to add mobile later.
👍 1
a
thanks @spierce7 for your answers! I’m familiar with Groovy and Kotlin. I have been using it for years with the Grails framework to do web dev but I have switched now and want to stick with the Kotlin side of things as you said. Now going ahead and having a firm grasp of Gradle will help me to understand other peoples’ projects too. So I’ll go ahead and do that first.