gradle: migrate to build-logic

This commit is contained in:
Harsh Shandilya 2022-04-05 19:10:34 +05:30
parent 4cef244d71
commit 3097eaf82f
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
26 changed files with 501 additions and 182 deletions

View file

@ -0,0 +1,27 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
plugins {
id("com.github.ben-manes.versions")
id("nl.littlerobots.version-catalog-update")
}
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()
}
tasks.withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf {
when (candidate.group) {
"com.android.application", "com.android.library" -> true
else -> isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}
checkForGradleUpdate = false
checkBuildEnvironmentConstraints = true
outputFormatter = "json"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
}