@@ -7,6 +7,7 @@ const crypto = require('crypto')
7
7
const core = require ( '@actions/core' )
8
8
const tc = require ( '@actions/tool-cache' )
9
9
const exec = require ( '@actions/exec' )
10
+ const common = require ( './common' )
10
11
const { performance } = require ( 'perf_hooks' )
11
12
const linuxOSInfo = require ( 'linux-os-info' )
12
13
@@ -406,33 +407,31 @@ export function setupPath(newPathEntries) {
406
407
}
407
408
408
409
export async function setupJavaHome ( ) {
409
- core . startGroup ( `Modifying JAVA_HOME for JRuby` )
410
+ common . measure ( "Modifying JAVA_HOME for JRuby" , async ( ) => {
411
+ console . log ( "attempting to run with existing JAVA_HOME" )
410
412
411
- console . log ( "attempting to run with existing JAVA_HOME" )
413
+ let ret = await exec . exec ( 'ruby' , [ '--version' ] )
412
414
413
- let ret = await exec . exec ( 'ruby' , [ '--version' ] )
415
+ if ( ret === 0 ) {
416
+ console . log ( "JRuby successfully starts, using existing JAVA_HOME" )
417
+ } else {
418
+ console . log ( "JRuby failed to start, try Java 21 envs" )
414
419
415
- if ( ret === 0 ) {
416
- console . log ( "JRuby successfully starts, using existing JAVA_HOME" )
417
- } else {
418
- console . log ( "JRuby failed to start, try Java 21 envs" )
419
-
420
- let arch = os . arch ( )
421
- if ( arch === "x64" || os . platform ( ) !== "darwin" ) {
422
- arch = "X64"
423
- }
424
-
425
- let newHomeVar = `JAVA_HOME_21_${ arch } `
426
- let newHome = process . env [ newHomeVar ]
420
+ let arch = os . arch ( )
421
+ if ( arch === "x64" || os . platform ( ) !== "darwin" ) {
422
+ arch = "X64"
423
+ }
427
424
428
- if ( newHome === "undefined" ) {
429
- throw new Error ( `JAVA_HOME is not Java 21+ needed for JRuby and \$${ newHomeVar } is not defined` )
430
- }
425
+ let newHomeVar = `JAVA_HOME_21_${ arch } `
426
+ let newHome = process . env [ newHomeVar ]
431
427
432
- console . log ( `Setting JAVA_HOME to ${ newHomeVar } path ${ newHome } ` )
428
+ if ( newHome === "undefined" ) {
429
+ throw new Error ( `JAVA_HOME is not Java 21+ needed for JRuby and \$${ newHomeVar } is not defined` )
430
+ }
433
431
434
- core . exportVariable ( "JAVA_HOME" , newHome )
435
- }
432
+ console . log ( `Setting JAVA_HOME to ${ newHomeVar } path ${ newHome } ` )
436
433
437
- core . endGroup ( )
434
+ core . exportVariable ( "JAVA_HOME" , newHome )
435
+ }
436
+ } )
438
437
}
0 commit comments