mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Windows mswin - install vcpkg archive with required Ruby packages, cert
This commit is contained in:
+34
-10
@@ -65028,8 +65028,8 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ "installJRubyTools": () => (/* binding */ installJRubyTools),
|
||||
/* harmony export */ "addVCVARSEnv": () => (/* binding */ addVCVARSEnv)
|
||||
/* harmony export */ });
|
||||
// Most of this logic is from
|
||||
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
||||
// 7z arguments
|
||||
// -aoa overwrite existing, -bd disable progress indicator
|
||||
|
||||
const fs = __nccwpck_require__(7147)
|
||||
const path = __nccwpck_require__(1017)
|
||||
@@ -65043,9 +65043,11 @@ const rubyInstallerVersions = __nccwpck_require__(6459)
|
||||
|
||||
const drive = common.drive
|
||||
|
||||
const msys2BasePath = 'C:\\msys64'
|
||||
const msys2GCCReleaseURI = 'https://github.com/ruby/setup-msys2-gcc/releases/download'
|
||||
|
||||
const msys2BasePath = process.env['GHCUP_MSYS2']
|
||||
const vcPkgBasePath = process.env['VCPKG_INSTALLATION_ROOT']
|
||||
|
||||
// needed for Ruby 2.0-2.3, and mswin, cert file used by Git for Windows
|
||||
const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
||||
|
||||
@@ -65111,6 +65113,8 @@ async function install(platform, engine, version) {
|
||||
await installGCCTools(msys2Type)
|
||||
}
|
||||
|
||||
if (version === 'mswin') { await installVCPkg() }
|
||||
|
||||
const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
|
||||
if (fs.existsSync(ridk)) {
|
||||
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
|
||||
@@ -65129,7 +65133,6 @@ 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', `-o${msys2BasePath}`], { silent: true }))
|
||||
}
|
||||
|
||||
@@ -65147,7 +65150,6 @@ async function installMSYS2Tools() {
|
||||
fs.rmSync(`${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 }))
|
||||
}
|
||||
|
||||
@@ -65158,6 +65160,18 @@ async function installJRubyTools() {
|
||||
await installGCCTools('mingw64')
|
||||
}
|
||||
|
||||
// Install vcpkg files needed to build mswin Ruby
|
||||
async function installVCPkg() {
|
||||
const downloadPath = await common.measure(`Downloading mswin vcpkg packages`, async () => {
|
||||
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/mswin.7z`
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
})
|
||||
|
||||
await common.measure(`Extracting mswin vcpkg packages`, async () =>
|
||||
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${vcPkgBasePath}`], { silent: true }))
|
||||
}
|
||||
|
||||
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
const parentDir = path.dirname(rubyPrefix)
|
||||
|
||||
@@ -65167,7 +65181,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
|
||||
// -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)) {
|
||||
@@ -65214,18 +65228,28 @@ async function installMSYS1(version) {
|
||||
async function setupMSWin() {
|
||||
core.exportVariable('MAKE', 'nmake.exe')
|
||||
|
||||
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
||||
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||
// Pre-installed OpenSSL use C:\Program Files\Common Files\SSL
|
||||
let certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||
if (!fs.existsSync(certsDir)) {
|
||||
fs.mkdirSync(certsDir)
|
||||
fs.mkdirSync(certsDir, { recursive: true })
|
||||
}
|
||||
|
||||
// cert.pem location is hard-coded by OpenSSL msvc builds
|
||||
const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
|
||||
let cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
|
||||
if (!fs.existsSync(cert)) {
|
||||
fs.copyFileSync(certFile, cert)
|
||||
}
|
||||
|
||||
// vcpkg openssl uses packages\openssl_x64-windows\certs
|
||||
certsDir = `${vcPkgBasePath}\\packages\\openssl_x64-windows\\certs`
|
||||
if (!fs.existsSync(certsDir)) {
|
||||
fs.mkdirSync(certsDir, { recursive: true })
|
||||
}
|
||||
|
||||
// vcpkg openssl uses packages\openssl_x64-windows\cert.pem
|
||||
cert = `${vcPkgBasePath}\\packages\\openssl_x64-windows\\cert.pem`
|
||||
fs.copyFileSync(certFile, cert)
|
||||
|
||||
return await common.measure('Setting up MSVC environment', async () => addVCVARSEnv())
|
||||
}
|
||||
|
||||
|
||||
+34
-10
@@ -1,5 +1,5 @@
|
||||
// Most of this logic is from
|
||||
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
|
||||
// 7z arguments
|
||||
// -aoa overwrite existing, -bd disable progress indicator
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
@@ -13,9 +13,11 @@ const rubyInstallerVersions = require('./windows-versions.json')
|
||||
|
||||
const drive = common.drive
|
||||
|
||||
const msys2BasePath = 'C:\\msys64'
|
||||
const msys2GCCReleaseURI = 'https://github.com/ruby/setup-msys2-gcc/releases/download'
|
||||
|
||||
const msys2BasePath = process.env['GHCUP_MSYS2']
|
||||
const vcPkgBasePath = process.env['VCPKG_INSTALLATION_ROOT']
|
||||
|
||||
// needed for Ruby 2.0-2.3, and mswin, cert file used by Git for Windows
|
||||
const certFile = 'C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem'
|
||||
|
||||
@@ -81,6 +83,8 @@ export async function install(platform, engine, version) {
|
||||
await installGCCTools(msys2Type)
|
||||
}
|
||||
|
||||
if (version === 'mswin') { await installVCPkg() }
|
||||
|
||||
const ridk = `${rubyPrefix}\\bin\\ridk.cmd`
|
||||
if (fs.existsSync(ridk)) {
|
||||
await common.measure('Adding ridk env variables', async () => addRidkEnv(ridk))
|
||||
@@ -99,7 +103,6 @@ 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', `-o${msys2BasePath}`], { silent: true }))
|
||||
}
|
||||
|
||||
@@ -117,7 +120,6 @@ async function installMSYS2Tools() {
|
||||
fs.rmSync(`${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 }))
|
||||
}
|
||||
|
||||
@@ -128,6 +130,18 @@ export async function installJRubyTools() {
|
||||
await installGCCTools('mingw64')
|
||||
}
|
||||
|
||||
// Install vcpkg files needed to build mswin Ruby
|
||||
async function installVCPkg() {
|
||||
const downloadPath = await common.measure(`Downloading mswin vcpkg packages`, async () => {
|
||||
let url = `${msys2GCCReleaseURI}/msys2-gcc-pkgs/mswin.7z`
|
||||
console.log(url)
|
||||
return await tc.downloadTool(url)
|
||||
})
|
||||
|
||||
await common.measure(`Extracting mswin vcpkg packages`, async () =>
|
||||
exec.exec('7z', ['x', downloadPath, '-aoa', '-bd', `-o${vcPkgBasePath}`], { silent: true }))
|
||||
}
|
||||
|
||||
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
|
||||
const parentDir = path.dirname(rubyPrefix)
|
||||
|
||||
@@ -137,7 +151,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
|
||||
// -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)) {
|
||||
@@ -184,18 +198,28 @@ async function installMSYS1(version) {
|
||||
async function setupMSWin() {
|
||||
core.exportVariable('MAKE', 'nmake.exe')
|
||||
|
||||
// All standard MSVC OpenSSL builds use C:\Program Files\Common Files\SSL
|
||||
const certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||
// Pre-installed OpenSSL use C:\Program Files\Common Files\SSL
|
||||
let certsDir = 'C:\\Program Files\\Common Files\\SSL\\certs'
|
||||
if (!fs.existsSync(certsDir)) {
|
||||
fs.mkdirSync(certsDir)
|
||||
fs.mkdirSync(certsDir, { recursive: true })
|
||||
}
|
||||
|
||||
// cert.pem location is hard-coded by OpenSSL msvc builds
|
||||
const cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
|
||||
let cert = 'C:\\Program Files\\Common Files\\SSL\\cert.pem'
|
||||
if (!fs.existsSync(cert)) {
|
||||
fs.copyFileSync(certFile, cert)
|
||||
}
|
||||
|
||||
// vcpkg openssl uses packages\openssl_x64-windows\certs
|
||||
certsDir = `${vcPkgBasePath}\\packages\\openssl_x64-windows\\certs`
|
||||
if (!fs.existsSync(certsDir)) {
|
||||
fs.mkdirSync(certsDir, { recursive: true })
|
||||
}
|
||||
|
||||
// vcpkg openssl uses packages\openssl_x64-windows\cert.pem
|
||||
cert = `${vcPkgBasePath}\\packages\\openssl_x64-windows\\cert.pem`
|
||||
fs.copyFileSync(certFile, cert)
|
||||
|
||||
return await common.measure('Setting up MSVC environment', async () => addVCVARSEnv())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user