mirror of
https://github.com/ilammy/msvc-dev-cmd.git
synced 2026-09-07 06:07:19 +08:00
Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7defe92547 | |||
| e78ece9a2a | |||
| 62f16bb530 | |||
| 985d494a0f | |||
| c5426bf30a | |||
| 100402d805 | |||
| 5611a7cba9 | |||
| 08b850b4d0 | |||
| ff72ae9ce3 | |||
| 18f5f2cef4 | |||
| f5e8657374 | |||
| dd5e2fa0a7 | |||
| 2962e34b14 | |||
| d39d8f7626 | |||
| 38903dd110 | |||
| 24b406e1cf | |||
| 6f493f9a67 | |||
| 754fb4dc40 | |||
| aa2e60900e | |||
| 376515093d | |||
| 87f7e3e8ba | |||
| d9df5e2567 | |||
| ccb28adcc4 | |||
| 3c1ec87255 | |||
| 75fbadd7d3 | |||
| ed94116c4d | |||
| 840499b504 | |||
| ecded17017 |
@@ -13,25 +13,71 @@ 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: Run eslint
|
||||||
|
run: npm run lint
|
||||||
|
- name: Enable Developer Command Prompt (amd64)
|
||||||
uses: ./
|
uses: ./
|
||||||
- name: Compile and run some C code
|
with:
|
||||||
|
arch: amd64
|
||||||
|
- name: Compile and run some C code (amd64)
|
||||||
shell: cmd
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
cl.exe hello.c
|
cl.exe hello.c
|
||||||
hello.exe
|
hello.exe
|
||||||
|
- name: Enable Developer Command Prompt (amd64_x86)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
arch: amd64_x86
|
||||||
|
- name: Compile and run some C code (x86)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cl.exe hello.c
|
||||||
|
hello.exe
|
||||||
|
- name: Enable Developer Command Prompt (amd64_arm)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
arch: amd64_arm
|
||||||
|
- name: Compile some C code (arm)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cl.exe hello.c
|
||||||
|
dumpbin /headers hello.exe
|
||||||
|
- name: Enable Developer Command Prompt (amd64_arm64)
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
arch: amd64_arm64
|
||||||
|
- name: Compile some C code (arm64)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cl.exe hello.c
|
||||||
|
dumpbin /headers hello.exe
|
||||||
audit:
|
audit:
|
||||||
name: npm audit
|
name: npm audit
|
||||||
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
|
||||||
|
|||||||
@@ -8,12 +8,57 @@ This sets up the environment for compiling C/C++ code from command line.
|
|||||||
|
|
||||||
Supports Windows. Does nothing on Linux and macOS.
|
Supports Windows. Does nothing on Linux and macOS.
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
Basic usage for default compilation settings is like this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
- name: Build something requiring CL.EXE
|
||||||
|
run: |
|
||||||
|
cmake -G "NMake Makefiles" .
|
||||||
|
nmake
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want something non-default,
|
||||||
|
like using a specific version of Visual Studio,
|
||||||
|
or cross-compling for a differen target,
|
||||||
|
you will need to configure those settings via inputs:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
# Run a job for each of the specified target architectures:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- amd64
|
||||||
|
- amd64_x86
|
||||||
|
- amd64_arm64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
|
arch: ${{ matrix.arch }}
|
||||||
|
- name: Build something requiring CL.EXE
|
||||||
|
run: |
|
||||||
|
cmake -G "NMake Makefiles" .
|
||||||
|
nmake
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
- `arch` – target architecture
|
- `arch` – target architecture
|
||||||
- native compilation: `x86`, `x64` (default), `amd64` (synonym for x64)
|
- native compilation:
|
||||||
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
|
- `x64` (default) or its synonyms: `amd64`, `win64`, `x86_64`
|
||||||
`amd64_x86`, `amd64_arm`, `amd64_arm64`
|
- `x86` or its synonyms: `win32`
|
||||||
|
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64_x86`, `amd64_arm`, `amd64_arm64`
|
||||||
- `sdk` – Windows SDK to use
|
- `sdk` – Windows SDK to use
|
||||||
- do not specify to use the default SDK
|
- do not specify to use the default SDK
|
||||||
- or specify full Windows 10 SDK number (e.g, `10.0.10240.0`)
|
- or specify full Windows 10 SDK number (e.g, `10.0.10240.0`)
|
||||||
@@ -26,20 +71,64 @@ Supports Windows. Does nothing on Linux and macOS.
|
|||||||
- `uwp` – set `true` to build for Universal Windows Platform (i.e., for Windows Store)
|
- `uwp` – set `true` to build for Universal Windows Platform (i.e., for Windows Store)
|
||||||
- `spectre` – set `true` to use Visual Studio libraries with [Spectre](https://meltdownattack.com) mitigations
|
- `spectre` – set `true` to use Visual Studio libraries with [Spectre](https://meltdownattack.com) mitigations
|
||||||
|
|
||||||
## Example usage
|
## Caveats
|
||||||
|
|
||||||
|
### Name conflicts with `shell: bash`
|
||||||
|
|
||||||
|
Using `shell: bash` in Actions may shadow some of the paths added by MSVC.
|
||||||
|
In particular, `link.exe` (Microsoft C linker) is prone to be shadowed by `/usr/bin/link` (GNU filesystem link tool).
|
||||||
|
|
||||||
|
Unfortunately, this happens because GitHub Actions unconditionally *prepend* GNU paths when `shell: bash` is used,
|
||||||
|
on top of any paths set by `msvc-dev-cmd`, every time at the start of each new step.
|
||||||
|
Hence, there aren't many non-destructive options here.
|
||||||
|
|
||||||
|
If you experience compilation errors where `link` complains about unreasonable command-line arguments,
|
||||||
|
“extra operand *something-something*” – that's probably it.
|
||||||
|
Recommended workaround is to remove `/usr/bin/link` if that interferes with your builds.
|
||||||
|
If this is not acceptable, please file an issue, then we'll figure out something better.
|
||||||
|
|
||||||
|
### Reconfiguration
|
||||||
|
|
||||||
|
You can invoke `ilammy/msvc-dev-cmd` multiple times during your jobs with different inputs
|
||||||
|
to reconfigure the environment for building with different settings
|
||||||
|
(e.g., to target multiple architectures).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
release:
|
||||||
- uses: actions/checkout@v1
|
steps:
|
||||||
- uses: ilammy/msvc-dev-cmd@v1
|
# ...
|
||||||
- name: Build something requiring CL.EXE
|
- name: Configure build for amd64
|
||||||
run: |
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
cmake -G "NMake Makefiles" .
|
with:
|
||||||
nmake
|
arch: amd64
|
||||||
|
|
||||||
|
- run: build # (for amd64)
|
||||||
|
|
||||||
|
- name: Configure build for x86
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
|
arch: amd64_x86
|
||||||
|
|
||||||
|
- run: build # (for x86)
|
||||||
|
|
||||||
|
- name: Configure build for ARM64
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1
|
||||||
|
with:
|
||||||
|
arch: amd64_arm64
|
||||||
|
|
||||||
|
- run: build # (for ARM64)
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This mostly works but it's not really recommended
|
||||||
|
since Developer Command Prompt was not meant for recursive reconfiguration.
|
||||||
|
That said, if it does not work for you, please file an issue.
|
||||||
|
|
||||||
|
Consider using [`strategy.matrix`](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)
|
||||||
|
to execute different build configuration in parallel, independent environments.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT, see [LICENSE](LICENSE).
|
MIT, see [LICENSE](LICENSE).
|
||||||
|
|||||||
@@ -1,78 +1,103 @@
|
|||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const child_process = require('child_process')
|
const child_process = require('child_process')
|
||||||
const exec = require('util').promisify(child_process.exec)
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const process = require('process')
|
const process = require('process')
|
||||||
|
|
||||||
|
const PROGRAM_FILES_X86 = process.env['ProgramFiles(x86)']
|
||||||
|
|
||||||
const EDITIONS = ['Enterprise', 'Professional', 'Community']
|
const EDITIONS = ['Enterprise', 'Professional', 'Community']
|
||||||
const VERSIONS = ['2019', '2017']
|
const VERSIONS = ['2019', '2017']
|
||||||
|
|
||||||
const InterestingVariables = [
|
const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer`
|
||||||
'INCLUDE',
|
|
||||||
'LIB',
|
|
||||||
'LIBPATH',
|
|
||||||
'Path',
|
|
||||||
'Platform',
|
|
||||||
'VisualStudioVersion',
|
|
||||||
/^VCTools/,
|
|
||||||
/^VSCMD_/,
|
|
||||||
/^WindowsSDK/i,
|
|
||||||
]
|
|
||||||
|
|
||||||
function findWithVswhere(pattern) {
|
function findWithVswhere(pattern) {
|
||||||
let path = null;
|
|
||||||
try {
|
try {
|
||||||
path = child_process.execSync(`vswhere -products * -latest -prerelease -find ${pattern}`).toString().trim()
|
let installationPath = child_process.execSync(`vswhere -products * -latest -prerelease -property installationPath`).toString().trim()
|
||||||
|
return installationPath + '\\' + pattern
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
core.warning(`vswhere failed: ${e}`)
|
||||||
}
|
}
|
||||||
return path
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
function findVcvarsall() {
|
function findVcvarsall() {
|
||||||
// use vswhere
|
// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||||
let path = findWithVswhere('**/Auxiliary/Build/vcvarsall.bat')
|
let path = findWithVswhere('VC\\Auxiliary\\Build\\vcvarsall.bat')
|
||||||
if (path && fs.existsSync(path)) {
|
if (path && fs.existsSync(path)) {
|
||||||
|
core.info(`Found with vswhere: ${path}`)
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
core.info("Not found with vswhere")
|
||||||
|
|
||||||
const programFiles = process.env['ProgramFiles(x86)']
|
// If that does not work, try the standard installation locations,
|
||||||
// Given the order of each list it should check
|
// starting with the latest and moving to the oldest.
|
||||||
// for the more recent versions first and the
|
|
||||||
// highest grade edition first.
|
|
||||||
for (const ver of VERSIONS) {
|
for (const ver of VERSIONS) {
|
||||||
for (const ed of EDITIONS) {
|
for (const ed of EDITIONS) {
|
||||||
path = `${programFiles}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
path = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\${ver}\\${ed}\\VC\\Auxiliary\\Build\\vcvarsall.bat`
|
||||||
|
core.info(`Trying standard location: ${path}`)
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
|
core.info(`Found standard location: ${path}`)
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.info("Not found in standard locations")
|
||||||
|
|
||||||
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||||
// us vswhere
|
path = `${PROGRAM_FILES_X86}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
|
||||||
path = findWithVswhere('**/vcbuildtools.bat')
|
|
||||||
if (path && fs.existsSync(path)) {
|
|
||||||
return path
|
|
||||||
}
|
|
||||||
path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
|
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
|
core.info(`Found VS 2015: ${path}`)
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
|
core.info(`Not found in VS 2015 location: ${path}`)
|
||||||
|
|
||||||
throw new Error('Microsoft Visual Studio not found')
|
throw new Error('Microsoft Visual Studio not found')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
function isPathVariable(name) {
|
||||||
|
const pathLikeVariables = ['PATH', 'INCLUDE', 'LIB', 'LIBPATH']
|
||||||
|
return pathLikeVariables.indexOf(name.toUpperCase()) != -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterPathValue(path) {
|
||||||
|
let paths = path.split(';')
|
||||||
|
// Remove duplicates by keeping the first occurance and preserving order.
|
||||||
|
// This keeps path shadowing working as intended.
|
||||||
|
function unique(value, index, self) {
|
||||||
|
return self.indexOf(value) === index
|
||||||
|
}
|
||||||
|
return paths.filter(unique).join(';')
|
||||||
|
}
|
||||||
|
|
||||||
|
function main() {
|
||||||
if (process.platform != 'win32') {
|
if (process.platform != 'win32') {
|
||||||
core.info('This is not a Windows virtual environment, bye!')
|
core.info('This is not a Windows virtual environment, bye!')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const arch = core.getInput('arch')
|
// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||||
|
process.env.PATH += path.delimiter + VSWHERE_PATH
|
||||||
|
|
||||||
|
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",
|
||||||
|
"x86_64": "x64",
|
||||||
|
"x86-64": "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.
|
||||||
|
|
||||||
@@ -90,22 +115,72 @@ async function main() {
|
|||||||
args.push('-vcvars_spectre_libs=spectre')
|
args.push('-vcvars_spectre_libs=spectre')
|
||||||
}
|
}
|
||||||
|
|
||||||
const command = `"${findVcvarsall()}" ${args.join(' ')} && set`
|
const vcvars = `"${findVcvarsall()}" ${args.join(' ')}`
|
||||||
core.debug(`Running: ${command}`)
|
core.debug(`vcvars command-line: ${vcvars}`)
|
||||||
const { stdout } = await exec(command, {shell: "cmd"})
|
|
||||||
const environment = stdout.split('\r\n')
|
|
||||||
|
|
||||||
for (let string of environment) {
|
const cmd_output_string = child_process.execSync(`set && cls && ${vcvars} && cls && set`, {shell: "cmd"}).toString()
|
||||||
|
const cmd_output_parts = cmd_output_string.split('\f')
|
||||||
|
|
||||||
|
const old_environment = cmd_output_parts[0].split('\r\n')
|
||||||
|
const vcvars_output = cmd_output_parts[1].split('\r\n')
|
||||||
|
const new_environment = cmd_output_parts[2].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.
|
||||||
|
const error_messages = vcvars_output.filter((line) => {
|
||||||
|
if (line.match(/^\[ERROR.*\]/)) {
|
||||||
|
// Don't print this particular line which will be confusing in output.
|
||||||
|
if (!line.match(/Error in script usage. The correct usage is:$/)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
if (error_messages.length > 0) {
|
||||||
|
throw new Error('invalid parameters' + '\r\n' + error_messages.join('\r\n'))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert old environment lines into a dictionary for easier lookup.
|
||||||
|
let old_env_vars = {}
|
||||||
|
for (let string of old_environment) {
|
||||||
const [name, value] = string.split('=')
|
const [name, value] = string.split('=')
|
||||||
for (let pattern of InterestingVariables) {
|
old_env_vars[name] = value
|
||||||
if (name.match(pattern)) {
|
}
|
||||||
core.exportVariable(name, value)
|
|
||||||
break
|
// Now look at the new environment and export everything that changed.
|
||||||
}
|
// These are the variables set by vsvars.bat. Also export everything
|
||||||
|
// that was not there during the first sweep: those are new variables.
|
||||||
|
core.startGroup('Environment variables')
|
||||||
|
for (let string of new_environment) {
|
||||||
|
// vsvars.bat likes to print some fluff at the beginning.
|
||||||
|
// Skip lines that don't look like environment variables.
|
||||||
|
if (!string.includes('=')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let [name, new_value] = string.split('=')
|
||||||
|
let old_value = old_env_vars[name]
|
||||||
|
// For new variables "old_value === undefined".
|
||||||
|
if (new_value !== old_value) {
|
||||||
|
core.info(`Setting ${name}`)
|
||||||
|
// Special case for a bunch of PATH-like variables: vcvarsall.bat
|
||||||
|
// just prepends its stuff without checking if its already there.
|
||||||
|
// This makes repeated invocations of this action fail after some
|
||||||
|
// point, when the environment variable overflows. Avoid that.
|
||||||
|
if (isPathVariable(name)) {
|
||||||
|
new_value = filterPathValue(new_value)
|
||||||
|
}
|
||||||
|
core.exportVariable(name, new_value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
core.info(`Configured Developer Command Prompt`)
|
core.info(`Configured Developer Command Prompt`)
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((e) => core.setFailed('Could not setup Developer Command Prompt: ' + e.message))
|
try {
|
||||||
|
main()
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
core.setFailed('Could not setup Developer Command Prompt: ' + e.message)
|
||||||
|
}
|
||||||
|
|||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "msvc-dev-cmd",
|
||||||
|
"version": "1.9.0",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"node_modules/@actions/core": {
|
||||||
|
"version": "1.2.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||||
|
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
+1
@@ -89,6 +89,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
|
core.info('Output to the actions build log')
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
|
|||||||
-5
@@ -13,9 +13,4 @@ interface CommandProperties {
|
|||||||
*/
|
*/
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||||
export declare function issue(name: string, message?: string): void;
|
export declare function issue(name: string, message?: string): void;
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
export declare function toCommandValue(input: any): string;
|
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
+3
-16
@@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
@@ -61,28 +62,14 @@ class Command {
|
|||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
function toCommandValue(input) {
|
|
||||||
if (input === null || input === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
|
||||||
exports.toCommandValue = toCommandValue;
|
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A');
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
function escapeProperty(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAWxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,O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SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||||
+17
-1
@@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = require("./command");
|
const command_1 = require("./command");
|
||||||
|
const file_command_1 = require("./file-command");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
const os = __importStar(require("os"));
|
const os = __importStar(require("os"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
/**
|
/**
|
||||||
@@ -43,9 +45,17 @@ var ExitCode;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function exportVariable(name, val) {
|
function exportVariable(name, val) {
|
||||||
const convertedVal = command_1.toCommandValue(val);
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +71,13 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6D;AAE7D,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,wBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAChC,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;AAC/C,CAAC;AAJD,wCAIC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAA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AAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export declare function issueCommand(command: string, message: any): void;
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
"use strict";
|
||||||
|
// For internal use, subject to change.
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(require("fs"));
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
export declare function toCommandValue(input: any): string;
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
"use strict";
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
function toCommandValue(input) {
|
||||||
|
if (input === null || input === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
else if (typeof input === 'string' || input instanceof String) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return JSON.stringify(input);
|
||||||
|
}
|
||||||
|
exports.toCommandValue = toCommandValue;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
||||||
+20
-16
@@ -1,33 +1,36 @@
|
|||||||
{
|
{
|
||||||
"_from": "@actions/core@^1.2",
|
"_args": [
|
||||||
"_id": "@actions/core@1.2.4",
|
[
|
||||||
|
"@actions/core@1.2.6",
|
||||||
|
"/Users/ilammy/Documents/dev/ilammy/msvc-dev-cmd"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"_from": "@actions/core@1.2.6",
|
||||||
|
"_id": "@actions/core@1.2.6",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==",
|
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
|
||||||
"_location": "/@actions/core",
|
"_location": "/@actions/core",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "range",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@actions/core@^1.2",
|
"raw": "@actions/core@1.2.6",
|
||||||
"name": "@actions/core",
|
"name": "@actions/core",
|
||||||
"escapedName": "@actions%2fcore",
|
"escapedName": "@actions%2fcore",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "^1.2",
|
"rawSpec": "1.2.6",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "^1.2"
|
"fetchSpec": "1.2.6"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/"
|
"/"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||||
"_shasum": "96179dbf9f8d951dd74b40a0dbd5c22555d186ab",
|
"_spec": "1.2.6",
|
||||||
"_spec": "@actions/core@^1.2",
|
|
||||||
"_where": "/Users/ilammy/Documents/dev/ilammy/msvc-dev-cmd",
|
"_where": "/Users/ilammy/Documents/dev/ilammy/msvc-dev-cmd",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
},
|
},
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions core lib",
|
"description": "Actions core lib",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^12.0.2"
|
"@types/node": "^12.0.2"
|
||||||
@@ -37,9 +40,10 @@
|
|||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
"actions",
|
"actions",
|
||||||
@@ -57,10 +61,10 @@
|
|||||||
"directory": "packages/core"
|
"directory": "packages/core"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"types": "lib/core.d.ts",
|
"types": "lib/core.d.ts",
|
||||||
"version": "1.2.4"
|
"version": "1.2.6"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+1335
-157
File diff suppressed because it is too large
Load Diff
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "msvc-dev-cmd",
|
"name": "msvc-dev-cmd",
|
||||||
"version": "1.3.0",
|
"version": "1.9.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": {
|
||||||
"lint": "eslint index.js",
|
"lint": "eslint index.js"
|
||||||
"test": "eslint index.js"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
Reference in New Issue
Block a user