Skip to content

Commit 24d6dee

Browse files
MSP-Gregeregon
authored andcommitted
Windows JRuby - install MinGW tools, typo
1 parent 3b96304 commit 24d6dee

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ export async function setupRuby(options = {}) {
5151
createGemRC(engine, version)
5252
envPreInstall()
5353

54+
// JRuby can use compiled extension code, so make sure gcc exists.
55+
// As of Jan-2022, JRuby compiles against msvcrt.
56+
if (platform.startsWith('windows') && (engine === 'jruby') &&
57+
!fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) {
58+
await require('./windows').installJRubyTools()
59+
}
60+
5461
const rubyPrefix = await installer.install(platform, engine, version)
5562

5663
// When setup-ruby is used by other actions, this allows code in them to run

windows.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function install(platform, engine, version) {
6363
// install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
6464

6565
if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) {
66-
await installMSY2Tools()
66+
await installMSYS2Tools()
6767
}
6868

6969
if ((( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) &&
@@ -95,7 +95,7 @@ async function installGCCTools(type) {
9595

9696
// Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it.
9797
// A subset of the MSYS2 base-devel group
98-
async function installMSY2Tools() {
98+
async function installMSYS2Tools() {
9999
const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => {
100100
let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z`
101101
console.log(url)
@@ -111,6 +111,13 @@ async function installMSY2Tools() {
111111
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true }))
112112
}
113113

114+
// Windows JRuby can install gems that require compile tools, only needed for
115+
// windows-2022 image
116+
export async function installJRubyTools() {
117+
await installMSYS2Tools()
118+
await installGCCTools('mingw64')
119+
}
120+
114121
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
115122
const parentDir = path.dirname(rubyPrefix)
116123

0 commit comments

Comments
 (0)