-
-
Save amal/44a1b87754570a57c99e6186217601bd to your computer and use it in GitHub Desktop.
Make Gradle print its task plan
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
// This prints the dependencies of each task in the current execution graph | |
gradle.taskGraph.whenReady( | |
closureOf<TaskExecutionGraph> { | |
println("About to run ${allTasks.size} tasks: (use `-i` to see why tasks are skipped, use `--rerun-tasks` to prevent UP-TO-DATE checks)") | |
allTasks.forEachIndexed { i, task -> | |
val dependenciesString = | |
if (task.dependsOn.isEmpty()) { | |
"" | |
} else { | |
task.dependsOn.joinToString(", ", " (depends on ", ")") { dependency -> | |
dependency.toString().let { | |
if (it.startsWith("provider")) { | |
it.split("'")[1] | |
} else if (it.contains(" dirs")) { | |
"[$it]" | |
} else { | |
":${it.removePrefix(":")}" | |
} | |
} | |
} | |
} | |
println("${(i + 1).toString().padStart(5)}. :${task.name}$dependenciesString") | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment