diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6866d8f4..c991d1ad 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -40,7 +40,7 @@ jobs: run: chmod +x gradlew - name: Apply Spotless - run: ./gradlew spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache + run: ./gradlew spotlessApply - name: Commit Spotless changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.run/spotlessApply.run.xml b/.run/spotlessApply.run.xml index c9e02b96..02cbc78f 100644 --- a/.run/spotlessApply.run.xml +++ b/.run/spotlessApply.run.xml @@ -19,7 +19,6 @@ diff --git a/build.gradle.kts b/build.gradle.kts index 72b0e280..97047974 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,4 +11,35 @@ plugins { alias(libs.plugins.crashlytics) apply false alias(libs.plugins.android.test) apply false alias(libs.plugins.baselineprofile) apply false + alias(libs.plugins.spotless) apply false +} + + +subprojects { + apply(plugin = "com.diffplug.spotless") + extensions.configure { + kotlin { + target("**/*.kt") + targetExclude("**/build/**/*.kt") + ktlint(libs.versions.ktlint.get()).editorConfigOverride( + mapOf( + "android" to "true", + "ktlint_standard_property-naming" to "disabled" + ), + ) + licenseHeaderFile(rootProject.file("spotless/copyright.kt")) + } + kotlinGradle { + target("**/*.kts") + targetExclude("**/build/**/*.kts") + // Look for the first line that doesn't have a block comment (assumed to be the license) + licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)") + } + format("xml") { + target("**/*.xml") + targetExclude("**/build/**/*.xml") + // Look for the first XML tag that isn't a comment (