Do not use newer -find parameter

Fixes #10
This commit is contained in:
Heath Stewart 2020-04-04 11:41:45 -07:00
parent bb70c6a023
commit 4652bfc96e
4 changed files with 2190 additions and 16 deletions

2172
dist/index.js vendored

File diff suppressed because it is too large Load Diff

17
package-lock.json generated
View File

@ -17,6 +17,15 @@
"@actions/io": "^1.0.1"
}
},
"@actions/glob": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
"integrity": "sha512-lx8SzyQ2FE9+UUvjqY1f28QbTJv+w8qP7kHHbfQRhphrlcx0Mdmm1tZdGJzfxv1jxREa/sLW4Oy8CbGQKCJySA==",
"requires": {
"@actions/core": "^1.2.0",
"minimatch": "^3.0.4"
}
},
"@actions/http-client": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.2.tgz",
@ -972,8 +981,7 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"base": {
"version": "0.11.2",
@ -1043,7 +1051,6 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -1318,8 +1325,7 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"contains-path": {
"version": "0.1.0",
@ -4503,7 +4509,6 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}

View File

@ -30,6 +30,7 @@
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.3",
"@actions/glob": "^0.1.0",
"@actions/tool-cache": "^1.3.0"
},
"devDependencies": {

View File

@ -1,5 +1,6 @@
import * as core from '@actions/core'
import * as exec from '@actions/exec'
import * as glob from '@actions/glob'
import * as path from 'path'
import * as io from '@actions/io'
import {ExecOptions} from '@actions/exec/lib/interfaces'
@ -14,13 +15,13 @@ const VSWHERE_PATH =
)
// if a specific version of VS is requested
let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild '
let VSWHERE_EXEC =
'-products * -requires Microsoft.Component.MSBuild -property installationPath'
if (VS_VERSION === 'latest') {
VSWHERE_EXEC += '-latest '
} else {
VSWHERE_EXEC += `-version ${VS_VERSION} `
}
VSWHERE_EXEC += '-find MSBuild\\**\\Bin\\MSBuild.exe'
core.debug(`Execution arguments: ${VSWHERE_EXEC}`)
@ -58,10 +59,17 @@ async function run(): Promise<void> {
let foundToolPath = ''
const options: ExecOptions = {}
options.listeners = {
stdout: (data: Buffer) => {
stdout: async (data: Buffer) => {
// eslint-disable-next-line prefer-const
let output = data.toString()
foundToolPath += output
const pattern = `${output.trim()}\\\\MSBuild\\**\\Bin\\msbuild.exe`
const globber = await glob.create(pattern)
const files = await globber.glob()
if (files?.length > 0) {
foundToolPath = files[0]
}
}
}