Skip to content

Commit

Permalink
ignore non stable versions
Browse files Browse the repository at this point in the history
  • Loading branch information
odaridavid committed Mar 20, 2024
1 parent e4f3fae commit 7b63caf
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}

0 comments on commit 7b63caf

Please sign in to comment.