Skip to content

Switch JAVA_HOME to 21 for JRuby #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 12, 2025
9 changes: 9 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,12 @@ export function setupPath(newPathEntries) {
core.addPath(newPath.join(path.delimiter))
return msys2Type
}

export function setupJavaHome() {
core.startGroup(`Modifying JAVA_HOME for JRuby`)
let newHomeVar = `JAVA_HOME_21_${os.arch().toUpperCase()}`;
let newHome = process.env[newHomeVar];
console.log(`Setting JAVA_HOME to ${newHomeVar} path ${newHome}`)
core.exportVariable("JAVA_HOME", newHome);
core.endGroup()
}
4 changes: 4 additions & 0 deletions ruby-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export async function install(platform, engine, version) {
// Set the PATH now, so the MSYS2 'tar' is in Path on Windows
common.setupPath([path.join(rubyPrefix, 'bin')])

if (engine == "jruby") {
common.setupJavaHome();
}

if (!inToolCache) {
await io.mkdirP(rubyPrefix)
await downloadAndExtract(platform, engine, version, rubyPrefix)
Expand Down
Loading