Compare commits

..
Author SHA1 Message Date
dependabot[bot] 0fc2502ca4 Bump ajv from 6.10.2 to 6.12.6
Bumps [ajv](https://github.com/ajv-validator/ajv) from 6.10.2 to 6.12.6.
- [Release notes](https://github.com/ajv-validator/ajv/releases)
- [Commits](https://github.com/ajv-validator/ajv/compare/v6.10.2...v6.12.6)

---
updated-dependencies:
- dependency-name: ajv
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-13 05:27:45 +00:00
10 changed files with 987 additions and 3703 deletions

No files matched your search

-11
View File
@@ -1,11 +0,0 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
groups:
github-actions:
patterns: ["*"]
schedule:
interval: "weekly"
cooldown:
default-days: 7
+11 -40
View File
@@ -4,25 +4,18 @@ on:
branches: branches:
- dev - dev
paths-ignore: paths-ignore:
- "*.md" - '*.md'
push: push:
branches: branches:
- dev - dev
paths-ignore: paths-ignore:
- "*.md" - '*.md'
workflow_dispatch:
jobs: jobs:
build: build:
strategy: runs-on: windows-latest
fail-fast: false
matrix:
runner:
- windows-latest
- windows-2025-vs2026
runs-on: ${{ matrix.runner }}
steps: steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - uses: actions/checkout@v2
- name: Setup MSBuild (vswhere-path) - name: Setup MSBuild (vswhere-path)
id: setup_msbuild_explicit id: setup_msbuild_explicit
@@ -38,42 +31,20 @@ jobs:
id: setup_msbuild_fallback id: setup_msbuild_fallback
uses: ./ uses: ./
env: env:
PATH: "" PATH: ''
- name: Setup MSBuild (x64) - name: Setup MSBuild (x64)
if: runner.arch == 'X64' id: setup_msbuild_path
id: setup_msbuild_path_x64
uses: ./ uses: ./
with: with:
vs-prerelease: true vs-prerelease: true
msbuild-architecture: "x64" msbuild-architecture: 'x64'
- name: Setup MSBuild (arm64) - name: echo msbuild path
if: runner.arch == 'ARM64'
id: setup_msbuild_path_arm64
uses: ./
with:
vs-prerelease: true
msbuild-architecture: "arm64"
- name: Write MSBuild summary
if: always()
shell: pwsh
run: | run: |
@" echo "vswhere-path: ${{ steps.setup_msbuild_explicit.outputs.msbuildPath }}"
## MSBuild setup summary echo "PATH: ${{ steps.setup_msbuild_path.outputs.msbuildPath }}"
echo "Fallback: ${{ steps.setup_msbuild_fallback.outputs.msbuildPath }}"
- Runner label: `${{ matrix.runner }}`
- Runner architecture: `${{ runner.arch }}`
| Probe | msbuildPath |
| --- | --- |
| vswhere-path | ${{ steps.setup_msbuild_explicit.outputs.msbuildPath || 'N/A' }} |
| PATH | ${{ steps.setup_msbuild_path.outputs.msbuildPath || 'N/A' }} |
| Fallback | ${{ steps.setup_msbuild_fallback.outputs.msbuildPath || 'N/A' }} |
| x64 | ${{ steps.setup_msbuild_path_x64.outputs.msbuildPath || 'N/A' }} |
| arm64 | ${{ steps.setup_msbuild_path_arm64.outputs.msbuildPath || 'N/A' }} |
"@ | Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
- name: echo MSBuild - name: echo MSBuild
run: msbuild -version run: msbuild -version
+7 -39
View File
@@ -1,49 +1,27 @@
# microsoft/setup-msbuild # microsoft/setup-msbuild
This action will help discover where the `MSBuild` tool is and automatically add it to the `PATH` environment variables for you so future steps in your Actions workflow can just initiate `msbuild` commands without knowing the full path. This action will help discover where the `MSBuild` tool is and automatically add it to the `PATH` environment variables for you so future steps in your Actions workflow can just initiate `msbuild` commands without knowing the full path.
> [!IMPORTANT]
> Please note this tool does NOT add other Visual Studio tools (like VSTest, cl, cmake, or others) to `PATH` > Please note this tool does NOT add other Visual Studio tools (like VSTest, cl, cmake, or others) to `PATH`
## Breaking Changes in v4
Starting with `v4`, the default value of `msbuild-architecture` is no longer always `x86`. When
`msbuild-architecture` is not explicitly specified, the action now **auto-detects** the best
architecture:
- `x64` when running on a 64-bit machine **and** the resolved Visual Studio/MSBuild install is
version 17.0 or later (Visual Studio 2022+, which ships a native 64-bit MSBuild).
- `x86` otherwise (older Visual Studio versions, or 32-bit hosts), matching the previous behavior.
If you explicitly set `msbuild-architecture` (e.g. `x86`, `x64`, or `arm64`), that value is always
respected and this auto-detection does not apply. If your workflow depends on always getting the
32-bit MSBuild by default, set `msbuild-architecture: x86` explicitly.
## Example Usage ## Example Usage
```yml ```yml
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v4 uses: microsoft/setup-msbuild@v1.1
- name: Build app for release - name: Build app for release
run: msbuild src\YourProjectFile.csproj -t:rebuild -verbosity:diag -property:Configuration=Release run: msbuild src\YourProjectFile.csproj -t:rebuild -verbosity:diag -property:Configuration=Release
``` ```
## Runners and included software
This action is intended to be used within the GitHub Actions workflows using the model of 'runners' either hosted (provided by GitHub) or self-hosted (provided by you). The version and parameters you specify below are going to be scoped to what software actually exists on the runner image being used. For example, hosted runner images from GitHub typically do NOT have pre-release versions of Visual Studio on them so using `vs-prerelease` parameter noted below may not have intended effect when using hosted runners. The software included for GitHub-hosted runner images can always be found here: <https://github.com/actions/runner-images> which also includes information on when/how software on hosted images gets updated.
## Optional Parameters ## Optional Parameters
There are a few additional parameters that can be set if you need them. These are optional and should only be set if you know that you need them or what you are doing. There are a few additional parameters that can be set if you need them. These are optional and should only be set if you know that you need them or what you are doing.
### Specifying specific versions of Visual Studio (optional) ### Specifying specific versions of Visual Studio (optional)
You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4. You may have a situation where your Actions runner has multiple versions of Visual Studio and you need to find a specific version of the tool. Simply add the `vs-version` input to specify the range of versions to find. If looking for a specific version, specify the minimum and maximum versions as shown in the example below, which will look for just 16.4.
```yml ```yml
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v4 uses: microsoft/setup-msbuild@v1.1
with: with:
vs-version: '[16.4,16.5)' vs-version: '[16.4,16.5)'
``` ```
@@ -51,48 +29,39 @@ You may have a situation where your Actions runner has multiple versions of Visu
The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the [vswhere wiki](https://github.com/microsoft/vswhere/wiki) for more details. The syntax is the same used for Visual Studio extensions, where square brackets like "[" mean inclusive, and parenthesis like "(" mean exclusive. A comma is always required, but eliding the minimum version looks for all older versions and eliding the maximum version looks for all newer versions. See the [vswhere wiki](https://github.com/microsoft/vswhere/wiki) for more details.
### Use pre-release versions of Visual Studio (optional) ### Use pre-release versions of Visual Studio (optional)
If you need your Actions runner to target a pre-release version of Visual Studio, simply add the `vs-prerelease` input. This is necessary if you want to run an action on a virtual environment that contains a pre-release version of Visual Studio or self-hosted images that you may have that also have pre-release versions of Visual Studio installed. If you need your Actions runner to target a pre-release version of Visual Studio, simply add the `vs-prerelease` input. This is necessary if you want to run an action on a virtual environment that contains a pre-release version of Visual Studio or self-hosted images that you may have that also have pre-release versions of Visual Studio installed.
```yml ```yml
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v4 uses: microsoft/setup-msbuild@v1.1
with: with:
vs-prerelease: true vs-prerelease: true
``` ```
### Specifying MSBuild architecture (optional) ### Specifying MSBuild architecture (optional)
By default the action will use the x86 architecture for MSBuild, but it is possible to target the x64 versions instead. Simply add the `msbuild-architecture` input. Valid input values are `x86` (default) and `x64`.
By default (as of `v4`), the action auto-detects the preferred MSBuild architecture: it uses `x64`
when running on a 64-bit machine with Visual Studio/MSBuild 17.0 or later installed, and falls back
to `x86` otherwise. You can override this by explicitly setting the `msbuild-architecture` input.
Valid input values are `x86`, `x64`, and `arm64`. Note that the success of these will rely on the
runner OS.
```yml ```yml
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v4 uses: microsoft/setup-msbuild@v1.1
with: with:
msbuild-architecture: x64 msbuild-architecture: x64
``` ```
## How does this work? ## How does this work?
This makes use of the vswhere tool which is a tool delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using: This makes use of the vswhere tool which is a tool delivered by Microsoft to help in identifying Visual Studio installs and various components. This tool is installed on the hosted Windows runners for GitHub Actions. If you are using a self-hosted runner, you either need to make sure vswhere.exe is in your agent's PATH or specify a full path to the location using:
```yml ```yml
- name: Add msbuild to PATH - name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v4 uses: microsoft/setup-msbuild@v1.1
with: with:
vswhere-path: 'C:\path\to\your\tools\' vswhere-path: 'C:\path\to\your\tools\'
``` ```
## Notes on arguments ## Notes on arguments
While the Action enables you to specify a `vswhere` path as well as a `vs-version`, these are more advanced options and when using GitHub-hosted runners you should not need these and is recommended you don't specify them as they are optional. Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync. For GitHub-hosted runners, omitting these arguments is the preferred usage. While the Action enables you to specify a `vswhere` path as well as a `vs-version`, these are more advanced options and when using GitHub-hosted runners you should not need these and is recommended you don't specify them as they are optional. Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync. For GitHub-hosted runners, omitting these arguments is the preferred usage.
## Building this repo ## Building this repo
As with most GitHub Actions, this requires NodeJS development tools. After installing NodeJS, you can build this by executing: As with most GitHub Actions, this requires NodeJS development tools. After installing NodeJS, you can build this by executing:
```bash ```bash
@@ -104,14 +73,13 @@ npm run pack
which will modify/create the /dist folder with the final index.js output which will modify/create the /dist folder with the final index.js output
# Credits # Credits
Thank you to [Warren Buckley](https://github.com/warrenbuckley) for being a core contributor to this Action for the benefit of all developers! Thank you to [Warren Buckley](https://github.com/warrenbuckley) for being a core contributor to this Action for the benefit of all developers!
# Contributing # Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit <https://cla.opensource.microsoft.com>. the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
-54
View File
@@ -1,54 +0,0 @@
import {
MIN_VS_VERSION_FOR_X64,
parseMajorVersion,
resolveMSBuildArchitecture
} from '../src/main'
describe('parseMajorVersion', () => {
it('parses a standard installationVersion string', () => {
expect(parseMajorVersion('17.9.34728.123')).toBe(17)
})
it('parses a single-segment version', () => {
expect(parseMajorVersion('16')).toBe(16)
})
it('trims whitespace before parsing', () => {
expect(parseMajorVersion(' 17.0.0.0 ')).toBe(17)
})
it('returns undefined for an empty string', () => {
expect(parseMajorVersion('')).toBeUndefined()
})
it('returns undefined for a non-numeric string', () => {
expect(parseMajorVersion('not-a-version')).toBeUndefined()
})
})
describe('resolveMSBuildArchitecture', () => {
it('always respects an explicit architecture, regardless of OS/version', () => {
expect(resolveMSBuildArchitecture('x86', true, 17)).toBe('x86')
expect(resolveMSBuildArchitecture('x64', false, 15)).toBe('x64')
expect(resolveMSBuildArchitecture('arm64', true, 17)).toBe('arm64')
})
it('defaults to x64 on a 64-bit host with VS/MSBuild 17+', () => {
expect(resolveMSBuildArchitecture('', true, MIN_VS_VERSION_FOR_X64)).toBe(
'x64'
)
expect(resolveMSBuildArchitecture('', true, 18)).toBe('x64')
})
it('defaults to x86 on a 64-bit host with VS/MSBuild older than 17', () => {
expect(resolveMSBuildArchitecture('', true, 16)).toBe('x86')
})
it('defaults to x86 on a non-64-bit host even with VS/MSBuild 17+', () => {
expect(resolveMSBuildArchitecture('', false, 17)).toBe('x86')
})
it('defaults to x86 when the VS/MSBuild version could not be determined', () => {
expect(resolveMSBuildArchitecture('', true, undefined)).toBe('x86')
})
})
-18
View File
@@ -1,18 +0,0 @@
# See https://github.com/krzema12/github-actions-typing
inputs:
vswhere-path:
type: string
vs-version:
type: string
vs-prerelease:
type: boolean
msbuild-architecture:
type: enum
name: Architecture
allowed-values:
- x86
- x64
- arm64
outputs:
msbuildPath:
type: string
+11 -10
View File
@@ -1,26 +1,27 @@
name: "setup-msbuild" name: 'setup-msbuild'
description: "Helps set up MSBuild into PATH for later usage." description: 'Helps set up MSBuild into PATH for later usage.'
author: "Microsoft" author: 'Microsoft'
branding: branding:
color: purple color: purple
icon: terminal icon: terminal
inputs: inputs:
vswhere-path: vswhere-path:
required: false required: false
description: "Folder location of where vswhere.exe is located if a self-hosted agent" description: 'Folder location of where vswhere.exe is located if a self-hosted agent'
vs-version: vs-version:
description: "Version of Visual Studio to search; defaults to latest if not specified" description: 'Version of Visual Studio to search; defaults to latest if not specified'
required: false required: false
vs-prerelease: vs-prerelease:
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", "x64", or "arm64". "x64" is only available from Visual Studio version 17.0 and later. If left unspecified, the action auto-detects the best option: "x64" on 64-bit machines when a Visual Studio/MSBuild 17.0+ install is found, otherwise "x86".' 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'
outputs: outputs:
msbuildPath: msbuildPath:
description: "The resulting location of msbuild for your inputs" description: 'The resulting location of msbuild for your inputs'
runs: runs:
using: "node24" using: 'node12'
main: "dist/index.js" main: 'dist/index.js'
+909 -3328
View File
File diff suppressed because it is too large. Load diff
+37 -92
View File
@@ -1,15 +1,15 @@
{ {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "3.0.0", "version": "1.1.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "3.0.0", "version": "1.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.3", "@actions/exec": "^1.0.3",
"@actions/tool-cache": "^1.3.0" "@actions/tool-cache": "^1.3.0"
}, },
@@ -17,7 +17,7 @@
"@types/jest": "^24.0.23", "@types/jest": "^24.0.23",
"@types/node": "^12.12.25", "@types/node": "^12.12.25",
"@typescript-eslint/parser": "^2.8.0", "@typescript-eslint/parser": "^2.8.0",
"@vercel/ncc": "^0.38.4", "@zeit/ncc": "^0.20.5",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-github": "^2.0.0", "eslint-plugin-github": "^2.0.0",
"eslint-plugin-jest": "^22.21.0", "eslint-plugin-jest": "^22.21.0",
@@ -30,29 +30,9 @@
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "1.10.0", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
"dependencies": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/core/node_modules/@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/@actions/core/node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
}, },
"node_modules/@actions/exec": { "node_modules/@actions/exec": {
"version": "1.0.3", "version": "1.0.3",
@@ -789,12 +769,12 @@
} }
} }
}, },
"node_modules/@vercel/ncc": { "node_modules/@zeit/ncc": {
"version": "0.38.4", "version": "0.20.5",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.20.5.tgz",
"integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==", "integrity": "sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==",
"deprecated": "@zeit/ncc is no longer maintained. Please use @vercel/ncc instead.",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"ncc": "dist/ncc/cli.js" "ncc": "dist/ncc/cli.js"
} }
@@ -846,15 +826,19 @@
} }
}, },
"node_modules/ajv": { "node_modules/ajv": {
"version": "6.10.2", "version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"fast-deep-equal": "^2.0.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
} }
}, },
"node_modules/ansi-escapes": { "node_modules/ansi-escapes": {
@@ -2914,9 +2898,9 @@
] ]
}, },
"node_modules/fast-deep-equal": { "node_modules/fast-deep-equal": {
"version": "2.0.1", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true "dev": true
}, },
"node_modules/fast-diff": { "node_modules/fast-diff": {
@@ -3029,19 +3013,6 @@
"integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"dev": true "dev": true
}, },
"node_modules/flow-bin": {
"version": "0.188.2",
"resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.188.2.tgz",
"integrity": "sha512-zvm1bEEj4n3wdsXm+EA49e/CiZ966kLFJpHbheYdr73P/qMzKk25zeoPTRauNHSsKILK0mL+2QadKii/nf+fkw==",
"dev": true,
"peer": true,
"bin": {
"flow": "cli.js"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/for-in": { "node_modules/for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
@@ -8182,28 +8153,9 @@
}, },
"dependencies": { "dependencies": {
"@actions/core": { "@actions/core": {
"version": "1.10.0", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
},
"dependencies": {
"@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "^0.0.6"
}
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
}, },
"@actions/exec": { "@actions/exec": {
"version": "1.0.3", "version": "1.0.3",
@@ -8845,10 +8797,10 @@
"tsutils": "^3.17.1" "tsutils": "^3.17.1"
} }
}, },
"@vercel/ncc": { "@zeit/ncc": {
"version": "0.38.4", "version": "0.20.5",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.20.5.tgz",
"integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==", "integrity": "sha512-XU6uzwvv95DqxciQx+aOLhbyBx/13ky+RK1y88Age9Du3BlA4mMPCy13BGjayOrrumOzlq1XV3SD/BWiZENXlw==",
"dev": true "dev": true
}, },
"abab": { "abab": {
@@ -8887,12 +8839,12 @@
"dev": true "dev": true
}, },
"ajv": { "ajv": {
"version": "6.10.2", "version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true, "dev": true,
"requires": { "requires": {
"fast-deep-equal": "^2.0.1", "fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0", "fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1", "json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2" "uri-js": "^4.2.2"
@@ -10539,9 +10491,9 @@
"dev": true "dev": true
}, },
"fast-deep-equal": { "fast-deep-equal": {
"version": "2.0.1", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true "dev": true
}, },
"fast-diff": { "fast-diff": {
@@ -10638,13 +10590,6 @@
"integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"dev": true "dev": true
}, },
"flow-bin": {
"version": "0.188.2",
"resolved": "https://registry.npmjs.org/flow-bin/-/flow-bin-0.188.2.tgz",
"integrity": "sha512-zvm1bEEj4n3wdsXm+EA49e/CiZ966kLFJpHbheYdr73P/qMzKk25zeoPTRauNHSsKILK0mL+2QadKii/nf+fkw==",
"dev": true,
"peer": true
},
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz",
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "setup-msbuild", "name": "setup-msbuild",
"version": "4.0.0", "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",
@@ -9,7 +9,7 @@
"format": "prettier --write **/*.ts", "format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"pack": "ncc build lib/main.js -o dist", "pack": "ncc build",
"test": "jest", "test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run pack" "all": "npm run build && npm run format && npm run lint && npm run pack"
}, },
@@ -28,7 +28,7 @@
"author": "Microsoft", "author": "Microsoft",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.2.6",
"@actions/exec": "^1.0.3", "@actions/exec": "^1.0.3",
"@actions/tool-cache": "^1.3.0" "@actions/tool-cache": "^1.3.0"
}, },
@@ -36,7 +36,7 @@
"@types/jest": "^24.0.23", "@types/jest": "^24.0.23",
"@types/node": "^12.12.25", "@types/node": "^12.12.25",
"@typescript-eslint/parser": "^2.8.0", "@typescript-eslint/parser": "^2.8.0",
"@vercel/ncc": "^0.38.4", "@zeit/ncc": "^0.20.5",
"eslint": "^5.16.0", "eslint": "^5.16.0",
"eslint-plugin-github": "^2.0.0", "eslint-plugin-github": "^2.0.0",
"eslint-plugin-jest": "^22.21.0", "eslint-plugin-jest": "^22.21.0",
+8 -107
View File
@@ -1,7 +1,6 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import * as fs from 'fs' import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path' import * as path from 'path'
import * as io from '@actions/io' import * as io from '@actions/io'
import {ExecOptions} from '@actions/exec/lib/interfaces' import {ExecOptions} from '@actions/exec/lib/interfaces'
@@ -10,56 +9,13 @@ 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_INPUT = core.getInput('msbuild-architecture') const MSBUILD_ARCH = core.getInput('msbuild-architecture') || 'x86'
let MSBUILD_ARCH = MSBUILD_ARCH_INPUT
// The minimum Visual Studio/MSBuild major version that ships a native x64 MSBuild.exe
export const MIN_VS_VERSION_FOR_X64 = 17
// Determines the effective MSBuild architecture to use.
// If the user explicitly specified `msbuild-architecture`, that choice is always respected.
// Otherwise (breaking change as of v4), the action auto-detects and prefers x64 when
// running on a 64-bit OS and the resolved VS/MSBuild installation is version 17.0 or later.
// If the VS version can't be determined, or the host isn't 64-bit, it falls back to x86.
export function resolveMSBuildArchitecture(
explicitArch: string,
isWindows64Bit: boolean,
vsMajorVersion: number | undefined
): string {
if (explicitArch) {
return explicitArch
}
if (
isWindows64Bit &&
vsMajorVersion !== undefined &&
vsMajorVersion >= MIN_VS_VERSION_FOR_X64
) {
return 'x64'
}
return 'x86'
}
// Parses the major version number out of a vswhere `installationVersion` string
// such as "17.9.34728.123". Returns undefined if it cannot be parsed.
export function parseMajorVersion(
installationVersion: string
): number | undefined {
const match = installationVersion.trim().match(/^(\d+)/)
if (!match) {
return undefined
}
const major = parseInt(match[1], 10)
return isNaN(major) ? undefined : major
}
// if a specific version of VS is requested // if a specific version of VS is requested
let VSWHERE_EXEC = let VSWHERE_EXEC = '-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
'-products * -requires Microsoft.Component.MSBuild -property installationPath -latest '
if (ALLOW_PRERELEASE === 'true') { if (ALLOW_PRERELEASE === 'true') {
VSWHERE_EXEC += ' -prerelease ' VSWHERE_EXEC += ' -prerelease '
} }
if (VS_VERSION !== 'latest') { if (VS_VERSION !== 'latest') {
VSWHERE_EXEC += `-version "${VS_VERSION}" ` VSWHERE_EXEC += `-version "${VS_VERSION}" `
@@ -108,39 +64,6 @@ async function run(): Promise<void> {
core.debug(`Full tool exe: ${vswhereToolExe}`) core.debug(`Full tool exe: ${vswhereToolExe}`)
// if the user did not explicitly specify an architecture, auto-detect the
// preferred architecture based on the host OS and the resolved VS/MSBuild version
if (!MSBUILD_ARCH_INPUT) {
let vsMajorVersion: number | undefined
const versionOptions: ExecOptions = {}
versionOptions.listeners = {
stdout: (data: Buffer) => {
const installationVersion = data.toString().trim()
core.debug(`Found installation version: ${installationVersion}`)
const parsed = parseMajorVersion(installationVersion)
if (parsed !== undefined) {
vsMajorVersion = parsed
}
}
}
const versionExec = VSWHERE_EXEC.replace(
'-property installationPath',
'-property installationVersion'
)
await exec.exec(`"${vswhereToolExe}" ${versionExec}`, [], versionOptions)
const isWindows64Bit = os.arch() === 'x64' || os.arch() === 'arm64'
MSBUILD_ARCH = resolveMSBuildArchitecture(
MSBUILD_ARCH_INPUT,
isWindows64Bit,
vsMajorVersion
)
core.info(
`Auto-detected msbuild-architecture: ${MSBUILD_ARCH} (os.arch=${os.arch()}, vsMajorVersion=${vsMajorVersion})`
)
}
let foundToolPath = '' let foundToolPath = ''
const options: ExecOptions = {} const options: ExecOptions = {}
options.listeners = { options.listeners = {
@@ -148,16 +71,12 @@ async function run(): Promise<void> {
const installationPath = data.toString().trim() const installationPath = data.toString().trim()
core.debug(`Found installation path: ${installationPath}`) core.debug(`Found installation path: ${installationPath}`)
// x64 and arm64 only exist in one possible location, so no fallback probing // x64 only exists in one possible location, so no fallback probing
if (MSBUILD_ARCH === 'x64' || MSBUILD_ARCH === 'arm64') { if (MSBUILD_ARCH === "x64") {
// x64 is actually amd64 so change to that
if (MSBUILD_ARCH === 'x64') {
MSBUILD_ARCH = 'amd64'
}
let toolPath = path.join( let toolPath = path.join(
installationPath, installationPath,
`MSBuild\\Current\\Bin\\${MSBUILD_ARCH}\\MSBuild.exe` 'MSBuild\\Current\\Bin\\amd64\\MSBuild.exe'
) );
core.debug(`Checking for path: ${toolPath}`) core.debug(`Checking for path: ${toolPath}`)
if (!fs.existsSync(toolPath)) { if (!fs.existsSync(toolPath)) {
return return
@@ -195,24 +114,6 @@ async function run(): Promise<void> {
return return
} }
core.info(`Found MSBuild tool path: ${foundToolPath}`)
core.info(`Using MSBuild architecture: ${MSBUILD_ARCH}`)
// try to get the MSBuild version for diagnostic purposes; a failure here shouldn't fail the action
try {
let msbuildVersion = ''
const versionOptions: ExecOptions = {}
versionOptions.listeners = {
stdout: (data: Buffer) => {
msbuildVersion += data.toString()
}
}
await exec.exec(`"${foundToolPath}" -version -nologo`, [], versionOptions)
core.info(`Found MSBuild version: ${msbuildVersion.trim()}`)
} catch (error) {
core.debug(`Unable to determine MSBuild version: ${error.message}`)
}
// extract the folder location for the tool // extract the folder location for the tool
const toolFolderPath = path.dirname(foundToolPath) const toolFolderPath = path.dirname(foundToolPath)
@@ -221,7 +122,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)
} }