@@ -13,6 +13,7 @@ const linuxOSInfo = require('linux-os-info')
1313export const windows = ( os . platform ( ) === 'win32' )
1414// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
1515export const drive = ( windows ? ( process . env [ 'RUNNER_TEMP' ] || 'C' ) [ 0 ] : undefined )
16+ const PATH_ENV_VAR = windows ? 'Path' : 'PATH'
1617
1718export const inputs = {
1819 selfHosted : undefined
@@ -365,23 +366,22 @@ export function win2nix(path) {
365366}
366367
367368export function setupPath ( newPathEntries ) {
368- const envPath = windows ? 'Path' : 'PATH'
369- const originalPath = process . env [ envPath ] . split ( path . delimiter )
369+ const originalPath = process . env [ PATH_ENV_VAR ] . split ( path . delimiter )
370370 let cleanPath = originalPath . filter ( entry => ! / \b r u b y \b / i. test ( entry ) )
371371
372- core . group ( `Modifying ${ envPath } ` , async ( ) => {
372+ core . group ( `Modifying ${ PATH_ENV_VAR } ` , async ( ) => {
373373 // First remove the conflicting path entries
374374 if ( cleanPath . length !== originalPath . length ) {
375- console . log ( `Entries removed from ${ envPath } to avoid conflicts with default Ruby:` )
375+ console . log ( `Entries removed from ${ PATH_ENV_VAR } to avoid conflicts with default Ruby:` )
376376 for ( const entry of originalPath ) {
377377 if ( ! cleanPath . includes ( entry ) ) {
378378 console . log ( ` ${ entry } ` )
379379 }
380380 }
381- core . exportVariable ( envPath , cleanPath . join ( path . delimiter ) )
381+ core . exportVariable ( PATH_ENV_VAR , cleanPath . join ( path . delimiter ) )
382382 }
383383
384- console . log ( `Entries added to ${ envPath } to use selected Ruby:` )
384+ console . log ( `Entries added to ${ PATH_ENV_VAR } to use selected Ruby:` )
385385 for ( const entry of newPathEntries ) {
386386 console . log ( ` ${ entry } ` )
387387 }
@@ -415,14 +415,17 @@ export async function setupJavaHome(rubyPrefix) {
415415 // JAVA_HOME_21_X64 - https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java
416416 let newHomeVar = `JAVA_HOME_21_${ arch } `
417417 let newHome = process . env [ newHomeVar ]
418+ let bin = path . join ( newHome , 'bin' )
418419
419420 if ( newHome === "undefined" ) {
420421 throw new Error ( `JAVA_HOME is not Java 21+ needed for JRuby and \$${ newHomeVar } is not defined` )
421422 }
422423
423424 console . log ( `Setting JAVA_HOME to ${ newHomeVar } path ${ newHome } ` )
424-
425425 core . exportVariable ( "JAVA_HOME" , newHome )
426+
427+ console . log ( `Adding ${ bin } to ${ PATH_ENV_VAR } ` )
428+ core . addPath ( bin )
426429 }
427430 } )
428431}
0 commit comments