Traveloka Doni Winata Sep 8, 2022

Automating Android Build Benchmarking with Gradle Profiler

M2 Related OWASP risk: Inadequate Supply Chain Security Learn more →

Article Summary

Doni Winata from Traveloka's Android Infra team reveals how his team automated build benchmarking to catch performance regressions before they hit production. For projects with 300+ modules and 15-20 minute build times, manual benchmarking isn't an option.

Benchmarking Android builds is notoriously tricky due to cache states, daemon conditions, and project size. Doni's team integrated Gradle Profiler with Gradle Enterprise on their CI/CD pipeline to automate the entire process, enabling daily monitoring and regression detection without blocking developer machines.

Key Takeaways

Critical Insight

Automating build benchmarks with Gradle Profiler and Gradle Enterprise enabled Traveloka to monitor daily builds, compare branches effortlessly, and catch performance regressions that would otherwise slip through.

The article includes actual benchmark configurations and Jenkins pipeline setup you can adapt for your own Android project.

About This Article

Problem

Traveloka's Android project has over 300 modules, which makes build performance unpredictable. Cache states, daemon conditions, and project size all affect how accurately they can benchmark and measure consistency.

Solution

Doni Winata's team set up parameterized scenario files in Gradle Profiler. These files specify warm-ups, worker counts, and task configurations. They then fed the results into Gradle Enterprise and added custom tags so they could filter by scenario name and profiler phase.

Impact

Their daily automated monitoring caught a real problem where R8 build times got slower after the Android Gradle Plugin 7.2 changed the debuggable setting to false. This let them analyze the root cause quickly by comparing build scans.