Cats in the Gradle as 7.0 arrives – with version catalogs, native support for Apple silicon

Cats in the Gradle as 7.0 arrives – with version catalogs, native support for Apple silicon

Version 7.0 of the Gradle build automation tool for software development is out, adding a number of new features in addition to reliability improvements and changes to boost performance.

New features in Grade 7.0 include native support for Apple silicon. While previous Gradle versions were able to run on new Macs with Apple silicon, there were disadvantages; features like the rich console and file system watching would be disabled using an ARM JDK, while using an Intel JDK would cause Gradle to run slowly because of the Rosetta2 compatibility layer. With this release, every feature is now supported using a native ARM JDK.

Gradle, which runs on Java, now supports both running on Java 16 and building applications with it. In previous versions, running Gradle itself on Java 16 produced an error. As of Gradle 7.0, running Gradle itself and building JVM projects with Java 16 is fully supported.

Meanwhile, in order to support the Java 16 JDK and keep up to date with the latest release of the Groovy language object-oriented for Java, Gradle has been upgraded to use Groovy 3 in Groovy DSL build scripts. Groovy 3 introduces a new parser and host of other features that make interoperability with new Java features easier.

Also introduced in Gradle 7.0 is an experimental feature called version catalogs as a standardised way to share dependency versions between projects in multi-project builds. A version catalog enables a build author to centralise third party dependencies in a conventional configuration file and declare the actual dependencies in a type-safe way, according to the Gradle team.

This release also includes improvements in dependency locking, specifically in defaulting to an improved dependency locking file format that should result in fewer lock files, typically one file per project instead of one file per configuration per project. Gradle will also automatically clean up previous lock files when migrating over to the new file format.

Build reliability improvements in Grade 7.0 include disabling of optimisations for validation problems. If a task is failing input/output validation, Gradle will now execute it without the benefit of parallel execution, up-to-date checks and the build cache.

Gradle can also now detect and flag up a warning for missing dependencies where a task consumes the output produced by another without declaring an explicit or inferred task dependency.

This release enables file system watching by default – ideally making incremental builds faster. Under this feature, input and output files for an incremental build are checked to determine what needs to be rebuilt. Gradle keeps what it has learned about the file system in memory between builds and skips reading from the file system on each build. This significantly reduces the amount of disk I/O needed to determine what has changed since the previous build, according to the Gradle team.

For full details on the changes in this version of Gradle, check out the release notes.