From fa44df6503944d1eb3f4aa8fcf205a7b6806b191 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Fri, 18 Jun 2021 11:11:24 -0500 Subject: [PATCH 01/15] Add Windows MSYS2 ucrt and Windows-2022 support --- common.js | 14 +++++++++++++- windows.js | 44 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/common.js b/common.js index d505d0a0f..feb7e1554 100644 --- a/common.js +++ b/common.js @@ -155,7 +155,15 @@ export function win2nix(path) { return path.replace(/\\/g, '/').replace(/ /g, '\\ ') } +// JRuby is installed after setupPath is called, so folder doesn't exist +function rubyIsUCRT(path) { + return !!(fs.existsSync(path) && + fs.readdirSync(path, { withFileTypes: true }).find(dirent => + dirent.isFile() && dirent.name.match(/^x64-ucrt-ruby\d{3}\.dll$/))) +} + export function setupPath(newPathEntries) { + let win_build_sys = null const envPath = windows ? 'Path' : 'PATH' const originalPath = process.env[envPath].split(path.delimiter) let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry)) @@ -176,8 +184,11 @@ export function setupPath(newPathEntries) { // Then add new path entries using core.addPath() let newPath if (windows) { + // main Ruby dll determines whether mingw or ucrt build + win_build_sys = rubyIsUCRT(newPathEntries[0]) ? 'ucrt64' : 'mingw64' + // add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain - const msys2 = ['C:\\msys64\\mingw64\\bin', 'C:\\msys64\\usr\\bin'] + const msys2 = [`C:\\msys64\\${win_build_sys}\\bin`, 'C:\\msys64\\usr\\bin'] newPath = [...newPathEntries, ...msys2] } else { newPath = newPathEntries @@ -189,4 +200,5 @@ export function setupPath(newPathEntries) { core.endGroup() core.addPath(newPath.join(path.delimiter)) + return win_build_sys } diff --git a/windows.js b/windows.js index b987dc4cd..3b7d6b63c 100644 --- a/windows.js +++ b/windows.js @@ -50,15 +50,53 @@ export async function install(platform, engine, version) { let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version) - common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) - if (!inToolCache) { await downloadAndExtract(engine, version, url, base, rubyPrefix); } + const winMSYS2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) + + const virtualEnv = common.getVirtualEnvironmentName() + + if (( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) { + await installGCCTools(winMSYS2Type) + + if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { + await installMSY2Tools() + } + } + return rubyPrefix } +// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it, +// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled. +async function installGCCTools(type) { + const downloadPath = await common.measure(`Download ${type} build tools`, async () => { + let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/${type}.7z` + console.log(url) + return await tc.downloadTool(url) + }) + + await common.measure(`Extracting ${type} build tools`, async () => + // -aoa overwrite existing, -bd disable progress indicator + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) +} + +// Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it. +// A subset of the MSYS2 base-devel group +async function installMSY2Tools() { + const downloadPath = await common.measure(`Download msys2 build tools`, async () => { + let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z` + console.log(url) + return await tc.downloadTool(url) + }) + + await common.measure(`Extracting msys2 build tools`, async () => + // -aoa overwrite existing, -bd disable progress indicator + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) +} + async function downloadAndExtract(engine, version, url, base, rubyPrefix) { const parentDir = path.dirname(rubyPrefix) @@ -68,7 +106,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { }) await common.measure('Extracting Ruby', async () => - exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) + exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) if (base !== path.basename(rubyPrefix)) { await io.mv(path.join(parentDir, base), rubyPrefix) From bb9f88018125697e64fb3c1af97bb7bdcda3e40e Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 7 Oct 2021 15:04:58 -0500 Subject: [PATCH 02/15] Actions - Add Windows-2022 with ruby-head & ruby-mingw --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6bd2c9f02..e9420c69a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,8 @@ jobs: - { os: windows-2016, ruby: mingw } - { os: windows-2019, ruby: mingw } - { os: windows-2019, ruby: mswin } + - { os: windows-2022, ruby: mingw } + - { os: windows-2022, ruby: head } exclude: - { os: windows-2016, ruby: 1.9 } - { os: windows-2016, ruby: debug } From 0c610807aa75a4a15b9fcc3bd517a59aae7e1d66 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Fri, 8 Oct 2021 11:50:33 -0500 Subject: [PATCH 03/15] Use ridk enable to set MSYS2 ENV variables Co-authored-by: Lars Kanis --- windows.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/windows.js b/windows.js index 3b7d6b63c..c8333bcfc 100644 --- a/windows.js +++ b/windows.js @@ -66,6 +66,11 @@ export async function install(platform, engine, version) { } } + const ridk = `${rubyPrefix}\\bin\\ridk.cmd` + if (fs.existsSync(ridk)) { + await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk)) + } + return rubyPrefix } @@ -191,3 +196,25 @@ export function addVCVARSEnv() { } return newPathEntries } + +// Sets MSYS2 ENV variables set from running `ridk enable` +// +function addRidkEnv(ridk) { + let newEnv = new Map() + let cmd = `cmd.exe /c "${ridk} enable && set"` + let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/) + newSet = newSet.filter(line => /^\S+=\S+/.test(line)) + newSet.forEach(s => { + let [k,v] = common.partition(s, '=') + newEnv.set(k,v) + }) + + for (let [k, v] of newEnv) { + if (process.env[k] !== v) { + if (!/^Path$/i.test(k)) { + console.log(`${k}=${v}`) + core.exportVariable(k, v) + } + } + } +} From 907467ef288e5c7a6ce0e894629142de9165f8eb Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Sun, 14 Nov 2021 10:32:39 -0600 Subject: [PATCH 04/15] Add ruby-loco ucrt build --- .github/workflows/test.yml | 1 + common.js | 2 +- generate-windows-versions.rb | 1 + windows-versions.js | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e9420c69a..29a006b45 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: - { os: windows-2019, ruby: mingw } - { os: windows-2019, ruby: mswin } - { os: windows-2022, ruby: mingw } + - { os: windows-2022, ruby: ucrt } - { os: windows-2022, ruby: head } exclude: - { os: windows-2016, ruby: 1.9 } diff --git a/common.js b/common.js index feb7e1554..8520a0a86 100644 --- a/common.js +++ b/common.js @@ -48,7 +48,7 @@ export async function measure(name, block) { } export function isHeadVersion(rubyVersion) { - return rubyVersion === 'head' || rubyVersion === 'debug' || rubyVersion === 'mingw' || rubyVersion === 'mswin' + return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion) } export function isStableVersion(rubyVersion) { diff --git a/generate-windows-versions.rb b/generate-windows-versions.rb index d0b9cd245..3bafd1285 100644 --- a/generate-windows-versions.rb +++ b/generate-windows-versions.rb @@ -28,6 +28,7 @@ versions['head'] = 'https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z' versions['mingw'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z' versions['mswin'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z' +versions['ucrt'] = 'https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z' js = "export const versions = #{JSON.pretty_generate(versions)}\n" File.binwrite 'windows-versions.js', js diff --git a/windows-versions.js b/windows-versions.js index 7a746b675..d2011eaac 100644 --- a/windows-versions.js +++ b/windows-versions.js @@ -45,5 +45,6 @@ export const versions = { "3.1.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z", "head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z", "mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z", - "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z" + "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z", + "ucrt": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z" } From b82c1cbbcbe5a158ac6d8dbad5b8eab6b0635285 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Sat, 20 Nov 2021 11:02:33 -0600 Subject: [PATCH 05/15] log output - all 'ing', align --- ruby-builder.js | 2 +- windows.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ruby-builder.js b/ruby-builder.js index e8ee9a2f6..ed8dedbe6 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -79,7 +79,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { return await tc.downloadTool(url) }) - await common.measure('Extracting Ruby', async () => { + await common.measure('Extracting Ruby', async () => { if (windows) { // Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)]) diff --git a/windows.js b/windows.js index c8333bcfc..f078836bc 100644 --- a/windows.js +++ b/windows.js @@ -77,13 +77,13 @@ export async function install(platform, engine, version) { // Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it, // and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled. async function installGCCTools(type) { - const downloadPath = await common.measure(`Download ${type} build tools`, async () => { + const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => { let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/${type}.7z` console.log(url) return await tc.downloadTool(url) }) - await common.measure(`Extracting ${type} build tools`, async () => + await common.measure(`Extracting ${type} build tools`, async () => // -aoa overwrite existing, -bd disable progress indicator exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) } @@ -91,13 +91,13 @@ async function installGCCTools(type) { // Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it. // A subset of the MSYS2 base-devel group async function installMSY2Tools() { - const downloadPath = await common.measure(`Download msys2 build tools`, async () => { + const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => { let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z` console.log(url) return await tc.downloadTool(url) }) - await common.measure(`Extracting msys2 build tools`, async () => + await common.measure(`Extracting msys2 build tools`, async () => // -aoa overwrite existing, -bd disable progress indicator exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) } @@ -110,7 +110,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { return await tc.downloadTool(url) }) - await common.measure('Extracting Ruby', async () => + await common.measure('Extracting Ruby', async () => exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) if (base !== path.basename(rubyPrefix)) { From 926bb1c393499fda9fcc202e4a233bd22fd6e621 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Sun, 21 Nov 2021 13:15:14 -0600 Subject: [PATCH 06/15] Install MSYS2 tools before gcc tools, clear pacman database folder --- windows.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/windows.js b/windows.js index f078836bc..a0deb71ef 100644 --- a/windows.js +++ b/windows.js @@ -13,6 +13,8 @@ const rubyInstallerVersions = require('./windows-versions').versions const drive = common.drive +const msys2BasePath = 'C:\\msys64' + // needed for 2.0-2.3, and mswin, cert file used by Git for Windows const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' @@ -58,12 +60,12 @@ export async function install(platform, engine, version) { const virtualEnv = common.getVirtualEnvironmentName() + if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { + await installMSY2Tools() + } + if (( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) { await installGCCTools(winMSYS2Type) - - if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { - await installMSY2Tools() - } } const ridk = `${rubyPrefix}\\bin\\ridk.cmd` @@ -85,7 +87,7 @@ async function installGCCTools(type) { await common.measure(`Extracting ${type} build tools`, async () => // -aoa overwrite existing, -bd disable progress indicator - exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true })) } // Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it. @@ -97,9 +99,13 @@ async function installMSY2Tools() { return await tc.downloadTool(url) }) + // need to remove all directories, since they may indicate old packages are installed, + // otherwise, error of "error: duplicated database entry" + fs.rmdirSync(`${msys2BasePath}\\var\\lib\\pacman\\local`, { recursive: true, force: true }) + await common.measure(`Extracting msys2 build tools`, async () => // -aoa overwrite existing, -bd disable progress indicator - exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', '-oC:\\msys64'], { silent: true })) + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true })) } async function downloadAndExtract(engine, version, url, base, rubyPrefix) { From d12ddaef5de29b868a6919a861c65ff69a0a9156 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 22 Nov 2021 10:25:04 -0600 Subject: [PATCH 07/15] windows.js - update addVCVARSEnv to work with all windows images --- windows.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/windows.js b/windows.js index a0deb71ef..60e432e25 100644 --- a/windows.js +++ b/windows.js @@ -22,6 +22,8 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' const msys = `${drive}:\\DevKit64` const msysPathEntries = [`${msys}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys}\\mingw\\bin`, `${msys}\\bin`] +const virtualEnv = common.getVirtualEnvironmentName() + export function getAvailableVersions(platform, engine) { if (engine === 'ruby') { return Object.keys(rubyInstallerVersions) @@ -58,8 +60,6 @@ export async function install(platform, engine, version) { const winMSYS2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) - const virtualEnv = common.getVirtualEnvironmentName() - if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { await installMSY2Tools() } @@ -175,9 +175,22 @@ async function setupMSWin() { /* Sets MSVC environment for use in Actions * allows steps to run without running vcvars*.bat, also for PowerShell * adds a convenience VCVARS environment variable - * this assumes a single Visual Studio version being available in the windows-latest image */ + * this assumes a single Visual Studio version being available in the window images */ export function addVCVARSEnv() { - const vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + let vcVars = '' + switch (virtualEnv) { + case 'windows-2016': + vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + case 'windows-2019': + vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + case 'windows-2022': + vcVars = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + default: + throw new Error(`Unknown Windows Image: ${virtualEnv}`) + } core.exportVariable('VCVARS', vcVars) let newEnv = new Map() From c5b6e87280a133df60cb17695d6ded616f52c73d Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 22 Nov 2021 13:36:19 -0600 Subject: [PATCH 08/15] Only install mingw or ucrt for new Rubies --- windows.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/windows.js b/windows.js index 60e432e25..d8ee6bc13 100644 --- a/windows.js +++ b/windows.js @@ -60,11 +60,14 @@ export async function install(platform, engine, version) { const winMSYS2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) + // install msys2 tools for all versions, only install mingw or ucrt for Rubies >= 2.4 + if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { await installMSY2Tools() } - if (( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) { + if ((( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) && + (common.floatVersion(version) >= 2.4)) { await installGCCTools(winMSYS2Type) } From 87d31457c0c3ec3c31aadbe05675bb882f57e14e Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 22 Nov 2021 13:47:39 -0600 Subject: [PATCH 09/15] Actions - add windows-2022 jobs --- .github/workflows/test.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29a006b45..e47e95c65 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,15 +15,14 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019 ] + os: [ ubuntu-18.04, ubuntu-20.04, macos-10.15, macos-11.0, windows-2016, windows-2019, windows-2022 ] ruby: [ 1.9, '2.0', 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, ruby-head, jruby, jruby-head, truffleruby, truffleruby-head, truffleruby+graalvm, truffleruby+graalvm-head ] include: - { os: windows-2016, ruby: mingw } - { os: windows-2019, ruby: mingw } - { os: windows-2019, ruby: mswin } - { os: windows-2022, ruby: mingw } - - { os: windows-2022, ruby: ucrt } - - { os: windows-2022, ruby: head } + - { os: windows-2022, ruby: ucrt } exclude: - { os: windows-2016, ruby: 1.9 } - { os: windows-2016, ruby: debug } @@ -37,6 +36,12 @@ jobs: - { os: windows-2019, ruby: truffleruby-head } - { os: windows-2019, ruby: truffleruby+graalvm } - { os: windows-2019, ruby: truffleruby+graalvm-head } + - { os: windows-2022, ruby: 1.9 } + - { os: windows-2022, ruby: debug } + - { os: windows-2022, ruby: truffleruby } + - { os: windows-2022, ruby: truffleruby-head } + - { os: windows-2022, ruby: truffleruby+graalvm } + - { os: windows-2022, ruby: truffleruby+graalvm-head } name: ${{ matrix.os }} ${{ matrix.ruby }} runs-on: ${{ matrix.os }} From 54611f8dcf85797c7aa19b1b0a3cda839ae50a36 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 23 Nov 2021 03:11:29 -0600 Subject: [PATCH 10/15] Windows - Rename 3rd party OpenSSL SYSTEM32 dll's --- windows.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/windows.js b/windows.js index d8ee6bc13..162a6ab3a 100644 --- a/windows.js +++ b/windows.js @@ -134,6 +134,11 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { async function setupMingw(version) { core.exportVariable('MAKE', 'make.exe') + // rename these to avoid confusion when Ruby is using OpenSSL 1.0.2 + // most current extconf files look for 1.1.x dll files first, which is the + // version of the renamed files + if (common.floatVersion(version) <= 2.4) { renameSystem32Dlls() } + if (common.floatVersion(version) <= 2.3) { core.exportVariable('SSL_CERT_FILE', certFile) await common.measure('Installing MSYS', async () => installMSYS(version)) @@ -219,6 +224,17 @@ export function addVCVARSEnv() { return newPathEntries } +// ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from +// build folder due to dll resolution +function renameSystem32Dlls() { + const sys32 = 'C:\\Windows\\System32\\' + const badFiles = ['libcrypto-1_1-x64.dll', 'libssl-1_1-x64.dll'] + badFiles.forEach( (bad) => { + let fn = `${sys32}${bad}` + if (fs.existsSync(fn)) { fs.renameSync(fn, `${fn}_`) } + }) +} + // Sets MSYS2 ENV variables set from running `ridk enable` // function addRidkEnv(ridk) { From 5b4cbc3a439aad6aea5fb00491e1ed8937ad63f2 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 3 Jan 2022 08:12:50 -0600 Subject: [PATCH 11/15] windows.js - suggested changes --- windows.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows.js b/windows.js index 162a6ab3a..608500d34 100644 --- a/windows.js +++ b/windows.js @@ -60,7 +60,7 @@ export async function install(platform, engine, version) { const winMSYS2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) - // install msys2 tools for all versions, only install mingw or ucrt for Rubies >= 2.4 + // install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4 if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { await installMSY2Tools() @@ -183,7 +183,7 @@ async function setupMSWin() { /* Sets MSVC environment for use in Actions * allows steps to run without running vcvars*.bat, also for PowerShell * adds a convenience VCVARS environment variable - * this assumes a single Visual Studio version being available in the window images */ + * this assumes a single Visual Studio version being available in the Windows images */ export function addVCVARSEnv() { let vcVars = '' switch (virtualEnv) { From 85380a5fac11dc410b3ae96b45e9f3b48f0ea3fe Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 3 Jan 2022 12:20:27 -0600 Subject: [PATCH 12/15] Windows JRuby - install MinGW tools, typo --- index.js | 7 +++++++ windows.js | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 7a1b0c8b5..a94fa3c58 100644 --- a/index.js +++ b/index.js @@ -51,6 +51,13 @@ export async function setupRuby(options = {}) { createGemRC(engine, version) envPreInstall() + // JRuby can use compiled extension code, so make sure gcc exists. + // As of Jan-2022, JRuby compiles against msvcrt. + if (platform.startsWith('windows') && (engine === 'jruby') && + !fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) { + await require('./windows').installJRubyTools() + } + const rubyPrefix = await installer.install(platform, engine, version) // When setup-ruby is used by other actions, this allows code in them to run diff --git a/windows.js b/windows.js index 608500d34..d65266998 100644 --- a/windows.js +++ b/windows.js @@ -63,7 +63,7 @@ export async function install(platform, engine, version) { // install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4 if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { - await installMSY2Tools() + await installMSYS2Tools() } if ((( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) && @@ -95,7 +95,7 @@ async function installGCCTools(type) { // Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it. // A subset of the MSYS2 base-devel group -async function installMSY2Tools() { +async function installMSYS2Tools() { const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => { let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z` console.log(url) @@ -111,6 +111,13 @@ async function installMSY2Tools() { exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true })) } +// Windows JRuby can install gems that require compile tools, only needed for +// windows-2022 image +export async function installJRubyTools() { + await installMSYS2Tools() + await installGCCTools('mingw64') +} + async function downloadAndExtract(engine, version, url, base, rubyPrefix) { const parentDir = path.dirname(rubyPrefix) From d5ff411ecc529f6f88d7218e78f3063bd6c77fd2 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 11 Jan 2022 13:09:23 -0600 Subject: [PATCH 13/15] windows.js - add hasMSYS2PreInstalled constant --- windows.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/windows.js b/windows.js index d65266998..abbc41bdf 100644 --- a/windows.js +++ b/windows.js @@ -35,6 +35,10 @@ export function getAvailableVersions(platform, engine) { export async function install(platform, engine, version) { const url = rubyInstallerVersions[version] + // The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr) + // and MinGW build tools installed. The windows-2022 image has neither. + const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv) + if (!url.endsWith('.7z')) { throw new Error(`URL should end in .7z: ${url}`) } @@ -62,11 +66,13 @@ export async function install(platform, engine, version) { // install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4 - if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) { + if (!hasMSYS2PreInstalled) { await installMSYS2Tools() } - if ((( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) && + // windows 2016 and 2019 need ucrt64 installed, 2022 and future images need + // ucrt64 or mingw64 installed, depending on Ruby version + if (((winMSYS2Type === 'ucrt64') || !hasMSYS2PreInstalled) && (common.floatVersion(version) >= 2.4)) { await installGCCTools(winMSYS2Type) } @@ -112,7 +118,7 @@ async function installMSYS2Tools() { } // Windows JRuby can install gems that require compile tools, only needed for -// windows-2022 image +// windows-2022 and later images export async function installJRubyTools() { await installMSYS2Tools() await installGCCTools('mingw64') @@ -127,6 +133,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { }) await common.measure('Extracting Ruby', async () => + // -bd disable progress indicator, -xr extract but exclude share\doc files exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) if (base !== path.basename(rubyPrefix)) { From 415b1507d7a846e219220661e58c613661619eea Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Tue, 11 Jan 2022 15:46:59 -0600 Subject: [PATCH 14/15] package.json & yarn.lock - @vercel/ncc: 0.28.6 -> 0.31.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 67fc84753..915464c23 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,6 @@ "@actions/tool-cache": "^1.7.1" }, "devDependencies": { - "@vercel/ncc": "^0.28.6" + "@vercel/ncc": "^0.31.1" } } diff --git a/yarn.lock b/yarn.lock index e973aa19f..6a777f68b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -195,10 +195,10 @@ dependencies: "@types/node" "*" -"@vercel/ncc@^0.28.6": - version "0.28.6" - resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.28.6.tgz#073c0ce8e0269210c0a9f180fb0bf949eecc20e0" - integrity sha512-t4BoSSuyK8BZaUE0gV18V6bkFs4st7baumtFGa50dv1tMu2GDBEBF8sUZaKBdKiL6DzJ2D2+XVCwYWWDcQOYdQ== +"@vercel/ncc@^0.31.1": + version "0.31.1" + resolved "https://registry.yarnpkg.com/@vercel/ncc/-/ncc-0.31.1.tgz#9346c7e59326f5eeac75c0286e47df94c2d6d8f7" + integrity sha512-g0FAxwdViI6UzsiVz5HssIHqjcPa1EHL6h+2dcJD893SoCJaGdqqgUF09xnMW6goWnnhbLvgiKlgJWrJa+7qYA== abort-controller@^3.0.0: version "3.0.0" From 11cc84264a91d42bc873f39d70678e44042322d2 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 13 Jan 2022 12:09:35 -0600 Subject: [PATCH 15/15] yarn run package --- dist/index.js | 202 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 171 insertions(+), 31 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5b11c2c4c..2aa50e835 100644 --- a/dist/index.js +++ b/dist/index.js @@ -296,7 +296,7 @@ async function measure(name, block) { } function isHeadVersion(rubyVersion) { - return rubyVersion === 'head' || rubyVersion === 'debug' || rubyVersion === 'mingw' || rubyVersion === 'mswin' + return ['head', 'debug', 'mingw', 'mswin', 'ucrt'].includes(rubyVersion) } function isStableVersion(rubyVersion) { @@ -403,7 +403,15 @@ function win2nix(path) { return path.replace(/\\/g, '/').replace(/ /g, '\\ ') } +// JRuby is installed after setupPath is called, so folder doesn't exist +function rubyIsUCRT(path) { + return !!(fs.existsSync(path) && + fs.readdirSync(path, { withFileTypes: true }).find(dirent => + dirent.isFile() && dirent.name.match(/^x64-ucrt-ruby\d{3}\.dll$/))) +} + function setupPath(newPathEntries) { + let win_build_sys = null const envPath = windows ? 'Path' : 'PATH' const originalPath = process.env[envPath].split(path.delimiter) let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry)) @@ -424,8 +432,11 @@ function setupPath(newPathEntries) { // Then add new path entries using core.addPath() let newPath if (windows) { + // main Ruby dll determines whether mingw or ucrt build + win_build_sys = rubyIsUCRT(newPathEntries[0]) ? 'ucrt64' : 'mingw64' + // add MSYS2 in path for all Rubies on Windows, as it provides a better bash shell and a native toolchain - const msys2 = ['C:\\msys64\\mingw64\\bin', 'C:\\msys64\\usr\\bin'] + const msys2 = [`C:\\msys64\\${win_build_sys}\\bin`, 'C:\\msys64\\usr\\bin'] newPath = [...newPathEntries, ...msys2] } else { newPath = newPathEntries @@ -437,6 +448,7 @@ function setupPath(newPathEntries) { core.endGroup() core.addPath(newPath.join(path.delimiter)) + return win_build_sys } @@ -58907,7 +58919,7 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { return await tc.downloadTool(url) }) - await common.measure('Extracting Ruby', async () => { + await common.measure('Extracting Ruby', async () => { if (windows) { // Windows 2016 doesn't have system tar, use MSYS2's, it needs unix style paths await exec.exec('tar', ['-xz', '-C', common.win2nix(parentDir), '-f', common.win2nix(downloadPath)]) @@ -58997,7 +59009,8 @@ const versions = { "3.1.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.0-1/rubyinstaller-3.1.0-1-x64.7z", "head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z", "mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z", - "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z" + "mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z", + "ucrt": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-ucrt.7z" } @@ -59011,6 +59024,7 @@ __nccwpck_require__.r(__webpack_exports__); /* harmony export */ __nccwpck_require__.d(__webpack_exports__, { /* harmony export */ "getAvailableVersions": () => (/* binding */ getAvailableVersions), /* harmony export */ "install": () => (/* binding */ install), +/* harmony export */ "installJRubyTools": () => (/* binding */ installJRubyTools), /* harmony export */ "addVCVARSEnv": () => (/* binding */ addVCVARSEnv) /* harmony export */ }); // Most of this logic is from @@ -59028,6 +59042,8 @@ const rubyInstallerVersions = __nccwpck_require__(7223)/* .versions */ .d const drive = common.drive +const msys2BasePath = 'C:\\msys64' + // needed for 2.0-2.3, and mswin, cert file used by Git for Windows const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' @@ -59035,6 +59051,8 @@ const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem' const msys = `${drive}:\\DevKit64` const msysPathEntries = [`${msys}\\mingw\\x86_64-w64-mingw32\\bin`, `${msys}\\mingw\\bin`, `${msys}\\bin`] +const virtualEnv = common.getVirtualEnvironmentName() + function getAvailableVersions(platform, engine) { if (engine === 'ruby') { return Object.keys(rubyInstallerVersions) @@ -59046,6 +59064,10 @@ function getAvailableVersions(platform, engine) { async function install(platform, engine, version) { const url = rubyInstallerVersions[version] + // The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr) + // and MinGW build tools installed. The windows-2022 image has neither. + const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv) + if (!url.endsWith('.7z')) { throw new Error(`URL should end in .7z: ${url}`) } @@ -59065,15 +59087,72 @@ async function install(platform, engine, version) { let toolchainPaths = (version === 'mswin') ? await setupMSWin() : await setupMingw(version) - common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) - if (!inToolCache) { await downloadAndExtract(engine, version, url, base, rubyPrefix); } + const winMSYS2Type = common.setupPath([`${rubyPrefix}\\bin`, ...toolchainPaths]) + + // install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4 + + if (!hasMSYS2PreInstalled) { + await installMSYS2Tools() + } + + // windows 2016 and 2019 need ucrt64 installed, 2022 and future images need + // ucrt64 or mingw64 installed, depending on Ruby version + if (((winMSYS2Type === 'ucrt64') || !hasMSYS2PreInstalled) && + (common.floatVersion(version) >= 2.4)) { + await installGCCTools(winMSYS2Type) + } + + const ridk = `${rubyPrefix}\\bin\\ridk.cmd` + if (fs.existsSync(ridk)) { + await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk)) + } + return rubyPrefix } +// Actions windows-2022 image does not contain any mingw or ucrt build tools. Install tools for it, +// and also install ucrt tools on earlier versions, which have msys2 and mingw tools preinstalled. +async function installGCCTools(type) { + const downloadPath = await common.measure(`Downloading ${type} build tools`, async () => { + let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/${type}.7z` + console.log(url) + return await tc.downloadTool(url) + }) + + await common.measure(`Extracting ${type} build tools`, async () => + // -aoa overwrite existing, -bd disable progress indicator + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true })) +} + +// Actions windows-2022 image does not contain any MSYS2 build tools. Install tools for it. +// A subset of the MSYS2 base-devel group +async function installMSYS2Tools() { + const downloadPath = await common.measure(`Downloading msys2 build tools`, async () => { + let url = `https://github.com/MSP-Greg/setup-msys2-gcc/releases/download/msys2-gcc-pkgs/msys2.7z` + console.log(url) + return await tc.downloadTool(url) + }) + + // need to remove all directories, since they may indicate old packages are installed, + // otherwise, error of "error: duplicated database entry" + fs.rmdirSync(`${msys2BasePath}\\var\\lib\\pacman\\local`, { recursive: true, force: true }) + + await common.measure(`Extracting msys2 build tools`, async () => + // -aoa overwrite existing, -bd disable progress indicator + exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${msys2BasePath}`], { silent: true })) +} + +// Windows JRuby can install gems that require compile tools, only needed for +// windows-2022 and later images +async function installJRubyTools() { + await installMSYS2Tools() + await installGCCTools('mingw64') +} + async function downloadAndExtract(engine, version, url, base, rubyPrefix) { const parentDir = path.dirname(rubyPrefix) @@ -59082,8 +59161,9 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { return await tc.downloadTool(url) }) - await common.measure('Extracting Ruby', async () => - exec.exec('7z', ['x', downloadPath, `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) + await common.measure('Extracting Ruby', async () => + // -bd disable progress indicator, -xr extract but exclude share\doc files + exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true })) if (base !== path.basename(rubyPrefix)) { await io.mv(path.join(parentDir, base), rubyPrefix) @@ -59097,6 +59177,11 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) { async function setupMingw(version) { core.exportVariable('MAKE', 'make.exe') + // rename these to avoid confusion when Ruby is using OpenSSL 1.0.2 + // most current extconf files look for 1.1.x dll files first, which is the + // version of the renamed files + if (common.floatVersion(version) <= 2.4) { renameSystem32Dlls() } + if (common.floatVersion(version) <= 2.3) { core.exportVariable('SSL_CERT_FILE', certFile) await common.measure('Installing MSYS', async () => installMSYS(version)) @@ -59141,9 +59226,22 @@ async function setupMSWin() { /* Sets MSVC environment for use in Actions * allows steps to run without running vcvars*.bat, also for PowerShell * adds a convenience VCVARS environment variable - * this assumes a single Visual Studio version being available in the windows-latest image */ + * this assumes a single Visual Studio version being available in the Windows images */ function addVCVARSEnv() { - const vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + let vcVars = '' + switch (virtualEnv) { + case 'windows-2016': + vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + case 'windows-2019': + vcVars = '"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + case 'windows-2022': + vcVars = '"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"' + break + default: + throw new Error(`Unknown Windows Image: ${virtualEnv}`) + } core.exportVariable('VCVARS', vcVars) let newEnv = new Map() @@ -59169,6 +59267,39 @@ function addVCVARSEnv() { return newPathEntries } +// ssl files cause issues with non RI2 Rubies (<2.4) and ruby/ruby's CI from +// build folder due to dll resolution +function renameSystem32Dlls() { + const sys32 = 'C:\\Windows\\System32\\' + const badFiles = ['libcrypto-1_1-x64.dll', 'libssl-1_1-x64.dll'] + badFiles.forEach( (bad) => { + let fn = `${sys32}${bad}` + if (fs.existsSync(fn)) { fs.renameSync(fn, `${fn}_`) } + }) +} + +// Sets MSYS2 ENV variables set from running `ridk enable` +// +function addRidkEnv(ridk) { + let newEnv = new Map() + let cmd = `cmd.exe /c "${ridk} enable && set"` + let newSet = cp.execSync(cmd).toString().trim().split(/\r?\n/) + newSet = newSet.filter(line => /^\S+=\S+/.test(line)) + newSet.forEach(s => { + let [k,v] = common.partition(s, '=') + newEnv.set(k,v) + }) + + for (let [k, v] of newEnv) { + if (process.env[k] !== v) { + if (!/^Path$/i.test(k)) { + console.log(`${k}=${v}`) + core.exportVariable(k, v) + } + } + } +} + /***/ }), @@ -59200,7 +59331,7 @@ module.exports = JSON.parse('["ac","com.ac","edu.ac","gov.ac","net.ac","mil.ac", /***/ ((module) => { "use strict"; -module.exports = require("assert");; +module.exports = require("assert"); /***/ }), @@ -59208,7 +59339,7 @@ module.exports = require("assert");; /***/ ((module) => { "use strict"; -module.exports = require("buffer");; +module.exports = require("buffer"); /***/ }), @@ -59216,7 +59347,7 @@ module.exports = require("buffer");; /***/ ((module) => { "use strict"; -module.exports = require("child_process");; +module.exports = require("child_process"); /***/ }), @@ -59224,7 +59355,7 @@ module.exports = require("child_process");; /***/ ((module) => { "use strict"; -module.exports = require("crypto");; +module.exports = require("crypto"); /***/ }), @@ -59232,7 +59363,7 @@ module.exports = require("crypto");; /***/ ((module) => { "use strict"; -module.exports = require("events");; +module.exports = require("events"); /***/ }), @@ -59240,7 +59371,7 @@ module.exports = require("events");; /***/ ((module) => { "use strict"; -module.exports = require("fs");; +module.exports = require("fs"); /***/ }), @@ -59248,7 +59379,7 @@ module.exports = require("fs");; /***/ ((module) => { "use strict"; -module.exports = require("http");; +module.exports = require("http"); /***/ }), @@ -59256,7 +59387,7 @@ module.exports = require("http");; /***/ ((module) => { "use strict"; -module.exports = require("https");; +module.exports = require("https"); /***/ }), @@ -59264,7 +59395,7 @@ module.exports = require("https");; /***/ ((module) => { "use strict"; -module.exports = require("net");; +module.exports = require("net"); /***/ }), @@ -59272,7 +59403,7 @@ module.exports = require("net");; /***/ ((module) => { "use strict"; -module.exports = require("os");; +module.exports = require("os"); /***/ }), @@ -59280,7 +59411,7 @@ module.exports = require("os");; /***/ ((module) => { "use strict"; -module.exports = require("path");; +module.exports = require("path"); /***/ }), @@ -59288,7 +59419,7 @@ module.exports = require("path");; /***/ ((module) => { "use strict"; -module.exports = require("perf_hooks");; +module.exports = require("perf_hooks"); /***/ }), @@ -59296,7 +59427,7 @@ module.exports = require("perf_hooks");; /***/ ((module) => { "use strict"; -module.exports = require("punycode");; +module.exports = require("punycode"); /***/ }), @@ -59304,7 +59435,7 @@ module.exports = require("punycode");; /***/ ((module) => { "use strict"; -module.exports = require("stream");; +module.exports = require("stream"); /***/ }), @@ -59312,7 +59443,7 @@ module.exports = require("stream");; /***/ ((module) => { "use strict"; -module.exports = require("string_decoder");; +module.exports = require("string_decoder"); /***/ }), @@ -59320,7 +59451,7 @@ module.exports = require("string_decoder");; /***/ ((module) => { "use strict"; -module.exports = require("timers");; +module.exports = require("timers"); /***/ }), @@ -59328,7 +59459,7 @@ module.exports = require("timers");; /***/ ((module) => { "use strict"; -module.exports = require("tls");; +module.exports = require("tls"); /***/ }), @@ -59336,7 +59467,7 @@ module.exports = require("tls");; /***/ ((module) => { "use strict"; -module.exports = require("url");; +module.exports = require("url"); /***/ }), @@ -59344,7 +59475,7 @@ module.exports = require("url");; /***/ ((module) => { "use strict"; -module.exports = require("util");; +module.exports = require("util"); /***/ }), @@ -59352,7 +59483,7 @@ module.exports = require("util");; /***/ ((module) => { "use strict"; -module.exports = require("zlib");; +module.exports = require("zlib"); /***/ }) @@ -59419,7 +59550,9 @@ module.exports = require("zlib");; /******/ /******/ /* webpack/runtime/compat */ /******/ -/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/ +/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; +/******/ +/************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be in strict mode. (() => { @@ -59482,6 +59615,13 @@ async function setupRuby(options = {}) { createGemRC(engine, version) envPreInstall() + // JRuby can use compiled extension code, so make sure gcc exists. + // As of Jan-2022, JRuby compiles against msvcrt. + if (platform.startsWith('windows') && (engine === 'jruby') && + !fs.existsSync('C:\\msys64\\mingw64\\bin\\gcc.exe')) { + await __nccwpck_require__(3216).installJRubyTools() + } + const rubyPrefix = await installer.install(platform, engine, version) // When setup-ruby is used by other actions, this allows code in them to run