Skip to content

asarkar/build-time-tracker

Repository files navigation

build-time-tracker

Gradle plugin that prints the time taken by the tasks in a build.

Sponsor CI Gradle License COC JVM

== Build time summary ==
 :commons:extractIncludeProto | 4S | 14% | ████
       :commons:compileKotlin | 2S |  7% | ██
         :commons:compileJava | 6S | 21% | ██████
       :service:compileKotlin | 1S |  4% | █
        :webapp:compileKotlin | 1S |  4% | █
     :webapp:dockerBuildImage | 4S | 14% | ████
      :webapp:dockerPushImage | 4S | 14% | ████

See Gradle Plugin Portal for usage instructions.

You can customize the plugin as follows:

buildTimeTracker {
    barPosition = BarPosition.TRAILING or BarPosition.LEADING, default is TRAILING
    sortBy = Sort.ASC, Sort.DESC, or Sort.NONE, default is NONE
    output = Output.CONSOLE or Output.CSV, default is CONSOLE
    maxWidth = 120, default is 80
    minTaskDuration = Duration.ofSeconds(1), don't show tasks that take less than a second
    showBars = false or true, default is true
    reportsDir = only relevant if output = CSV, default $buildDir/reports/buildTimeTracker
}

If you are using Kotlin build script, set the configuration properties using property.set() method.

BarPosition, Sort, and Output are enums, so, they need to be imported or fully-qualified with com.asarkar.gradle.buildtimetracker.

ℹ️ The bars and percentages are rounded off such that the output provides a good indication of how long individual tasks took to complete relative to the build, but are not meant to be correct up to the milliseconds. Read this for details.

ℹ️ It is sufficient to apply the plugin to the root project; also applying to subprojects will result in duplication of the report.

⚠️ If the output terminal does not support UTF-8 encoding, the bars may appear as weird characters. If you are running Windows, make sure the terminal encoding is set to UTF-8, or turn off the bars as explained above.

⚠️ If exporting to CSV, and bars are enabled, the resulting file must be imported as UTF-8 encoded CSV data in Microsoft Excel. How to do this depends on the Operating System, and Excel version, but here is one way.

Compatibility Chart

  • Java 17
  • Gradle: v7.6.4 - v8.14. Versions outside this range have not been tested with.

About

Gradle plugin that prints the time taken by the tasks in a build

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •  

Languages