@@ -35,6 +35,10 @@ export function getAvailableVersions(platform, engine) {
35
35
export async function install ( platform , engine , version ) {
36
36
const url = rubyInstallerVersions [ version ]
37
37
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
+
38
42
if ( ! url . endsWith ( '.7z' ) ) {
39
43
throw new Error ( `URL should end in .7z: ${ url } ` )
40
44
}
@@ -62,11 +66,13 @@ export async function install(platform, engine, version) {
62
66
63
67
// install msys2 tools for all Ruby versions, only install mingw or ucrt for Rubies >= 2.4
64
68
65
- if ( ! [ 'windows-2019' , 'windows-2016' ] . includes ( virtualEnv ) ) {
69
+ if ( ! hasMSYS2PreInstalled ) {
66
70
await installMSYS2Tools ( )
67
71
}
68
72
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 ) &&
70
76
( common . floatVersion ( version ) >= 2.4 ) ) {
71
77
await installGCCTools ( winMSYS2Type )
72
78
}
@@ -112,7 +118,7 @@ async function installMSYS2Tools() {
112
118
}
113
119
114
120
// Windows JRuby can install gems that require compile tools, only needed for
115
- // windows-2022 image
121
+ // windows-2022 and later images
116
122
export async function installJRubyTools ( ) {
117
123
await installMSYS2Tools ( )
118
124
await installGCCTools ( 'mingw64' )
@@ -127,6 +133,7 @@ async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
127
133
} )
128
134
129
135
await common . measure ( 'Extracting Ruby' , async ( ) =>
136
+ // -bd disable progress indicator, -xr extract but exclude share\doc files
130
137
exec . exec ( '7z' , [ 'x' , downloadPath , '-bd' , `-xr!${ base } \\share\\doc` , `-o${ parentDir } ` ] , { silent : true } ) )
131
138
132
139
if ( base !== path . basename ( rubyPrefix ) ) {
0 commit comments