From 9fb8e17cf65a4fa64eb4de25004c8cbdaf0a2cd8 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 19 Jan 2024 16:40:58 +0530 Subject: [PATCH] refactor: remove unused versions plugin We fully rely on Renovate for this --- build-logic/build.gradle.kts | 6 --- .../claw/gradle/DependencyUpdatesPlugin.kt | 41 ------------------- build.gradle.kts | 3 +- gradle/libs.versions.toml | 2 - 4 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/DependencyUpdatesPlugin.kt diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 358bdf7e..35efb2cf 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -54,10 +54,6 @@ gradlePlugin { id = "dev.msfjarvis.claw.versioning-plugin" implementationClass = "dev.msfjarvis.claw.gradle.versioning.VersioningPlugin" } - register("versions") { - id = "dev.msfjarvis.claw.versions" - implementationClass = "dev.msfjarvis.claw.gradle.DependencyUpdatesPlugin" - } } } @@ -68,8 +64,6 @@ dependencies { implementation(libs.build.semver) implementation(libs.build.sentry) implementation(libs.build.spotless) - implementation(libs.build.vcu) - implementation(libs.build.versions) // Expose the generated version catalog API to the plugin. implementation(files(libs::class.java.superclass.protectionDomain.codeSource.location)) diff --git a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/DependencyUpdatesPlugin.kt b/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/DependencyUpdatesPlugin.kt deleted file mode 100644 index 9cc229fa..00000000 --- a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/DependencyUpdatesPlugin.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright © 2022-2023 Harsh Shandilya. - * Use of this source code is governed by an MIT-style - * license that can be found in the LICENSE file or at - * https://opensource.org/licenses/MIT. - */ -package dev.msfjarvis.claw.gradle - -import com.github.benmanes.gradle.versions.VersionsPlugin -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask -import nl.littlerobots.vcu.plugin.VersionCatalogUpdateExtension -import nl.littlerobots.vcu.plugin.VersionCatalogUpdatePlugin -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.withType - -@Suppress("Unused") -class DependencyUpdatesPlugin : Plugin { - override fun apply(project: Project) { - project.pluginManager.apply(VersionsPlugin::class) - project.pluginManager.apply(VersionCatalogUpdatePlugin::class) - project.tasks.withType().configureEach { - rejectVersionIf { isNonStable(candidate.version) && !isNonStable(currentVersion) } - checkConstraints = true - checkBuildEnvironmentConstraints = true - checkForGradleUpdate = true - } - project.extensions.configure { - keep.keepUnusedLibraries.set(true) - } - } - - private fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } - val regex = "^[0-9,.v-]+(-r)?$".toRegex() - val isStable = stableKeyword || regex.matches(version) - return isStable.not() - } -} diff --git a/build.gradle.kts b/build.gradle.kts index 579954ee..b0b1e7f0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,10 @@ /* - * Copyright © 2021-2023 Harsh Shandilya. + * Copyright © 2021-2024 Harsh Shandilya. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. */ plugins { id("dev.msfjarvis.claw.spotless") - id("dev.msfjarvis.claw.versions") id("dev.msfjarvis.claw.kotlin-common") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ec19eb9e..c40cd486 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,8 +60,6 @@ build-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", ve build-semver = "com.vdurmont:semver4j:3.1.0" build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:4.2.0" build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.24.0" -build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.3" -build-versions = "com.github.ben-manes:gradle-versions-plugin:0.50.0" coil = { module = "io.coil-kt:coil", version.ref = "coil" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } compose-richtext-markdown = { module = "com.halilibo.compose-richtext:richtext-commonmark", version.ref = "richtext" }