mirror of
https://github.com/ilammy/msvc-dev-cmd.git
synced 2026-09-07 06:07:19 +08:00
msvc-dev-cmd v1.6.0
This commit is contained in:
@@ -13,11 +13,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: default
|
name: default
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
- name: Download Internet
|
- name: Download Internet
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Enable Developer Command Prompt
|
- name: Enable Developer Command Prompt
|
||||||
@@ -32,6 +30,23 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm audit --audit-level=moderate
|
- run: npm audit --audit-level=moderate
|
||||||
|
alias-arch:
|
||||||
|
name: arch aliases
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out source code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Download Internet
|
||||||
|
run: npm install
|
||||||
|
- name: Enable Developer Command Prompt
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
arch: Win32
|
||||||
|
- name: Compile and run some C code
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cl.exe hello.c
|
||||||
|
hello.exe
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
name: release
|
name: release
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Developer Command Prompt
|
- name: Setup Developer Command Prompt
|
||||||
uses: ilammy/msvc-dev-cmd@v1
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
- name: Compile and run some C code
|
- name: Compile and run some C code
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
@@ -28,5 +26,5 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v2
|
||||||
- run: npm audit --audit-level=moderate
|
- run: npm audit --audit-level=moderate
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ Supports Windows. Does nothing on Linux and macOS.
|
|||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `arch` – target architecture
|
- `arch` – target architecture
|
||||||
- native compilation: `x86`, `x64` (default), `amd64` (synonym for x64)
|
- native compilation:
|
||||||
|
- `x64` (default) or its synonyms: `amd64`, `win64`
|
||||||
|
- `x86` or its synonyms: `win32`
|
||||||
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
|
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
|
||||||
`amd64_x86`, `amd64_arm`, `amd64_arm64`
|
`amd64_x86`, `amd64_arm`, `amd64_arm64`
|
||||||
- `sdk` – Windows SDK to use
|
- `sdk` – Windows SDK to use
|
||||||
|
|||||||
@@ -77,12 +77,23 @@ function main() {
|
|||||||
// Add standard location of "vswhere" to PATH, in case it's not there.
|
// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||||
process.env.PATH += path.delimiter + VSWHERE_PATH
|
process.env.PATH += path.delimiter + VSWHERE_PATH
|
||||||
|
|
||||||
const arch = core.getInput('arch')
|
var arch = core.getInput('arch')
|
||||||
const sdk = core.getInput('sdk')
|
const sdk = core.getInput('sdk')
|
||||||
const toolset = core.getInput('toolset')
|
const toolset = core.getInput('toolset')
|
||||||
const uwp = core.getInput('uwp')
|
const uwp = core.getInput('uwp')
|
||||||
const spectre = core.getInput('spectre')
|
const spectre = core.getInput('spectre')
|
||||||
|
|
||||||
|
// There are all sorts of way the architectures are called. In addition to
|
||||||
|
// values supported by Microsoft Visual C++, recognize some common aliases.
|
||||||
|
let arch_aliases = {
|
||||||
|
"win32": "x86",
|
||||||
|
"win64": "x64",
|
||||||
|
}
|
||||||
|
// Ignore case when matching as that's what humans expect.
|
||||||
|
if (arch.toLowerCase() in arch_aliases) {
|
||||||
|
arch = arch_aliases[arch.toLowerCase()]
|
||||||
|
}
|
||||||
|
|
||||||
// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
|
// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
|
||||||
// Call the configuration batch file and then output *all* the environment variables.
|
// Call the configuration batch file and then output *all* the environment variables.
|
||||||
|
|
||||||
@@ -104,6 +115,24 @@ function main() {
|
|||||||
core.debug(`Running: ${command}`)
|
core.debug(`Running: ${command}`)
|
||||||
const environment = child_process.execSync(command, {shell: "cmd"}).toString().split('\r\n')
|
const environment = child_process.execSync(command, {shell: "cmd"}).toString().split('\r\n')
|
||||||
|
|
||||||
|
// If vsvars.bat is given an incorrect command line, it will print out
|
||||||
|
// an error and *still* exit successfully. Parse out errors from output
|
||||||
|
// which don't look like environment variables, and fail if appropriate.
|
||||||
|
var failed = false
|
||||||
|
for (let line of environment) {
|
||||||
|
if (line.match(/^\[ERROR.*\]/)) {
|
||||||
|
failed = true
|
||||||
|
// Don't print this particular line which will be confusing in output.
|
||||||
|
if (line.match(/Error in script usage. The correct usage is:$/)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
core.error(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (failed) {
|
||||||
|
throw new Error('invalid parameters')
|
||||||
|
}
|
||||||
|
|
||||||
for (let string of environment) {
|
for (let string of environment) {
|
||||||
const [name, value] = string.split('=')
|
const [name, value] = string.split('=')
|
||||||
for (let pattern of InterestingVariables) {
|
for (let pattern of InterestingVariables) {
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "msvc-dev-cmd",
|
"name": "msvc-dev-cmd",
|
||||||
"version": "1.5.0",
|
"version": "1.6.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "msvc-dev-cmd",
|
"name": "msvc-dev-cmd",
|
||||||
"version": "1.5.0",
|
"version": "1.6.0",
|
||||||
"description": "GitHub Action to setup Developer Command Prompt for Microsoft Visual C++",
|
"description": "GitHub Action to setup Developer Command Prompt for Microsoft Visual C++",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user