Track execution time per task in gradle script?

后端 未结 8 2129
深忆病人
深忆病人 2021-01-30 06:37

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

8条回答
  •  迷失自我
    2021-01-30 07:03

    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'
            }
        }
    }
    

提交回复
热议问题