Skip to content

Commit

Permalink
Improved Gradle Versions Plugin filtering to not reject non-stable ve…
Browse files Browse the repository at this point in the history
…rsions of an artifact that's currently set to a non-stable version.
  • Loading branch information
ianbrandt committed Jul 12, 2024
1 parent 935659b commit 140f419
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencyAnalysis {
tasks {
withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf {
isNonStable(candidate.version)
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
gradleReleaseChannel = CURRENT.id
}
Expand All @@ -68,9 +68,7 @@ fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any {
version.uppercase().contains(it)
}
val unstableKeyword =
version.uppercase().contains("""M\d+""".toRegex())
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = (stableKeyword && !unstableKeyword) || regex.matches(version)
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}

0 comments on commit 140f419

Please sign in to comment.