Last active
January 5, 2022 04:30
-
-
Save msfjarvis/9f7ed2bb0078681f4c9f2aca83a3ffe6 to your computer and use it in GitHub Desktop.
Gradle init script to configure `com.github.ben-manes:gradle-versions-plugin`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initscript { | |
repositories { gradlePluginPortal() } | |
dependencies { classpath("com.github.ben-manes:gradle-versions-plugin:0.41.0") } | |
} | |
allprojects { | |
apply<com.github.benmanes.gradle.versions.VersionsPlugin>() | |
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<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask> { | |
if (project.providers.gradleProperty("stable").forUseAtConfigurationTime().isPresent()) { | |
rejectVersionIf { | |
isNonStable(candidate.version) && !isNonStable(currentVersion) | |
} | |
} | |
checkForGradleUpdate = false | |
checkBuildEnvironmentConstraints = true | |
outputFormatter = "json" | |
outputDir = "build/dependencyUpdates" | |
reportfileName = "report" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment