41 lines
1.2 KiB
Kotlin
41 lines
1.2 KiB
Kotlin
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)
|
|
}
|
|
}
|
|
}
|