From bca801dced6442136c332729fd79d978b1418996 Mon Sep 17 00:00:00 2001 From: Daniil Kamanin Date: Thu, 9 Apr 2026 00:04:45 +0300 Subject: [PATCH] build(build-logic): fix Spotless targets for Kotlin scripts The current Spotless configuration for Kotlin scripts uses multiple target() calls. According to the Spotless Javadoc: "When this method is called multiple times, only the last call has any effect." Consequently, only files in 'build-logic/convention/*.kts' were being formatted, while root and 'build-logic' scripts were ignored. This commit consolidates all patterns into a single target() call to ensure all intended Kotlin scripts are properly tracked. --- .../kotlin/com/google/samples/apps/nowinandroid/Spotless.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt index 3d4ac8f3e..e7d875bec 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt @@ -49,9 +49,7 @@ internal fun Project.configureSpotlessForRootProject() { endWithNewline() } format("kts") { - target("*.kts") - target("build-logic/*.kts") - target("build-logic/convention/*.kts") + target("*.kts", "build-logic/*.kts", "build-logic/convention/*.kts") // Look for the first line that doesn't have a block comment (assumed to be the license) licenseHeaderFile(rootDir.resolve("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)") endWithNewline()