Infer distribution from asdf .tool-versions vendor prefix#1084
Merged
brunoborges merged 3 commits intoJul 8, 2026
Conversation
asdf-java encodes the JDK vendor as a prefix on the version string in .tool-versions (e.g. `java temurin-17.0.3+7`). Capture that prefix and map it to a setup-java distribution, mirroring the existing .sdkmanrc behavior. Unknown prefixes warn and fall back to the distribution input. Fixes #1081 Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for inferring distribution from asdf-java vendor prefixes in .tool-versions, bringing it in line with the existing .sdkmanrc distribution inference behavior in actions/setup-java.
Changes:
- Updates
.tool-versionsparsing to capture an optional vendor prefix into adistributiongroup and map it to setup-java distributions. - Introduces
mapAsdfDistribution()to normalize asdf-java vendor identifiers (including multi-segment vendors and packaging variants). - Extends documentation and test coverage with supported vendor mappings and example usage.
Show a summary per file
| File | Description |
|---|---|
src/util.ts |
Captures asdf vendor prefix from .tool-versions, maps it to a setup-java distribution, and threads it through existing version parsing. |
__tests__/util.test.ts |
Adds .tool-versions test cases for supported vendors, prefix-less behavior, and unsupported vendor warnings. |
docs/advanced-usage.md |
Documents .tool-versions vendor-prefix distribution inference and lists supported mappings + example. |
dist/setup/index.js |
Regenerated compiled distribution output reflecting the updated util logic. |
dist/cleanup/index.js |
Regenerated compiled distribution output reflecting the updated util logic. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/5 changed files
- Comments generated: 1
- Review effort level: Low
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
…tribution-from-tool-versions
This was referenced Jul 8, 2026
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
asdf's
.tool-versionsencodes the JDK vendor as a prefix on the version string (for examplejava temurin-17.0.3+7orjava corretto-11.0.14.9.1). Until now setup-java discarded that prefix, so users pointingjava-version-fileat a.tool-versionsfile still had to passdistributionexplicitly..sdkmanrcalready infers the distribution; this brings.tool-versionsto parity.Fixes: #1081
What
.tool-versionsbranch ofgetVersionFromFileContentso the asdf-java vendor prefix is captured in a nameddistributiongroup instead of being thrown away. Version parsing is unchanged.mapAsdfDistribution()which maps asdf-java vendors to setup-java distributions. Packaging variants such as-jre,-musl,-openj9,-crac, and-javafxcollapse onto the base vendor, and the two-segment casesgraalvm-communityandoracle-graalvmare handled explicitly..sdkmanrcfallback behavior: unknown or unsupported prefixes (for exampleopenjdk,mandrel,trava) emit a warning and fall back to thedistributioninput. Prefix-less entries likejava 17.0.7keep resolving exactly as before.No caller changes were needed.
setup-java.tsalready consumesversionInfo.distributiongenerically.Vendor mapping
temurin,adoptopenjdktemurinzuluzulucorrettocorrettolibericalibericamicrosoftmicrosoftsemeru,ibmsemerudragonwelldragonwellgraalvm,oracle-graalvmgraalvmgraalvm-communitygraalvm-communityoracleoraclesapmachinesapmachinekonakonajetbrainsjetbrainsNotes for reviewers
adoptopenjdkmaps totemurinsince AdoptOpenJDK became Eclipse Temurin and setup-java'sadoptdistribution is deprecated/EOL. This includes theadoptopenjdk-openj9packaging variants, which collapse ontotemurinas well.+buildmetadata retention and the corretto major-only rule) is untouched; only prefix extraction is new.Testing
.tool-versionscases in__tests__/util.test.tscovering each supported vendor, prefix-less backward compatibility, and the unknown-prefix warn-and-fall-back path.format-checkandlintare clean;dist/regenerated.