build: pin the Gradle daemon JVM to 21 - #84
Merged
Merged
Conversation
`:detekt` cannot run on JDK 25. detekt 1.23.8 invokes its analysis in-process on
the Gradle daemon's JVM, and the embedded Kotlin compiler's shaded
`com.intellij.util.lang.JavaVersion.parse` rejects a feature version of 25:
Caused by: java.lang.IllegalArgumentException: 25.0.4.1
at ...JavaVersion.parse(JavaVersion.java:307)
at ...JavaVersion.current(JavaVersion.java:176)
at ...JavaVersionUtilsKt.isAtLeastJava9(javaVersionUtils.kt:11)
at ...KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:243)
at io.gitlab.arturbosch.detekt.core...AnalysisFacade.runAnalysis
1.23.8 is the newest stable detekt, so there is no version to bump to. Pinning
the daemon is what the other KMP repos in the org already do —
MQTTastic-Client-KMP, meshtastic-sdk and meshtastic-node-kmp all carry this
file; kzstd, TAKPacket-SDK and gradle-flatpak-sources do not, and kzstd is the
one that just took a runner-JDK bump (#81).
The pin outranks an explicitly requested JDK: measured here with
`./gradlew detekt --rerun-tasks --no-build-cache -Dorg.gradle.java.home=<a real
JDK 25>`, which is RED without this file (`> 25.0.3`) and BUILD SUCCESSFUL with
it, detekt executed rather than served from cache. So it also inoculates the
repo against every future runner-JDK bump, not just this one.
No `toolchainUrl.*` download entries: generating them needs a toolchain
download repository, which this build deliberately does not configure.
CI runners and `CONTRIBUTING.md` both already provide a JDK 21 to detect.
`jvmToolchain(21)` was never affected — compiling with the daemon on JDK 25
still emitted major-version 65 bytecode.
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
|
Warning Review limit reachedNext included review available in 11 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
gradle/gradle-daemon-jvm.propertieswithtoolchainVersion=21, so the Gradle daemon runs on Java 21 whatever JDK the launcher or the CI runner offers. Fixes:detekton the JDK 25 runners that #81 introduced, and unblocks #82.Type of change
Related issue / discussion
Follows #81 (java-jdk v25). Unblocks #82. Supersedes #83, which reverted #81 instead — this is the better shape, because it fixes the class of problem rather than one instance.
detekt 1.23.8 invokes its analysis in-process on the Gradle daemon's JVM, and the embedded Kotlin compiler's shaded IntelliJ
JavaVersion.parserejects a feature version of 25:1.23.8 is the newest stable detekt, so there is nothing to bump to.
How was this verified?
Measured both ways on this machine, against a real JDK 25 requested explicitly, with
--rerun-tasks --no-build-cacheso nothing could be replayed:./gradlew detekt --rerun-tasks --no-build-cache -Dorg.gradle.java.home=<JDK 25>FAILED—Execution failed for task ':detekt'/> 25.0.3BUILD SUCCESSFUL,1 actionable task: 1 executedAlso confirmed
jvmToolchain(21)was never the issue::jvmMainClasses --rerun-tasks --no-build-cachewith the daemon on JDK 25 still emits major-version 65 (Java 21) bytecode, perjavap -v. #81 was a CI-runner change, not a published-bytecode change.Why #81's CI did not catch this
:detektwas servedFROM-CACHEon #81's PR run and on its merge-queue run — nothing detekt reads had changed, so the new runner JDK was never exercised. The first build that actually re-ran detekt under JDK 25 was the merge-queue run for #82, which failed. On this PR detekt will very likely beFROM-CACHEagain for the same reason; #82's merge-queue run is the build that genuinely proves the fix, because the Kotlin bump invalidates detekt's inputs.Affirmations
CONTRIBUTING.md../gradlew buildpasses locally.Notes for reviewers
toolchainUrl.*download entries../gradlew updateDaemonJvmrefuses to generate them here —Toolchain download repositories have not been configured— because this build deliberately carries no foojay resolver. Without them Gradle must detect a JDK 21 rather than download one; GitHub's runner images ship one, andCONTRIBUTING.mdalready requires JDK 21 locally. Adding the foojay resolver tosettings.gradle.ktsis the follow-up if that ever bites.MQTTastic-Client-KMP,meshtastic-sdkandmeshtastic-node-kmpalready carry this file;kzstd,TAKPacket-SDKandgradle-flatpak-sourcesdid not, and those last two run detekt 1.23.x too — they have the same latent break the moment they take a runner-JDK bump.