Kotlin Gradle DSL

By Siarhei Krukau

Elevator Pitch

Gradle is a popular build system expeditiously gaining momentum. But it has one fatal flaw: it uses Groovy for DSL. And Groovy is not groovy at all when it comes to IDE and tooling. Realizing that, Gradle team is working on Kotlin DSL which I am going to cover in this talk.

Description

Gradle is a popular build system expeditiously gaining momentum. But it has one fatal flaw: it uses Groovy for DSL. And Groovy is not groovy at all when it comes to IDE and tooling: its dynamic nature makes it hard to provide static compile-time checks and good auto-completions for developers. As a result, Groovy build files become hard to author and maintain when they grow large. Realizing that, Gradle team has been working on Kotlin DSL since May 2016. Kotlin provides static DSL for Gradle build files improving developer’s experience as a result.

This talk starts from the overview of Gradle and its Groovy DSL. I cover all the parts that make up a build file: plugins, tasks, configuration blocks. Then I demonstrate where Groovy fails and point out the root cause of its flaws. Then I introduce Kotlin Gradle DSL and demonstrate how it improves programmers’ experience with Gradle build files. As it’s not a silver bullet I show where it fails as well. I also explain the magic behind Kotlin support for Gradle DSL. The talk ends with a re-cap of pros and cons of each language and a small analysis of Groovy / Java / Kotlin languages percentage in Gradle’s sources on Github.

The talk is targeted at beginner and intermediate developers who are struggling with Groovy Gradle DSL or just want to learn about Kotlin support for Gradle.

Notes

I have presented this talk twice (both in russian language):

At K⋅Night the talk was among top 5 talks.

There are no particular technical requirements, the slides are optimized for 16:9 projector / screen.