fix(build-logic): tweak DependencyUpdates configuration

This commit is contained in:
Harsh Shandilya 2022-12-24 01:36:29 +05:30
parent 3cc74f9bcf
commit ed8528aea4
No known key found for this signature in database

View file

@ -26,13 +26,22 @@ class DependencyUpdatesPlugin : Plugin<Project> {
when (candidate.group) { when (candidate.group) {
"com.squareup.okhttp3", "com.squareup.okhttp3",
"org.jetbrains.kotlin" -> true "org.jetbrains.kotlin" -> true
else -> false else -> isNonStable(candidate.version) && !isNonStable(currentVersion)
} }
} }
checkConstraints = true
checkBuildEnvironmentConstraints = true
checkForGradleUpdate = true checkForGradleUpdate = true
} }
project.extensions.configure<VersionCatalogUpdateExtension> { project.extensions.configure<VersionCatalogUpdateExtension> {
keep.keepUnusedLibraries.set(true) keep.keepUnusedLibraries.set(true)
} }
} }
private fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
} }