Gradle v7.1 RC2 releases: automation building tools
Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, it offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. It has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins.
- Highly customizable — Gradle is modeled in a way that customizable and extensible in the most fundamental ways.
- Fast — Gradle completes tasks quickly by reusing outputs from previous executions, processing only inputs that changed, and executing tasks in parallel.
- Powerful — Gradle is the official build tool for Android, and comes with support for many popular languages and technologies.
Improved incremental compilation for Java
Gradle has a Java incremental compiler enabled by default that makes incremental builds faster by only compiling Java source files that need to be compiled.
The Java incremental compiler received substantial improvements in this release.
Incremental compilation analysis is now stored in the build cache
In previous Gradle releases, incremental compilation analysis was only stored locally. This meant that when the compile task’s outputs were fetched from the build cache, a subsequent build could not do incremental compilation and always required a full recompilation.
In Gradle 7.1, the result of incremental analysis is now stored in the build cache and the first compilation after fetching from the build cache will be incremental.
Incremental compilation analysis is faster, uses less memory and disk space
Incremental compilation analysis requires Gradle to extract symbols from class files and analyze a transitive graph of dependencies to determine the consumers of a particular symbol. This can consume lots of memory and time.
Gradle 7.1 significantly reduces the cost of incremental compilation analysis, as well as the size of the analysis.
The impact of this change will vary by project but can be very noticeable. On the Gradle project itself, we were able to make incremental compilation up to twice as fast!
Changes to constants do not trigger a full recompilation anymore
Lastly, because of the way the Java compiler works, previous Gradle releases were forced to perform a full recompilation as soon as any constant was changed in an upstream dependency.
Gradle 7.1 introduces a compiler plugin that performs constant usage tracking, and only recompiles the consumers of constants when those constants change.
This can speedup incremental builds for projects using lots of constants, which is common for generated code from template engines.