Check out Medium articles for more insights: Speed Up Android Builds and Profile & Benchmark Android Builds
Different scenarios.txt in different branches:
You can run scenarios using https://github.com/gradle/gradle-profiler
gradle-profiler --benchmark --project-dir ./ --output-dir ./build --scenario-file scenarios.txt --gradle-user-home=./build/gradle
Use ./build directory not to add generated classes in root project
Additionally you can put other measurement params:
--measure-build-op
--measure-config-time
--measure-gc
--measure-local-build-cache