diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md index da9b19682..c38247d23 100644 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -6,7 +6,7 @@ label: 'triage me' Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea -- [ ] Ensure the tests and linter pass (`./gradlew spotlessApply` to automatically apply formatting) +- [ ] Ensure the tests and linter pass (`./gradlew --init-script gradle/init.gradle.kts spotlessApply` to automatically apply formatting) - [ ] Appropriate docs were updated (if necessary) Is this your first Pull Request? diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index de2666fa1..595a0dc6e 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -34,7 +34,7 @@ jobs: uses: gradle/gradle-build-action@v2 - name: Check spotless - run: ./gradlew spotlessCheck --stacktrace + run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --stacktrace - name: Check lint run: ./gradlew lintDebug --stacktrace diff --git a/app-nia-catalog/build.gradle.kts b/app-nia-catalog/build.gradle.kts index 88b105542..33ce4dc24 100644 --- a/app-nia-catalog/build.gradle.kts +++ b/app-nia-catalog/build.gradle.kts @@ -16,7 +16,6 @@ plugins { id("nowinandroid.android.application") id("nowinandroid.android.application.compose") - id("nowinandroid.spotless") } android { diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e53f2f013..2f25807ba 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -22,7 +22,6 @@ plugins { id("nowinandroid.android.application.jacoco") id("nowinandroid.android.hilt") id("jacoco") - id("nowinandroid.spotless") id("nowinandroid.firebase-perf") } diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index a00e1dfe2..e39e716f2 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -19,7 +19,6 @@ import com.google.samples.apps.nowinandroid.configureFlavors plugins { id("nowinandroid.android.test") - id("nowinandroid.spotless") } android { diff --git a/build-logic/README.md b/build-logic/README.md index 093e5d857..0458b4fb1 100644 --- a/build-logic/README.md +++ b/build-logic/README.md @@ -29,8 +29,6 @@ setup. Current list of convention plugins: -- [`nowinandroid.spotless`](convention/src/main/kotlin/SpotlessConventionPlugin.kt): - Configures spotless. - [`nowinandroid.android.application`](convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt), [`nowinandroid.android.library`](convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt), [`nowinandroid.android.test`](convention/src/main/kotlin/AndroidTestConventionPlugin.kt): diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts index adcd7af61..453085807 100644 --- a/build-logic/convention/build.gradle.kts +++ b/build-logic/convention/build.gradle.kts @@ -28,7 +28,6 @@ java { dependencies { compileOnly(libs.android.gradlePlugin) compileOnly(libs.kotlin.gradlePlugin) - compileOnly(libs.spotless.gradlePlugin) } gradlePlugin { @@ -69,10 +68,6 @@ gradlePlugin { id = "nowinandroid.android.hilt" implementationClass = "AndroidHiltConventionPlugin" } - register("spotless") { - id = "nowinandroid.spotless" - implementationClass = "SpotlessConventionPlugin" - } register("firebase-perf") { id = "nowinandroid.firebase-perf" implementationClass = "FirebasePerfConventionPlugin" diff --git a/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.kt b/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.kt deleted file mode 100644 index eaf907ce2..000000000 --- a/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.kt +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import com.diffplug.gradle.spotless.SpotlessExtension -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.artifacts.VersionCatalogsExtension -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.getByType - -class SpotlessConventionPlugin : Plugin { - override fun apply(target: Project) { - with(target) { - pluginManager.apply("com.diffplug.spotless") - val libs = extensions.getByType().named("libs") - - extensions.configure { - kotlin { - target("**/*.kt") - targetExclude("**/build/**/*.kt") - ktlint(libs.findVersion("ktlint").get().toString()).userData(mapOf("android" to "true")) - licenseHeaderFile(rootProject.file("spotless/copyright.kt")) - } - format("kts") { - 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 (