Skip to content

Instantly share code, notes, and snippets.

@budioktaviyan
Last active June 20, 2021 04:34
Show Gist options
  • Save budioktaviyan/42f4fb0faac3dc53ddf1c889d8fef2c3 to your computer and use it in GitHub Desktop.
Save budioktaviyan/42f4fb0faac3dc53ddf1c889d8fef2c3 to your computer and use it in GitHub Desktop.
Gradle Versions Plugin
//
// Gradle Versions Plugin
//
apply(plugin = dep.plugin.versions)
tasks.withType<DependencyUpdatesTask>().configureEach {
rejectVersionIf {
currentVersion.isStable && candidate.version.isNotStable
}
gradleReleaseChannel = "current"
revision = "release"
outputFormatter = closureOf<Result> {
val output = PrintStream(rootProject.file("DEPENDENCIES.md").outputStream())
val groups = listOf(exceeded, current, outdated, unresolved).fold(emptySet<Dependency>()) { all, cur -> all + cur.dependencies }
with(output) {
println("# Dependencies")
println("| Status | Name | Group | Version | URL |")
println("| :----: | ---- | ----- | ------- | --- |")
for (dependency in groups.sortedBy{ it.group }) {
with(dependency) {
val status = when (dependency) {
is DependencyOutdated -> ":warning:"
is DependencyUnresolved -> ":question:"
else -> ":heavy_check_mark:"
}
println("| $status | $name | $group | $version | ${projectUrl ?: "-"} |")
}
}
flush()
close()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment