Skip to content

fix(java): read the Kotlin Gradle jvmToolchain shorthand - #684

Open
noahkhomer18 wants to merge 1 commit into
vibgrate:mainfrom
noahkhomer18:fix/657-kotlin-jvmtoolchain
Open

noahkhomer18 wants to merge 1 commit into
vibgrate:mainfrom
noahkhomer18:fix/657-kotlin-jvmtoolchain

Conversation

@noahkhomer18

Copy link
Copy Markdown

Closes #657.

Kotlin projects normally declare their JDK with the Kotlin Gradle plugin shorthand rather than sourceCompatibility:

kotlin { jvmToolchain(17) }

That form was not recognised, so those projects reported no Java version at all — no runtime, no runtimeLatest, no runtimeMajorsBehind.

The scanner now also matches jvmToolchain(<digits>). The longer kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(17)) } } form already resolved through the existing JavaLanguageVersion pattern and is unchanged, as are the sourceCompatibility/targetCompatibility forms.

Tests: test/gradle-kotlin-jvmtoolchain.test.ts covers the Kotlin DSL and Groovy short forms, spaces inside the call, and precedence when the file also carries sourceCompatibility.

Proof the tests bite: with the scanner change stashed, 6 of the new tests fail — so they are pinning the new behaviour, not describing it. With the fix, the new file plus gradle-version-catalog and sbom-gradle-scope are 16/16 green.

(cargo-workspace-inheritance still fails on Windows on path separators — pre-existing, untouched.)

Kotlin projects normally declare their JDK with the Kotlin Gradle plugin
shorthand rather than sourceCompatibility:

    kotlin { jvmToolchain(17) }

That form was not recognised, so those projects reported no Java version at
all. The scanner now also matches jvmToolchain(<digits>) and uses it like the
other toolchain declarations. The longer jvmToolchain { languageVersion.set(
JavaLanguageVersion.of(17)) } form already resolved through the existing
JavaLanguageVersion pattern and is unchanged.

Fixes vibgrate#657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: read the Java version from Kotlin jvmToolchain(17) in Gradle builds

1 participant