From 7b63caf72d81c61ea19dccd66de203c4b72463c4 Mon Sep 17 00:00:00 2001 From: odaridavid Date: Wed, 20 Mar 2024 20:41:41 +0100 Subject: [PATCH] ignore non stable versions --- build.gradle.kts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index ac783b7..3d99eb0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask + plugins { alias(libs.plugins.com.android.application) apply false alias(libs.plugins.com.android.library) apply false @@ -31,3 +33,16 @@ versionCatalogUpdate { versions.addAll("kotlin-android", "kotlin-serialization") } } + +fun isNonStable(version: String): Boolean { + val nonStableKeyword = listOf("BETA", "ALPHA", "DEV").any { version.uppercase().contains(it) } + val regex = "^[0-9,.v-]+(-r)?$".toRegex() + val isStable = nonStableKeyword.not() || regex.matches(version) + return isStable.not() +} + +tasks.withType { + rejectVersionIf { + isNonStable(candidate.version) + } +} \ No newline at end of file