Skip to content

Instantly share code, notes, and snippets.

@dnozay
Created February 9, 2017 19:36
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 dnozay/cb646e995e5b79c459143487791a2364 to your computer and use it in GitHub Desktop.
Save dnozay/cb646e995e5b79c459143487791a2364 to your computer and use it in GitHub Desktop.
add markers to gradle output so it's easy to extract the block for a failed task
/*
add markers to gradle output so it's easy to extract the block for a failed task,
e.g. with a stream editor like sed.
*/
useLogger(new CustomEventLogger())
class CustomEventLogger implements TaskExecutionListener {
public void beforeExecute(Task task) {
println "## Start-task: $task.name"
}
public void afterExecute(Task task, TaskState state) {
if (state.getFailure() != null) {
println "## End-task-ERR: $task.name"
} else {
println "## End-task-OK: $task.name"
}
println()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment