Wire project infrastructure
This commit is contained in:
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