If profiling your build shows significant time spend in Configuring Projects, the Configure on Demand option might improve your performance.
You can enable Configure on Demand mode by editing $GRADLE_USER_HOME/.gradle/gradle.properties
(~/.gradle/gradle.properties
by default), and setting org.gradle.configureondemand
.
org.gradle.configureondemand=true
To enable it only for a specific project, edit that project's gradle.properties
file instead.
If Configure on Demand is enabled, instead of configuring all projects up front, Gradle will only configure projects that are needed for the task being run.
From the Gralde Manual:
Configuration on demand mode attempts to configure only projects that are relevant for requested tasks, i.e. it only executes the
build.gradle
file of projects that are participating in the build. This way, the configuration time of a large multi-project build can be reduced. In the long term, this mode will become the default mode, possibly the only mode for Gradle build execution.