Skip to content

Automattic/measure-builds-gradle-plugin

Repository files navigation

Tracks Gradle

Pre Merge Checks

Gradle Plugin for reporting build time results into Tracks system.

Inspired by work of @jraska.

How to use

Directly in project

Configure plugin in build.gradle file:

plugins {
    id "io.github.wzieba.tracks.plugin" version "latest_tag"
}

tracks {
    automatticProject.set(io.github.wzieba.tracks.plugin.TracksExtension.AutomatticProject.WooCommerce)
}

Configuration

Property Default Required? Description
automatticProject null yes Project that will determine event name
enabled null no Enable plugin
obfuscateUsername false no If true, then username will be SHA-1 obfuscated

Result

After each build you should see

✅ Build time report of 4m 8s has been received by Apps Metrics.

which confirms received report.

Discrepancies between Gradle reports and this plugin

This plugin might report different data to what Gradle logs at the end of a build.

Number of tasks

The reason is that Gradle log filters out lifecycle tasks, while this plugin, cannot do this as it uses configuration-cache compatible OperationCompletionListener.

Build time

This plugin uses BuildStartedTime service, which is precisely what Gradle uses to log build duration at the end of the build. The difference is where end of the build is defined - in this plugin, with FlowAction. The difference is minor and safe to ignore.