Road to Gradle 9 with Louis Jacomet

At Devoxx France, we discussed the upcoming Gradle 9 release with Louis Jacomet, a tech lead at Gradle

Table of Contents

Introduction

At Devoxx France, we sat down with Louis Jacomet, a tech lead at Gradle Inc. Louis leads the Gradle Build Tool support team and coordinates releases, so you can often see him active on GitHub issues and speaking at Gradle conferences. Let’s dive into what Louis shares about the upcoming Gradle 9 release!

alt_text

A Busy Day at Devoxx FR #

Louis had a packed schedule on Friday at Devoxx FR, with 4 hours of talks lined up. He did a session with Hervé Boutemy from the Apache Maven community on navigating the labyrinth of dependency management, which was a 1-hour talk. He also had a separate discussion with his colleague Paul Merlin about the upcoming features in Gradle 9.

Preparing for so many talks at once is no small feat. As Louis puts it: Thinking about what you want to say, organizing it, having cool demos, and making it interesting for the audience. Yeah, it’s work. At the conference, Maven and Gradle folks worked together to share tips and best practices on dependency management in both systems. See the talk by Louis and Hervé Boutemy here (in French):

alt_text

Key Areas in Gradle 9 #

So what can we expect in Gradle 9? Louis outlined a few key areas they’re focusing on for this next major version of Gradle:

  • 🚀 Performance
  • 💡 Comprehensibility
  • 🐘 Support for modern Java and Kotlin versions

Configuration Cache Improvements #

One major focus is continuing the work on the Configuration Cache, which was marked stable in Gradle 8.1. In Gradle 9.0, the Configuration Cache will be the preferred mode of execution, and turning it off will be deprecated. This means every build should use the Configuration Cache feature, speeding up the configuration phase and making builds faster overall.

alt_text

Gradle configuration is a significant part of the build, hence the Configuration Cache improvements.

However, this necessitates considerable effort on internal Gradle plugins and accommodating use cases that aren’t always compatible. This is particularly true for community plugins. The Gradle team will continue collaborating with the community on this.

There’s a GitHub issue with a list of known compatible plugins and compatibility issues, including all the most popular plugins. Louis encourages the community to check it out and mention your favorite plugin if it’s incompatible.

Isolated Projects for Faster Configuration #

Configuration Cache is great if you get a cache hit, but you still have to go through the configuration phase if you don’t. The next step for the Gradle team is Isolated Projects.

Due to Gradle’s history and mutable model, whenever you make a change, you effectively have to rerun the whole configuration. It can be a problem for multi-module builds, even if some have no changes. Android Studio is notoriously known for taking a long time to synchronize Gradle projects because of it.

For Isolated Projects, the goal is to have the ability to run the configuration phase of Gradle in parallel and cache it incrementally. This will enable Gradle to rerun the configuration phase only for the affected projects whenever you modify the build logic.

For Gradle 9, the team plans to release an incubating version for early adopters to try out. You can also report issues and request support for additional patterns during incubation.

Kotlin 2.0 Integration #

The Gradle team is looking to have Kotlin 2.0 integrated into Gradle 9 and to leverage the K2 compiler to speed up Kotlin build script compiling. Gradle participated in the Kotlin 2.0 Early-Access Program organized by JetBrains and the Kotlin Foundation.

Gradle was highlighted among other Kotlin 2 EAP Champions at the KotlinConf opening Keynote. Photo by Qian Jin:

alt_text

Normally, Gradle can’t do major upgrades of Kotlin outside of a major upgrade of Gradle because it impacts compatibility. So Kotlin 2.0 will be coming with Gradle 9. We already have experimental builds with Kotlin 2.0 support, so nightly builds might become available earlier.

Lazy APIs and Bytecode Transforms #

Gradle has been promoting a set of lazy APIs for some time. These APIs aim to resolve evaluation and execution ordering (as in the Provider API) and allow for late evaluation of properties, enabling you to configure dependencies during the configuration phase and obtain the correct value during execution.

interface Extension {
  val description: Property<String>
}

// register "extension" with type Extension

extension {
  // Using the set() method call
  description.set("Hello Property")

  // Using lazy property assignment
  description = "Hello Property"
}

For Gradle 9, a significant migration to the new API is planned, ensuring that existing plugins can still be applied. The idea is to use bytecode transforms behind the scenes, allowing plugins targeting old-style getters and setters to work transparently with the provider API.

Until now, Gradle has been migrating properties one by one, which involves finding a new name, introducing it, deprecating the old one, and eventually removing the old one in the next major version. This is a lengthy and disruptive process. With Gradle 9, the team aims to make one final, significant change to streamline this process. Due to its complexity, it is still uncertain whether automatic compatibility can be offered to plugin authors.

"Paul Merlin and presenting on Gradle 9 and Lazy API"

Java Version Support #

Gradle aims to keep up with new Java versions. In Gradle 8.7, you can use Java 22 through the toolchain mechanism to compile, run, and test tools. However, Gradle relies on Groovy and Kotlin, which also need to support Java 22. Full support for Java 22 will be available in Gradle 8.8.

For Java 23, the Gradle team is proactively exploring ways to provide support as early as possible, understanding that users may want to try early access features of upcoming Java versions. Given the current timeline, Java 23 support is likely to be available in the 9.0 release.

Sharing Feedback #

When asked if he has any tips or advice to communicate to Gradle users, Louis highlights the importance of user feedback:

If you struggle with a topic, you don’t find the right documentation. Let us know. That’s something compared to some other bug fixes and feature requests. It is often easier to move forward with and can help others with the same challenges.

The Gradle team has started a few initiatives to improve documentation:

  • A new feedback form has been implemented that allows you to submit GitHub issues immediately. Soon, you will be able to edit and submit pull requests from the documentation directly
  • More velocity for documentation updates so that every pull request merged will show up in the current version that evening
  • Major documentation initiatives, including the new Gradle Cookbook

Any contributions and reports related to documentation are very welcome!

Wrapping Up #

It’s exciting to hear about all the improvements and new features coming in Gradle 9, from Configuration Cache enhancements to Isolated Projects, Kotlin 2.0 integration, lazy APIs, and better Java version support. A huge thanks to Louis for sharing these insights amidst his busy schedule at Devoxx FR. We look forward to seeing Gradle 9 release candidates and features soon.

To learn more about the initiatives in Gradle, check out the Gradle Build Tool roadmap. We have a lot more going on there in addition to Gradle 9.

As always, the Gradle community’s feedback and contributions are invaluable. So try out the new features, report any problems, and let the Gradle team know if you want something documented. Together, we can make Gradle 9 the best release yet!

References #

Talk by Louis:

Discuss