Configure dependencyUpdates to detect stable versions only

This commit is contained in:
Goooler 2022-07-22 14:50:54 +08:00
parent 49a6742eb7
commit 52085af6d1

View file

@ -23,6 +23,19 @@ buildscript {
plugins { plugins {
id "com.github.ben-manes.versions" version "0.42.0" id "com.github.ben-manes.versions" version "0.42.0"
} }
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version)
}
}
task clean(type: Delete) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }