Giter Site home page Giter Site logo

automattic / measure-builds-gradle-plugin Goto Github PK

View Code? Open in Web Editor NEW
76.0 3.0 2.0 284 KB

Gradle Plugin for reporting build time metrics.

License: MIT License

Kotlin 99.66% Shell 0.34%
android build buildscan configuration-cache gradle gradle-enterprise metrics

measure-builds-gradle-plugin's Introduction

measure-builds Gradle Plugin Pre Merge Checks Gradle Plugin Portal Version

Gradle Plugin for reporting build metrics at the end of the build.

Features

  • Add own, custom reporters and send metrics to any system
  • Configuration Cache compatibility
  • Gradle Enterprise integration - optionally attach Gradle Scan Id to the metrics

Setup

// settings.gradle
plugins {
    id "com.gradle.enterprise" version "latest_version" // optional
}

// build.gradle
import com.automattic.android.measure.reporters.MetricsReport
import com.automattic.android.measure.reporters.SlowSlowTasksMetricsReporter

plugins {
    id "com.automattic.android.measure-builds" version "latest_tag"
}

measureBuilds {
    enable = true
    attachGradleScanId = true // `false`, if no Enterprise plugin applied OR don't want to attach build scan id
    onBuildMetricsReadyListener { MetricsReport metricsReport ->
        // Use ready reporters
        SlowSlowTasksMetricsReporter.report(metricsReport)
        
        // or add your own reporters here or use 
        MyCustomReporter.report(metricsReport)
    }
}

Configuration

Property Default Description
enable false Enable plugin
onBuildMetricsReadyListener Callback to be called when build metrics are ready to be reported. Use this to add your own reporters.
attachGradleScanId false Upload metrics after build scan is published, with build scan id attached. If false, metrics will be uploaded upon build finish, without build scan id attached
obfuscateUsername false Obfuscate system username with SHA-1

Demo

image

measure-builds-gradle-plugin's People

Contributors

malinajirka avatar takahirom avatar wzieba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

measure-builds-gradle-plugin's Issues

Do not collect build times if they are not meant to be sent

โš ๏ธ Is your feature request related to a problem? Please describe

Currently, even if user opt-out from the measuring build times, plugin still measures the times - it just doesn't send it.

๐Ÿ’ก Describe the solution you'd like

The plugin should not measure any times if user resigned from sending them - there's no need for additional build overhead (even if small).

Thank you @oguzkocer for reporting this!

Windows 10 compatibility

Hello ๐Ÿ‘‹, is the plugin supposed to work under windows? This line seems to break the gradle build as uname is not a Windows command.

my project build.gradle.kts

plugins {
    id("com.automattic.android.measure-builds") version "3.0.0"
}

measureBuilds {
    enable = true
}

The error I got

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'XXXXX'.
> A problem occurred starting process 'command 'uname''

Thanks for the response

Use Gradle `logger` instead of `println`

โš ๏ธ Is your feature request related to a problem? Please describe

Currently plugin uses println for logging events but its not in sync with other Gradle logs - e.g. ./gradlew -q will print logs from this plugin as noticed here: woocommerce/woocommerce-android#5214

๐Ÿ’ก Describe the solution you'd like

The plugin should use in-house Gradle logger to log events.

Thank you @oguzkocer for reporting this

Set up upload Gradle Plugin Portal

In the past, this plugin was hosted on Gradle Plugin Portal. We changed it to Automattic's S3 instance though to get more features (per commit publish).

But when #38 will be merged, it'll make sense to offer the plugin on Gradle Plugin Portal as well, to make it available for a wider audience, that prefer to use a standardized repository (Gradle Plugin Portal) than custom, 3rd party one (Automattic's S3).

Add tests

Currently plugin is completely not tested. It'd be worth to add tests like:

  • Unit tests for networking layer
  • Tests for integrating with a project
  • Periodic test about checking if events are accepted by Tracks

Add documentation

This project could use some documentation in two forms:

  • Update and add more to the project's Wiki page. Explain the overall flow of events and how to integrate the plugin
  • Add Javadoc comments, especially to plugin's extension, as this is the main contact point with consumers.

Create build report file

At the end of the build, the plugin could produce a file to /build/ directory, containing gathered metrics. This would make debugging and functional tests much easier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.