Hello friends! (apologies if this is not the right...
# multiplatform
p
Hello friends! (apologies if this is not the right place to ask) Is there any barebones template for a CLI app divided into subprojects? kmp.jetbrains.com only gives me the option of having Compose when choosing Desktop, or Ktor when choosing Server. Any suggestion is welcome. Thanks!
c
Can you describe what you are looking for exactly? A single
:cli
module and a
:core
module?
p
Sure! Sorry for the generic question. 😅 Yes, a
:cli
+
:core
would be a perfect example. Context: we have a multiplatform project using a deprecated/old syntax/structure that no longer builds with Kotlin > 1.9.10. Trying to fix the (cryptic) Gradle errors or converting parts of the build file to the new syntax did not work well for us, so I am taking a stab at starting fresh with a simple project. 😉
The short version is:
Copy code
// settings.gradle.kts
rootProject.name = "Name your project however you want"

dependencyResolutionManagement {
	repositories {
		mavenCentral()
	}
}

include(
    "cli",
    "core",
)
Copy code
// build.gradle.kts

plugins {
    kotlin("multiplatform") version "1.9.23" apply false
}
Copy code
// core/build.gradle.kts

plugins {
    kotlin("multiplatform")
}

kotlin {
    jvm()
    linuxX64()
    …

    sourceSets.commonMain.dependencies {
        implementation(…)
    }
}
Copy code
// cli/build.gradle.kts

plugins {
    kotlin("multiplatform")
}

kotlin {
    jvm()
    …

    sourceSets.commonMain.dependencies {
        implementation(project.core)
    }
}
gratitude thank you 1
p
Thanks, this is super helpful! gratitude thank you
c
If you have any other questions, don't hesitate! I have a few samples, but not for exactly this
gratitude thank you 1
👍 1