refactor: remove unused versions plugin

We fully rely on Renovate for this
This commit is contained in:
Harsh Shandilya 2024-01-19 16:40:58 +05:30
parent d5a1413799
commit 9fb8e17cf6
4 changed files with 1 additions and 51 deletions

View File

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

View File

@ -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<Project> {
override fun apply(project: Project) {
project.pluginManager.apply(VersionsPlugin::class)
project.pluginManager.apply(VersionCatalogUpdatePlugin::class)
project.tasks.withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf { isNonStable(candidate.version) && !isNonStable(currentVersion) }
checkConstraints = true
checkBuildEnvironmentConstraints = true
checkForGradleUpdate = true
}
project.extensions.configure<VersionCatalogUpdateExtension> {
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()
}
}

View File

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

View File

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