From 52e66840de48b175051af9aac3cd99bf774b8403 Mon Sep 17 00:00:00 2001 From: ilammy Date: Thu, 19 Mar 2020 09:03:19 +0200 Subject: [PATCH 1/3] Prepare for next release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4ceecd..f110a2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "msvc-dev-cmd", - "version": "1.0.0", + "version": "1.1.1", "description": "GitHub Action to setup Developer Command Prompt for Microsoft Visual C++", "main": "index.js", "scripts": { From ef0a58bd96f1d434b0d04513541ce8df01fc1b90 Mon Sep 17 00:00:00 2001 From: Nicolas Jarnoux Date: Sun, 26 Apr 2020 21:54:04 +0100 Subject: [PATCH 2/3] Enable other editions of msvc (#4) I'll probably use self hosted runners in a project and the Community version of Visual Studio will be installed on those. This enables the script to check for Community and Professional editions in addition to the Entreprise one offered by GitHub. The modification generates a kinda search map ordered by version then by edition. It generates the batch script that runs vcvarsall.bat on the fly given that search map. --- index.js | 63 +++++++++++++++++++++++++++++++++-------------- package-lock.json | 2 +- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/index.js b/index.js index 9c08809..40a070e 100644 --- a/index.js +++ b/index.js @@ -5,8 +5,8 @@ const os = require('os') const path = require('path') const process = require('process') -const MSVS_2017 = '%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\VC\\Auxiliary\\Build' -const MSVS_2019 = '%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Auxiliary\\Build' +const EDITIONS = ['Enterprise', 'Professional', 'Community'] +const VERSIONS = ['2019', '2017'] const InterestingVariables = [ 'INCLUDE', @@ -26,6 +26,26 @@ async function main() { return } + // this should generate an array like + // [ + // ['P2017', 'path\to\2017\Professional...'], + // ['C2017', 'path\to\2017\Entreprise...'], + // etc... + // [ + // Given the order of each list it should check + // for the more recent versions first and the + // highest grade edition first. + var search_map = [] + + VERSIONS.forEach(ver => { + EDITIONS.forEach(ed => { + let label = ed.charAt(0) + ver + let path = `%ProgramFiles(x86)%\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat` + + search_map.push([label, path]) + }) + }) + const arch = core.getInput('arch') const sdk = core.getInput('sdk') const toolset = core.getInput('toolset') @@ -53,22 +73,29 @@ async function main() { } core.debug(`Arguments: ${args.join(' ')}`) + var script = ''; + + search_map.forEach(pair => { + script += `@IF EXIST "${pair[1]}" GOTO :${pair[0]}\n` + }) + + script += `@ECHO "Microsoft Visual Studio not found"\n + @EXIT 1\n` + + search_map.forEach(pair => { + script += `:${pair[0]}\n + @CALL "${pair[1]}" ${args.join(' ')}\n + @GOTO ENV\n` + }) + + script += `:ENV\n + @IF ERRORLEVEL 1 EXIT\n + @SET` + + core.debug(script) + core.debug(`Writing helper file: ${helper}`) - await fs.writeFile(helper, ` - @IF EXIST "${MSVS_2017}\\vcvarsall.bat" GOTO :2017 - @IF EXIST "${MSVS_2019}\\vcvarsall.bat" GOTO :2019 - @ECHO "Microsoft Visual Studio not found" - @EXIT 1 - :2017 - @CALL "${MSVS_2017}\\vcvarsall.bat" ${args.join(' ')} - @GOTO ENV - :2019 - @CALL "${MSVS_2019}\\vcvarsall.bat" ${args.join(' ')} - @GOTO ENV - :ENV - @IF ERRORLEVEL 1 EXIT - @SET - `) + await fs.writeFile(helper, script) var environment try { @@ -98,4 +125,4 @@ async function main() { core.info(`Configured Developer Command Prompt`) } -main().catch(() => core.setFailed('Could not setup Developer Command Prompt')) +main().catch((e) => core.setFailed('Could not setup Developer Command Prompt: ' + e.message)) diff --git a/package-lock.json b/package-lock.json index f2c38af..5083d5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "msvc-dev-cmd", - "version": "1.0.0", + "version": "1.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { From 9269bb4bafc62e0b197de6b355d9daff162b4e1f Mon Sep 17 00:00:00 2001 From: ilammy Date: Thu, 30 Apr 2020 21:23:23 +0300 Subject: [PATCH 3/3] Bump transitive dependency versions Resolve CVE-2020-7598 in minimis -- one of our transitive dependencies. --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5083d5b..7689759 100644 --- a/package-lock.json +++ b/package-lock.json @@ -616,18 +616,18 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "dev": true, "requires": { - "minimist": "0.0.8" + "minimist": "^1.2.5" } }, "ms": {