What is the most elegant way to track the execution times on how long a task took in a gradle build script? In an optimal case log the time directly same or next line to the tas
I know this is an old question, but I've found a cool plugin that does task timing. It's like @jlevy's answer, but with some more options available: https://github.com/passy/build-time-tracker-plugin
This plugin by Pascal Hartig continuously logs your build times and provides CSV and bar chart summaries. The developer recommends it for monitoring your build times over time, versus --profile
which gives you a snapshot for the current build.
This is how I'm currently using it:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "net.rdrei.android.buildtimetracker:gradle-plugin:0.7.+"
}
}
apply plugin: "build-time-tracker"
buildtimetracker {
reporters {
summary {
ordered false
threshold 50
barstyle 'unicode'
}
}
}