Skip to content

ci: map JDK vendor tokens to JvmVendorSpec constants#6717

Merged
vlsi merged 1 commit into
apache:masterfrom
vlsi:ci-toolchain-vendor-spec
Jun 26, 2026
Merged

ci: map JDK vendor tokens to JvmVendorSpec constants#6717
vlsi merged 1 commit into
apache:masterfrom
vlsi:ci-toolchain-vendor-spec

Conversation

@vlsi

@vlsi vlsi commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Why

The CI matrix passes a short vendor token (such as eclipse for Temurin) for the test JDK toolchain, and the build mapped it with JvmVendorSpec.matching(it). matching probes the runtime java.vendor, which Temurin reports inconsistently across versions: JDK 8 reports java.vendor="Temurin" while 11+ report "Eclipse Adoptium". A plain matching("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

  • Map the known vendor tokens to Gradle's built-in JvmVendorSpec constants (ADOPTIUM, AMAZON, AZUL, BELLSOFT, MICROSOFT, ORACLE), which recognise every alias a distribution reports across versions; fall back to a substring match for anything unmapped.
  • Guard against a blank vendor (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 previous matching(...) behaviour for the distributions already in the matrix, so they change nothing for JDK 17+.

How to verify

./gradlew -Prelease :build-logic:basics:compileKotlin compiles cleanly on Gradle 9.2.1, which provides all of the JvmVendorSpec constants used here.

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>
@vlsi vlsi merged commit bb30edf into apache:master Jun 26, 2026
5 of 6 checks passed
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.

1 participant