Last active
June 20, 2021 04:34
-
-
Save budioktaviyan/42f4fb0faac3dc53ddf1c889d8fef2c3 to your computer and use it in GitHub Desktop.
Gradle Versions Plugin
This file contains 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
// | |
// 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