Skip to content

Instantly share code, notes, and snippets.

@farrukhnajmi
Created January 30, 2019 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farrukhnajmi/da3e9aced6b105c37ca0fe990543c4b4 to your computer and use it in GitHub Desktop.
Save farrukhnajmi/da3e9aced6b105c37ca0fe990543c4b4 to your computer and use it in GitHub Desktop.
Gradle afterTask hook to print inputs and outputs of all tasks
gradle.taskGraph.afterTask { task ->
StringBuffer taskInfo = new StringBuffer()
taskInfo << "name:$task.name group:$task.group : $task.description conv:$task.convention.plugins\n"
taskInfo << " Inputs\n"
if ((task.inputs != null) && (task.inputs.files != null) && (!task.inputs.files.empty)) {
task.inputs.files.each { it ->
taskInfo << " ${it.absolutePath}\n"
}
} else {
taskInfo << " None\n"
}
taskInfo << " outputs:\n"
if ((task.outputs != null) && (task.outputs.files != null) && (!task.outputs.files.empty)) {
task.outputs.files.each { it ->
taskInfo << " ${it.absolutePath}\n"
}
} else {
taskInfo << " None\n"
}
println taskInfo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment