ci: map JDK vendor tokens to JvmVendorSpec constants#6717
Merged
Conversation
The CI matrix passes a short vendor token such as "eclipse" for the test
JDK toolchain. JvmVendorSpec.matching("eclipse") probes the runtime
java.vendor, which Temurin reports inconsistently across versions: JDK 8
reports "Temurin" while 11+ report "Eclipse Adoptium". A plain substring
match therefore cannot resolve a Temurin 8 toolchain, and the same gap
exists for any distribution whose vendor string differs from its token.
Map the known tokens to Gradle's built-in JvmVendorSpec constants, which
recognise every alias a distribution reports, and fall back to a
substring match for anything unmapped. Also guard against a blank vendor
so an empty token no longer narrows the toolchain query.
Mirrors pgjdbc/pgjdbc#4257, which shares this build-logic file.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
The CI matrix passes a short vendor token (such as
eclipsefor Temurin) for the test JDK toolchain, and the build mapped it withJvmVendorSpec.matching(it).matchingprobes the runtimejava.vendor, which Temurin reports inconsistently across versions: JDK 8 reportsjava.vendor="Temurin"while 11+ report"Eclipse Adoptium". A plainmatching("eclipse")therefore cannot resolve a Temurin 8 toolchain, and the same gap exists for any distribution whose vendor string differs from its matrix token.The current matrix only tests JDK 17/21/25/EA, so this is latent rather than actively failing today — but the resolution logic is wrong for the general case, and re-adding an older JDK would surface it.
What
JvmVendorSpecconstants (ADOPTIUM,AMAZON,AZUL,BELLSOFT,MICROSOFT,ORACLE), which recognise every alias a distribution reports across versions; fall back to a substring match for anything unmapped.takeIf { it.isNotBlank() }) so an empty token no longer narrows the toolchain query.This mirrors pgjdbc/pgjdbc#4257, which fixes the same issue in the shared
build-logic/basics/src/main/kotlin/configureToolchain.kt. The new constants are a strict superset of the previousmatching(...)behaviour for the distributions already in the matrix, so they change nothing for JDK 17+.How to verify
./gradlew -Prelease :build-logic:basics:compileKotlincompiles cleanly on Gradle 9.2.1, which provides all of theJvmVendorSpecconstants used here.