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.
This commit is contained in:
Harsh Shandilya 2022-10-29 08:10:44 +05:30
parent fd20480f55
commit 56fd18b17d
No known key found for this signature in database
7 changed files with 2 additions and 65 deletions

12
.github/renovate.json vendored
View file

@ -20,17 +20,5 @@
],
"enabled": false
}
],
"regexManagers": [
{
"fileMatch": [
"build-logic/kotlin-plugins/src/main/kotlin/app/passwordstore/gradle/SpotlessPlugin.kt"
],
"matchStrings": [
"KTFMT_VERSION = \"(?<currentValue>.*)\""
],
"datasourceTemplate": "maven",
"depNameTemplate": "com.facebook:ktfmt"
}
]
}

View file

@ -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

View file

@ -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)

View file

@ -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<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(SpotlessPlugin::class)
project.extensions.getByType<SpotlessExtension>().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"
}
}

View file

@ -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
}

View file

@ -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" }

View file

@ -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