Fix tool lookup and revert logging

This commit is contained in:
Heath Stewart 2020-04-21 16:57:28 -07:00
parent e9f4898311
commit 20e1303853
2 changed files with 12 additions and 12 deletions

12
dist/index.js vendored
View File

@ -996,20 +996,20 @@ function run() {
let vswhereToolExe = ''; let vswhereToolExe = '';
if (VSWHERE_PATH) { if (VSWHERE_PATH) {
// specified a path for vswhere, use it // specified a path for vswhere, use it
core.info(`Using given vswhere-path: ${VSWHERE_PATH}`); core.debug(`Using given vswhere-path: ${VSWHERE_PATH}`);
vswhereToolExe = path.join(VSWHERE_PATH, 'vswhere.exe'); vswhereToolExe = path.join(VSWHERE_PATH, 'vswhere.exe');
} }
else { else {
// check in PATH to see if it is there // check in PATH to see if it is there
try { try {
const vsWhereInPath = yield io.which('vswhere', true); const vsWhereInPath = yield io.which('vswhere', true);
core.info(`Found tool in PATH: ${vsWhereInPath}`); core.debug(`Found tool in PATH: ${vsWhereInPath}`);
vswhereToolExe = path.join(vsWhereInPath, 'vswhere.exe'); vswhereToolExe = vsWhereInPath;
} }
catch (_a) { catch (_a) {
// fall back to VS-installed path // fall back to VS-installed path
vswhereToolExe = path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer\\vswhere.exe'); vswhereToolExe = path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio\\Installer\\vswhere.exe');
core.info(`Trying Visual Studio-installed path: ${vswhereToolExe}`); core.debug(`Trying Visual Studio-installed path: ${vswhereToolExe}`);
} }
} }
if (!fs.existsSync(vswhereToolExe)) { if (!fs.existsSync(vswhereToolExe)) {
@ -1022,7 +1022,7 @@ function run() {
options.listeners = { options.listeners = {
stdout: (data) => { stdout: (data) => {
const installationPath = data.toString().trim(); const installationPath = data.toString().trim();
core.info(`Found installation path: ${installationPath}`); core.debug(`Found installation path: ${installationPath}`);
let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe'); let toolPath = path.join(installationPath, 'MSBuild\\Current\\Bin\\MSBuild.exe');
core.debug(`Checking for path: ${toolPath}`); core.debug(`Checking for path: ${toolPath}`);
if (!fs.existsSync(toolPath)) { if (!fs.existsSync(toolPath)) {
@ -1047,7 +1047,7 @@ function run() {
core.setOutput('msbuildPath', toolFolderPath); core.setOutput('msbuildPath', toolFolderPath);
// add tool path to PATH // add tool path to PATH
core.addPath(toolFolderPath); core.addPath(toolFolderPath);
core.info(`Tool path added to PATH: ${toolFolderPath}`); core.debug(`Tool path added to PATH: ${toolFolderPath}`);
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);

View File

@ -30,21 +30,21 @@ async function run(): Promise<void> {
if (VSWHERE_PATH) { if (VSWHERE_PATH) {
// specified a path for vswhere, use it // specified a path for vswhere, use it
core.info(`Using given vswhere-path: ${VSWHERE_PATH}`) core.debug(`Using given vswhere-path: ${VSWHERE_PATH}`)
vswhereToolExe = path.join(VSWHERE_PATH, 'vswhere.exe') vswhereToolExe = path.join(VSWHERE_PATH, 'vswhere.exe')
} else { } else {
// check in PATH to see if it is there // check in PATH to see if it is there
try { try {
const vsWhereInPath: string = await io.which('vswhere', true) const vsWhereInPath: string = await io.which('vswhere', true)
core.info(`Found tool in PATH: ${vsWhereInPath}`) core.debug(`Found tool in PATH: ${vsWhereInPath}`)
vswhereToolExe = path.join(vsWhereInPath, 'vswhere.exe') vswhereToolExe = vsWhereInPath
} catch { } catch {
// fall back to VS-installed path // fall back to VS-installed path
vswhereToolExe = path.join( vswhereToolExe = path.join(
process.env['ProgramFiles(x86)'] as string, process.env['ProgramFiles(x86)'] as string,
'Microsoft Visual Studio\\Installer\\vswhere.exe' 'Microsoft Visual Studio\\Installer\\vswhere.exe'
) )
core.info(`Trying Visual Studio-installed path: ${vswhereToolExe}`) core.debug(`Trying Visual Studio-installed path: ${vswhereToolExe}`)
} }
} }
@ -63,7 +63,7 @@ async function run(): Promise<void> {
options.listeners = { options.listeners = {
stdout: (data: Buffer) => { stdout: (data: Buffer) => {
const installationPath = data.toString().trim() const installationPath = data.toString().trim()
core.info(`Found installation path: ${installationPath}`) core.debug(`Found installation path: ${installationPath}`)
let toolPath = path.join( let toolPath = path.join(
installationPath, installationPath,
@ -103,7 +103,7 @@ async function run(): Promise<void> {
// add tool path to PATH // add tool path to PATH
core.addPath(toolFolderPath) core.addPath(toolFolderPath)
core.info(`Tool path added to PATH: ${toolFolderPath}`) core.debug(`Tool path added to PATH: ${toolFolderPath}`)
} catch (error) { } catch (error) {
core.setFailed(error.message) core.setFailed(error.message)
} }