feat: Add distribution detection support to .sdkmanrc file#975
feat: Add distribution detection support to .sdkmanrc file#975lukaszgyg wants to merge 3 commits intoactions:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends .sdkmanrc file support to automatically detect and use Java distribution identifiers from SDKMAN version strings (e.g., java=21.0.5-tem), making the distribution input optional when a distribution suffix is present.
Changes:
- Enhanced
.sdkmanrcparsing to extract both version and distribution identifier - Added SDKMAN-to-setup-java distribution mapping for 10 distributions (Temurin, Zulu, Corretto, GraalVM, Liberica, Microsoft, Oracle, SapMachine, JetBrains, Dragonwell)
- Made
distributioninput optional inaction.ymlwhen distribution can be detected from file - Updated return type of
getVersionFromFileContentfromstringtoVersionInfoobject containing version and optional distribution - Modified setup logic to prefer file-extracted distribution over input parameter
Reviewed changes
Copilot reviewed 6 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util.ts | Added VersionInfo interface, updated getVersionFromFileContent to return version and distribution, added mapSdkmanDistribution function with SDKMAN identifier mappings |
| src/setup-java.ts | Modified to handle optional distribution input, prioritize file-extracted distribution, refactored installation logic |
| action.yml | Updated distribution input to be optional with clarified description |
| tests/util.test.ts | Updated test assertions to match new VersionInfo return type, added tests for various distribution identifiers |
| .sdkmanrc.example | Added example file demonstrating supported SDKMAN distribution identifiers |
| .github/workflows/sdkmanrc-example.yml | Added workflow examples showing usage with and without distribution suffix |
| dist/setup/index.js | Compiled source changes for setup entry point |
| dist/cleanup/index.js | Compiled source changes for cleanup entry point |
| package-lock.json | Updated peer dependency flags (normal npm behavior) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Extends .sdkmanrc support to automatically detect Java distribution from SDKMAN identifiers (e.g., java=21.0.5-tem maps to temurin distribution). Makes distribution input optional when using .sdkmanrc with distribution suffix.
9eddd18 to
d2b3ef8
Compare
|
would be great if someone could review this PR. Having to specify the JDK vendor twice is actually improvable. At the moment users have to specify the JDK vendor e.g. Temurin in the sdkman.rc file like "25.0.1-tem" so sdkman picks up the Temurin JDK and also explicitly add a distribution entry containing "temurin" in the github action as well. |
|
Addressed the review feedback and updated the PR description. The branch now includes |
Summary
Extends the existing
.sdkmanrcsupport to automatically detect and use the Java distribution identifier from SDKMAN version strings (for example,java=21.0.5-tem).Related Issue
#971
Changes
.sdkmanrcparsing to extract both the version and the distribution identifiertem->temurinsem->semerualbba/dragonwell->dragonwellzulu->zuluamzn->correttograal/graalce->graalvmlibrca->libericams->microsoftoracle->oraclesapmchn->sapmachinejbr->jetbrainsdistributioninput optional when.sdkmanrcincludes a supported distribution suffixdistafter the source changesUsage
Before (distribution required):
After (distribution auto-detected):
.sdkmanrc file:
Backward Compatibility
.sdkmanrcdoes not include a supported distribution suffix, thedistributioninput is still requiredTesting
npm run format-checknpm run lintnpm run buildnpm test -- --runInBand __tests__/util.test.tsnpm testlocally; all suites passed except one unrelated JetBrains network lookup failure in__tests__/distributors/jetbrains-installer.test.ts