@@ -12,7 +12,7 @@ const linuxOSInfo = require('linux-os-info')
1212
1313export const windows = ( os . platform ( ) === 'win32' )
1414// Extract to SSD on Windows, see https://github.com/ruby/setup-ruby/pull/14
15- export const drive = ( windows ? ( process . env [ 'GITHUB_WORKSPACE ' ] || 'C' ) [ 0 ] : undefined )
15+ export const drive = ( windows ? ( process . env [ 'RUNNER_TEMP ' ] || 'C' ) [ 0 ] : undefined )
1616
1717export const inputs = {
1818 selfHosted : undefined
@@ -334,7 +334,7 @@ function engineToToolCacheName(engine) {
334334 } [ engine ]
335335}
336336
337- export function getToolCacheRubyPrefix ( platform , engine , version ) {
337+ export function getToolCacheRubyPrefix ( _platform , engine , version ) {
338338 const toolCache = getToolCachePath ( )
339339 return path . join ( toolCache , engineToToolCacheName ( engine ) , version , os . arch ( ) )
340340}
@@ -356,15 +356,7 @@ export function win2nix(path) {
356356 return path . replace ( / \\ / g, '/' ) . replace ( / / g, '\\ ' )
357357}
358358
359- // JRuby is installed after setupPath is called, so folder doesn't exist
360- function rubyIsUCRT ( path ) {
361- return ! ! ( fs . existsSync ( path ) &&
362- fs . readdirSync ( path , { withFileTypes : true } ) . find ( dirent =>
363- dirent . isFile ( ) && dirent . name . match ( / ^ x 6 4 - ( u c r t | v c r u n t i m e \d { 3 } ) - r u b y \d { 3 } \. d l l $ / ) ) )
364- }
365-
366359export function setupPath ( newPathEntries ) {
367- let msys2Type = null
368360 const envPath = windows ? 'Path' : 'PATH'
369361 const originalPath = process . env [ envPath ] . split ( path . delimiter )
370362 let cleanPath = originalPath . filter ( entry => ! / \b r u b y \b / i. test ( entry ) )
@@ -382,29 +374,13 @@ export function setupPath(newPathEntries) {
382374 core . exportVariable ( envPath , cleanPath . join ( path . delimiter ) )
383375 }
384376
385- // Then add new path entries using core.addPath()
386- let newPath
387- const windowsToolchain = core . getInput ( 'windows-toolchain' )
388- if ( windows && windowsToolchain !== 'none' ) {
389- // main Ruby dll determines whether mingw or ucrt build
390- msys2Type = os . arch ( ) === 'arm64'
391- ? 'clangarm64'
392- : rubyIsUCRT ( newPathEntries [ 0 ] ) ? 'ucrt64' : 'mingw64'
393-
394- // add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain
395- const msys2 = [ `C:\\msys64\\${ msys2Type } \\bin` , 'C:\\msys64\\usr\\bin' ]
396- newPath = [ ...newPathEntries , ...msys2 ]
397- } else {
398- newPath = newPathEntries
399- }
400377 console . log ( `Entries added to ${ envPath } to use selected Ruby:` )
401- for ( const entry of newPath ) {
378+ for ( const entry of newPathEntries ) {
402379 console . log ( ` ${ entry } ` )
403380 }
404381 core . endGroup ( )
405382
406- core . addPath ( newPath . join ( path . delimiter ) )
407- return msys2Type
383+ core . addPath ( newPathEntries . join ( path . delimiter ) )
408384}
409385
410386export async function setupJavaHome ( rubyPrefix ) {
0 commit comments