Skip to content

Commit e9c1c1b

Browse files
MSP-Gregeregon
authored andcommitted
windows.js - add hasMSYS2PreInstalled constant
1 parent 24d6dee commit e9c1c1b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

windows.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export function getAvailableVersions(platform, engine) {
3535
export async function install(platform, engine, version) {
3636
const url = rubyInstallerVersions[version]
3737

38+
// The windows-2016 and windows-2019 images have MSYS2 build tools (C:/msys64/usr)
39+
// and MinGW build tools installed. The windows-2022 image has neither.
40+
const hasMSYS2PreInstalled = ['windows-2019', 'windows-2016'].includes(virtualEnv)
41+
3842
if (!url.endsWith('.7z')) {
3943
throw new Error(`URL should end in .7z: ${url}`)
4044
}
@@ -62,11 +66,13 @@ export async function install(platform, engine, version) {
6266

6367
// install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
6468

65-
if (!['windows-2019', 'windows-2016'].includes(virtualEnv)) {
69+
if (!hasMSYS2PreInstalled) {
6670
await installMSYS2Tools()
6771
}
6872

69-
if ((( winMSYS2Type === 'ucrt64') || !['windows-2019', 'windows-2016'].includes(virtualEnv)) &&
73+
// windows 2016 and 2019 need ucrt64 installed, 2022 and future images need
74+
// ucrt64 or mingw64 installed, depending on Ruby version
75+
if (((winMSYS2Type === 'ucrt64') || !hasMSYS2PreInstalled) &&
7076
(common.floatVersion(version) >= 2.4)) {
7177
await installGCCTools(winMSYS2Type)
7278
}
@@ -112,7 +118,7 @@ async function installMSYS2Tools() {
112118
}
113119

114120
// Windows JRuby can install gems that require compile tools, only needed for
115-
// windows-2022 image
121+
// windows-2022 and later images
116122
export async function installJRubyTools() {
117123
await installMSYS2Tools()
118124
await installGCCTools('mingw64')
@@ -127,6 +133,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
127133
})
128134

129135
await common.measure('Extracting Ruby', async () =>
136+
// -bd disable progress indicator, -xr extract but exclude share\doc files
130137
exec.exec('7z', ['x', downloadPath, '-bd', `-xr!${base}\\share\\doc`, `-o${parentDir}`], { silent: true }))
131138

132139
if (base !== path.basename(rubyPrefix)) {

0 commit comments

Comments
 (0)