Wire project infrastructure
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
40
build-logic/src/main/kotlin/recipe.quality.gradle.kts
Normal file
40
build-logic/src/main/kotlin/recipe.quality.gradle.kts
Normal file
@@ -0,0 +1,40 @@
|
||||
plugins {
|
||||
id("com.diffplug.spotless")
|
||||
}
|
||||
|
||||
spotless {
|
||||
kotlin {
|
||||
target("src/**/*.kt")
|
||||
targetExclude("**/build/**", "**/generated/**")
|
||||
ktlint()
|
||||
}
|
||||
kotlinGradle {
|
||||
target("*.gradle.kts")
|
||||
ktlint()
|
||||
}
|
||||
format("markdown") {
|
||||
target("*.md", "docs/**/*.md")
|
||||
endWithNewline()
|
||||
trimTrailingWhitespace()
|
||||
}
|
||||
}
|
||||
|
||||
// D-11 redundancy guard: if a module applies recipe.quality alongside a Kotlin plugin
|
||||
// (multiplatform or jvm), ensure allWarningsAsErrors still applies even if the module
|
||||
// build didn't already configure it. Guarded with plugins.withId so this plugin is
|
||||
// safely composable even when applied alone (no KotlinCompilationTask type available
|
||||
// on the classpath until a Kotlin plugin is present).
|
||||
plugins.withId("org.jetbrains.kotlin.multiplatform") {
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask<*>>().configureEach {
|
||||
compilerOptions {
|
||||
allWarningsAsErrors.set(!name.endsWith("KotlinMetadata"))
|
||||
}
|
||||
}
|
||||
}
|
||||
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask<*>>().configureEach {
|
||||
compilerOptions {
|
||||
allWarningsAsErrors.set(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user