Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ plugins {

repositories { gradlePluginPortal() }

// Pin the precompiled-script-plugin compilation to Java 17 so the generated plugin classes load on
// the daemon regardless of which JDK it runs on. Without this, kotlin-dsl targets whatever JDK the
// daemon happens to use (e.g. 21/25), emitting newer bytecode that a Java 17 daemon cannot load
// (UnsupportedClassVersionError).
kotlin { jvmToolchain(17) }

spotless { kotlinGradle { ktfmt().googleStyle() } }
5 changes: 5 additions & 0 deletions build-logic/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# build-logic is an included build, so it does NOT inherit the root gradle.properties; its Kotlin
# compile daemon (which builds the precompiled script plugins) must be sized here. Without this the
# cold compile fails with an OOM / "internal compiler error" and falls back to a slow no-daemon
# compile. Raise -Xmx further if you still see those failures on a cold build.
kotlin.daemon.jvmargs=-Xmx2g
10 changes: 7 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,13 @@ allprojects {
kotlinGradle { ktfmt("0.61").googleStyle() }
java {
target("src/*/java/**/*.java")
// since kfmt also brings in google-java-format we need to sync versions
// https://github.com/facebook/ktfmt/blob/v0.61/gradle/libs.versions.toml#L7
googleJavaFormat("1.23.0")
// google-java-format 1.28.0: earlier versions (e.g. 1.23.0, which ktfmt 0.61 bundles) call
// com.sun.tools.javac internals that changed in recent JDKs, so Spotless throws
// NoSuchMethodError/NoClassDefFoundError when the daemon runs on a newer JDK (e.g. 25).
// 1.28.0 is the newest release that still runs on JDK 17 (1.29.0+ requires JDK 21+),
// matching the daemon/CI toolchain. This Java step has its own formatter classpath,
// independent of ktfmt's bundled copy (used only for Kotlin), so they need not match.
googleJavaFormat("1.28.0")
removeUnusedImports()
trimTrailingWhitespace()
forbidWildcardImports()
Expand Down
Loading