71 lines
2.1 KiB
Kotlin
71 lines
2.1 KiB
Kotlin
// Establishes the D-05 target matrix + JVM toolchain + warning policy.
|
|
// Android bytecode is JVM 11 (D-08); server + desktop + shared/jvm are JVM 21.
|
|
//
|
|
// This plugin is intentionally dependency-free: shared/ must stay light
|
|
// (no Koin, no Kermit), and composeApp adds those in its own build file.
|
|
|
|
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)
|
|
}
|
|
}
|
|
|
|
iosArm64()
|
|
iosSimulatorArm64()
|
|
|
|
jvm {
|
|
compilerOptions {
|
|
jvmTarget.set(JvmTarget.JVM_21)
|
|
}
|
|
}
|
|
|
|
@OptIn(ExperimentalWasmDsl::class)
|
|
wasmJs { browser() }
|
|
|
|
compilerOptions {
|
|
allWarningsAsErrors.set(true)
|
|
}
|
|
|
|
sourceSets {
|
|
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)
|
|
}
|
|
}
|
|
|
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile>().configureEach {
|
|
if (name.endsWith("KotlinMetadata")) {
|
|
compilerOptions {
|
|
allWarningsAsErrors.set(false)
|
|
}
|
|
}
|
|
}
|