70 lines
2.2 KiB
Kotlin
70 lines
2.2 KiB
Kotlin
// build-logic/src/main/kotlin/recipe.kotlin.multiplatform.gradle.kts
|
|
// Establishes the D-05 target matrix + JVM toolchain + common deps.
|
|
// Android bytecode is JVM 11 (D-08); server + desktop + shared/jvm are JVM 21.
|
|
|
|
import org.gradle.api.artifacts.VersionCatalogsExtension
|
|
import org.gradle.kotlin.dsl.getByType
|
|
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
plugins {
|
|
id("org.jetbrains.kotlin.multiplatform")
|
|
}
|
|
|
|
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
|
|
|
|
kotlin {
|
|
jvmToolchain(21)
|
|
|
|
androidTarget {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_11)
|
|
}
|
|
}
|
|
|
|
listOf(iosArm64(), iosSimulatorArm64()).forEach { iosTarget ->
|
|
iosTarget.binaries.framework {
|
|
baseName = "ComposeApp"
|
|
isStatic = true
|
|
}
|
|
}
|
|
|
|
jvm {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_21)
|
|
}
|
|
}
|
|
|
|
@OptIn(ExperimentalWasmDsl::class)
|
|
wasmJs { browser() }
|
|
|
|
compilerOptions {
|
|
allWarningsAsErrors.set(true)
|
|
}
|
|
|
|
sourceSets {
|
|
commonMain.dependencies {
|
|
implementation(project.dependencies.platform(libs.findLibrary("koin-bom").get()))
|
|
implementation(libs.findLibrary("koin-core").get())
|
|
implementation(libs.findLibrary("kermit").get())
|
|
}
|
|
commonTest.dependencies {
|
|
implementation(libs.findLibrary("kotlin-test").get())
|
|
}
|
|
}
|
|
}
|
|
|
|
// Relax allWarningsAsErrors for KLIB-merging metadata tasks. KotlinCompileCommon
|
|
// aggregates dependency KLIBs and surfaces upstream "duplicated unique_name"
|
|
// resolver warnings caused by androidx.lifecycle 2.10.0 (Android-only) and
|
|
// org.jetbrains.androidx.lifecycle 2.10.0 (CMP) co-publishing artifacts with
|
|
// matching KLIB unique_names. This is an upstream Compose-Multiplatform 1.10 +
|
|
// lifecycle 2.10 ecosystem condition (KT-62515-style), not actionable in our
|
|
// source — so we keep -Werror on real source compilation tasks but disable it
|
|
// for the metadata-aggregation step where no user code is being compiled.
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon>().configureEach {
|
|
compilerOptions {
|
|
allWarningsAsErrors.set(false)
|
|
}
|
|
}
|