Merging x64 probe and typos

This commit is contained in:
Tim Heuer 2021-11-01 20:01:10 -07:00
parent 84e0d709b2
commit ab534842b4
6 changed files with 8254 additions and 22 deletions

View File

@ -33,6 +33,13 @@ jobs:
env: env:
PATH: '' PATH: ''
- name: Setup MSBuild (x64)
id: setup_msbuild_path
uses: ./
with:
vs-prerelease: true
msbuild-architecture: 'x64'
- name: echo msbuild path - name: echo msbuild path
run: | run: |
echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}" echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}"

View File

@ -15,7 +15,7 @@ inputs:
description: 'Enable searching for pre-release versions of Visual Studio/MSBuild' description: 'Enable searching for pre-release versions of Visual Studio/MSBuild'
required: false required: false
msbuild-architecture: msbuild-architecture:
description: 'The preferred processor architecture of msbuild. Can be either "x86" or "x64". "x64" is only available from Visual Studio version 17.0 and later.' description: 'The preferred processor architecture of MSBuild. Can be either "x86" or "x64". "x64" is only available from Visual Studio version 17.0 and later.'
required: false required: false
default: 'x86' default: 'x86'
outputs: outputs:

22
dist/index.js vendored
View File

@ -1041,6 +1041,7 @@ const IS_WINDOWS = process.platform === 'win32';
const VS_VERSION = core.getInput('vs-version') || 'latest'; const VS_VERSION = core.getInput('vs-version') || 'latest';
const VSWHERE_PATH = core.getInput('vswhere-path'); const VSWHERE_PATH = core.getInput('vswhere-path');
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'; const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false';
const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86';
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '; let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ';
if (ALLOW_PRERELEASE === 'true') { if (ALLOW_PRERELEASE === 'true') {
@ -1089,16 +1090,27 @@ function run() {
stdout: (data) => { stdout: (data) => {
const installationPath = data.toString().trim(); const installationPath = data.toString().trim();
core.debug(`Found installation path: ${installationPath}`); core.debug(`Found installation path: ${installationPath}`);
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe'); // x64 only exists in one possible location, so no fallback probing
core.debug(`Checking for path: ${toolPath}`); if (MSBUILD_ARCH === "x64") {
if (!fs.existsSync(toolPath)) { let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\amd64\\MSBuild.exe');
toolPath = path.join(installationPath, 'MSBuild\\15.0\\Bin\\MSBuild.exe');
core.debug(`Checking for path: ${toolPath}`); core.debug(`Checking for path: ${toolPath}`);
if (!fs.existsSync(toolPath)) { if (!fs.existsSync(toolPath)) {
return; return;
} }
foundToolPath = toolPath;
}
else {
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe');
core.debug(`Checking for path: ${toolPath}`);
if (!fs.existsSync(toolPath)) {
toolPath = path.join(installationPath, 'MSBuild\\15.0\\Bin\\MSBuild.exe');
core.debug(`Checking for path: ${toolPath}`);
if (!fs.existsSync(toolPath)) {
return;
}
}
foundToolPath = toolPath;
} }
foundToolPath = toolPath;
} }
}; };
// execute the find putting the result of the command in the options foundToolPath // execute the find putting the result of the command in the options foundToolPath

8241
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "1.0.3", "version": "1.1.0",
"private": true, "private": true,
"description": "Helps set up specific MSBuild tool into PATH for later usage.", "description": "Helps set up specific MSBuild tool into PATH for later usage.",
"main": "lib/main.js", "main": "lib/main.js",

View File

@ -9,7 +9,7 @@ const IS_WINDOWS = process.platform === 'win32'
const VS_VERSION = core.getInput('vs-version') || 'latest' const VS_VERSION = core.getInput('vs-version') || 'latest'
const VSWHERE_PATH = core.getInput('vswhere-path') const VSWHERE_PATH = core.getInput('vswhere-path')
const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false' const ALLOW_PRERELEASE = core.getInput('vs-prerelease') || 'false'
const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'; const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest ' let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '