Skip to content

build: Migrate to Gradle Kotlin DSL

Antoine Belvire requested to merge build/gradle_kotlin_dsl into master

Context

Gradle has announced that Kotlin DSL is now the default Gradle DSL, instead of Groovy.

Invoked rationale:

  • Kotlin is statically typed (which I like)
  • With an elegant syntax (no opinion)
  • Kotlin DSL is better supported by IDEs (by IntelliJ at least)

Probably some politics behind this too (IntelliJ/Google pushing for Kotlin because they have more interests in it than in Groovy). I found IntelliJ support for Groovy already quite good, compared with previous experience with - badly configured - Eclipse.

Anyway, this MR aims to give Kotlin DSL a try. It migrates all build files to Kotlin DSL. No rush though, it might be good to delay the merge as there are still important issues with Kotlin DSL, compared with the Groovy DSL, in particular:

  • Problematic usage of version catalogs in convention plugins - at least it's worse than with the Groovy DSL: gh#gradle/gradle#15383
  • Bad performances compared with the Groovy DSL: gh#gradle/gradle#15886. That one is annoying given that CI is already way slower than it should be.

Official migration guide is here.

What has changed?

Main Changes

  • Migrate build files to Kotlin DSL
  • Migrate convention plugins to Kotlin DSL

Side Effects

  • Update build image to fix Kotlin build error: Gradle 7.6 -> Gradle 8.0.2.
  • Use build cache across builds: Improve speed.
  • Update build image to include git: Enable copyright checker to read .gitignore and avoid checking ignored files (e.g. build cache files).

Others

None yet.

Edited by Antoine Belvire

Merge request reports