From 56fd18b17df26ea28f28b9546bdf661ae10f8512 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 29 Oct 2022 08:10:44 +0530 Subject: [PATCH] feat: rip out Spotless Spotless' configuration cache support is irritating since it requires you to wipe config cache every time you initialise a Gradle daemon. --- .github/renovate.json | 12 ----- .github/workflows/pull_request.yml | 2 +- build-logic/kotlin-plugins/build.gradle.kts | 5 --- .../passwordstore/gradle/SpotlessPlugin.kt | 44 ------------------- build.gradle.kts | 1 - gradle/libs.versions.toml | 1 - scripts/pre-push-hook.sh | 2 +- 7 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt diff --git a/.github/renovate.json b/.github/renovate.json index e5164f72..43df9a80 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -20,17 +20,5 @@ ], "enabled": false } - ], - "regexManagers": [ - { - "fileMatch": [ - "build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt" - ], - "matchStrings": [ - "KTFMT_VERSION = \"(?.*)\"" - ], - "datasourceTemplate": "maven", - "depNameTemplate": "com.facebook:ktfmt" - } ] } diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 368aaf2f..08209f83 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -42,7 +42,7 @@ jobs: if: "${{ steps.service-changed.outputs.result == 'true' }}" uses: gradle/gradle-build-action@v2.3.3 with: - arguments: spotlessCheck + arguments: ktfmtCheck gradle-home-cache-cleanup: true - name: Upload Kotlin build report diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts index 815d6ca0..fc2147c9 100644 --- a/build-logic/kotlin-plugins/build.gradle.kts +++ b/build-logic/kotlin-plugins/build.gradle.kts @@ -47,10 +47,6 @@ gradlePlugin { id = "com.github.android-password-store.ktfmt" implementationClass = "app.passwordstore.gradle.KtfmtPlugin" } - register("spotless") { - id = "com.github.android-password-store.spotless" - implementationClass = "app.passwordstore.gradle.SpotlessPlugin" - } register("versions") { id = "com.github.android-password-store.versions" implementationClass = "app.passwordstore.gradle.DependencyUpdatesPlugin" @@ -65,7 +61,6 @@ dependencies { implementation(libs.build.kotlin) implementation(libs.build.ktfmt) implementation(libs.build.r8) - implementation(libs.build.spotless) implementation(libs.build.vcu) implementation(libs.build.versions) implementation(libs.kotlin.coroutines.core) diff --git a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt b/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt deleted file mode 100644 index 79a52c1b..00000000 --- a/build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package app.passwordstore.gradle - -import com.diffplug.gradle.spotless.SpotlessExtension -import com.diffplug.gradle.spotless.SpotlessPlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType - -@Suppress("Unused") -class SpotlessPlugin : Plugin { - - override fun apply(project: Project) { - project.pluginManager.apply(SpotlessPlugin::class) - project.extensions.getByType().run { - kotlin { - ktfmt(KTFMT_VERSION).googleStyle() - target("**/*.kt") - targetExclude("**/build/") - } - kotlinGradle { - ktfmt(KTFMT_VERSION).googleStyle() - target("**/*.kts") - targetExclude("**/build/") - } - format("xml") { - target("**/*.xml") - targetExclude("**/build/", ".idea/") - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } - } - } - - private companion object { - private const val KTFMT_VERSION = "0.41" - } -} diff --git a/build.gradle.kts b/build.gradle.kts index 17725b88..d82224e0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,6 @@ plugins { id("com.github.android-password-store.git-hooks") id("com.github.android-password-store.kotlin-common") id("com.github.android-password-store.ktfmt") - id("com.github.android-password-store.spotless") id("com.github.android-password-store.versions") alias(libs.plugins.hilt) apply false } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d56cf327..685029d1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -49,7 +49,6 @@ build-okhttp = "com.squareup.okhttp3:okhttp:4.10.0" build-r8 = "com.android.tools:r8:4.0.18-dev" build-semver = "com.vdurmont:semver4j:3.1.0" build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.2.0" -build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.11.0" build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.7.0" build-versions = "com.github.ben-manes:gradle-versions-plugin:0.43.0" compose-animation = { module = "androidx.compose.animation:animation" } diff --git a/scripts/pre-push-hook.sh b/scripts/pre-push-hook.sh index 6580b9c7..8917df92 100644 --- a/scripts/pre-push-hook.sh +++ b/scripts/pre-push-hook.sh @@ -13,6 +13,6 @@ while read -r local_ref local_oid remote_ref remote_oid; do _=$remote_ref _=$remote_oid if [ "${local_oid}" != "${ZERO}" ]; then - "${GRADLE_EXEC}" metalavaCheckCompatibilityRelease detekt spotlessCheck test -PslimTests + "${GRADLE_EXEC}" metalavaCheckCompatibilityRelease detekt ktfmtCheck test -PslimTests fi done