Skip to content

Commit 6675c3a

Browse files
committed
Apply Spotless to root project and exclude spotless dir
Apply the Spotless configuration to `allprojects` instead of `subprojects` so that the root project is also included. Exclude the `spotless/` directory from Kotlin and XML formatting to prevent the license header from being applied to itself.
1 parent 27c462c commit 6675c3a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ plugins {
1616
alias(libs.plugins.spotless) apply false
1717
}
1818

19-
subprojects {
19+
allprojects {
2020
apply(plugin = "com.diffplug.spotless")
2121
extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {
2222
kotlin {
2323
target("**/*.kt")
24-
targetExclude("**/build/**/*.kt")
24+
targetExclude("**/build/**/*.kt", "spotless/**/*.kt")
2525

2626
val disabledRules = arrayOf(
2727
// These rules were introduced in ktlint 0.46.0 and should not be
@@ -91,7 +91,7 @@ subprojects {
9191
}
9292
format("xml") {
9393
target("**/*.xml")
94-
targetExclude("**/build/**/*.xml")
94+
targetExclude("**/build/**/*.xml", "spotless/**/*.xml")
9595
// Look for the root tag or a tag that is a snippet
9696
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[a-zA-Z])|(<!--\\s+(//\\s*)?\\[START)").skipLinesMatching(".*START.*")
9797
}

0 commit comments

Comments
 (0)