Skip to content

Commit 42e2c97

Browse files
committed
Rewrite ruby/setup-msys2-gcc
1 parent eaecf78 commit 42e2c97

File tree

7 files changed

+593
-452
lines changed

7 files changed

+593
-452
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ jobs:
134134
echo 'ridk is unavailable'
135135
}
136136
} elseif ($plat.Contains('mswin')) {
137-
&"$env:VCPKG_INSTALLATION_ROOT\vcpkg" list
137+
Get-ChildItem "$env:VCPKG_INSTALLATION_ROOT\installed\vcpkg\info"
138138
}
139139
- name: RbConfig::CONFIG
140140
run: ruby -rrbconfig -rpp -e 'pp RbConfig::CONFIG'

common.js

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const linuxOSInfo = require('linux-os-info')
1212

1313
export 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

1717
export 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(/^x64-(ucrt|vcruntime\d{3})-ruby\d{3}\.dll$/)))
364-
}
365-
366359
export 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 => !/\bruby\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

410386
export async function setupJavaHome(rubyPrefix) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy