From 8a8bb270fbc7f6972d7fe069d6a6d23a3d0607c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 18 Jul 2020 16:03:34 +0300 Subject: [PATCH 1/2] Bump lodash from 4.17.15 to 4.17.19 (#10) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7689759..6a7fad6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -595,9 +595,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "mimic-fn": { From 4b3ec49c7121cfcaa56a6195be847c24a86205f9 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 23 Sep 2020 05:20:24 -0500 Subject: [PATCH 2/2] Use vswhere to find vcvarsall.bat (#11) The Windows images provided by GitHub have a native program called "vswhere", which can be used to find vcvarsall.bat. * use vswhere to find vcvarsall * don't require child_process twice * use vswhere to find the 2015 bat file * refactor findWithVswhere * move finding vcbuildtools using vswhere upward * print error of vswhere --- index.js | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6a4941e..fd128fa 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ const core = require('@actions/core') -const exec = require('util').promisify(require('child_process').exec) +const child_process = require('child_process') +const exec = require('util').promisify(child_process.exec) const fs = require('fs') const process = require('process') @@ -18,21 +19,42 @@ const InterestingVariables = [ /^WindowsSDK/i, ] +function findWithVswhere(pattern) { + let path = null; + try { + path = child_process.execSync(`vswhere -products * -latest -prerelease -find ${pattern}`).toString().trim() + } catch (e) { + console.log(e) + } + return path +} + function findVcvarsall() { + // use vswhere + let path = findWithVswhere('**/Auxiliary/Build/vcvarsall.bat') + if (path && fs.existsSync(path)) { + return path + } + const programFiles = process.env['ProgramFiles(x86)'] // Given the order of each list it should check // for the more recent versions first and the // highest grade edition first. for (const ver of VERSIONS) { for (const ed of EDITIONS) { - const path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat` + path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat` if (fs.existsSync(path)) { return path } } } // Special case for Visual Studio 2015 (and maybe earlier), try it out too. - const path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat` + // us vswhere + path = findWithVswhere('**/vcbuildtools.bat') + if (path && fs.existsSync(path)) { + return path + } + path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat` if (fs.existsSync(path)) { return path }