Add Spotless conventions plugin

This commit is contained in:
SKBotNL committed 2026-01-24 17:32:17 +01:00
1 parent 0f1ff5b2f5
commit 35aaba88c0
4 files changed
+54

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
.gradle
**/build/
!**/src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
# Cache of project
.gradletasknamecache
# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
.kotlin
+12
View File
@@ -0,0 +1,12 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
mavenCentral()
}
dependencies {
implementation("com.diffplug.spotless:spotless-plugin-gradle:8.1.0")
}
+1
View File
@@ -0,0 +1 @@
rootProject.name = "build-conventions"
@@ -0,0 +1,18 @@
plugins {
// Apply Spotless to the target project
id("com.diffplug.spotless")
}
spotless {
kotlin { ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } }
kotlinGradle {
ktfmt().kotlinlangStyle().configure { it.setMaxWidth(120) } // JetBrains Kotlin formatting.
target("build.gradle.kts", "settings.gradle.kts") // Gradle files to format.
}
}
tasks.build { dependsOn(tasks.spotlessApply) }
tasks.named("spotlessCheck") {
dependsOn("spotlessApply") // Run spotless before checking if spotless ran.
}