Compare commits

...

28 Commits

Author SHA1 Message Date
Alexei Lozovsky 7defe92547 msvc-dev-cmd v1.9.0 2021-05-29 22:45:09 +09:00
Alexei Lozovsky e78ece9a2a Add "x86_64" and "x86-64" aliases for "x64" (#44)
By a popular request...
2021-05-29 16:43:24 +03:00
Alexei Lozovsky 62f16bb530 msvc-dev-cmv v1.8.1
Also updating and adding whatever the new version of npm wants to be
updated and added in its package files. This should not affect the
behavior of the action.
2021-05-26 22:40:20 +09:00
Mozi 985d494a0f Print the error message from conf scripts at once (#41)
Printing them line by line will generate a bunch of error messages on
the summary page of GitHub Actions workflow. I think it's a bit
annoying.

Note that this change will also affect the format of the final output
error message, but no information will be lost.
2021-05-26 16:32:04 +03:00
Mozi c5426bf30a Separate output content from CMD with form feed (#40)
The command "cls" will produce a '\f' (0x0c, page break or form feed)
character.
2021-05-26 14:53:04 +03:00
Mozi 100402d805 Make eslint work in CI (#42) 2021-05-26 14:51:43 +03:00
Alexei Lozovsky 5611a7cba9 msvc-dev-cmd v1.8.0 2021-05-08 18:02:11 +09:00
Alexei Lozovsky 08b850b4d0 Allow repeated invocation (#37)
* Workaround for repeated invocations

As noted in the comment, repeated invocations of this action might have
caused environment variables to overflow. This cute hack avoid this,
allowing to reconfigure environment.

* Note caveats in README

While this approach mostly works, I still have reservations so let's
leave some cautionary notes.

* Test repeated reconfiguration on CI

Well, let's build our "Hello, world!" four times, for four different
architectures, because why not.
2021-05-08 11:54:58 +03:00
Alexei Lozovsky ff72ae9ce3 Update usage examples (#36)
* Use newer actions/checkout@v2 in examples

That's the current version. Even our own build scripts use it.

* Correct actions syntax

By the way, it's been ages since steps get their own section...

* Provide an example with matrix

Finally, have some example to showcase input usage.

* Move inputs after examples

Since they are more useful, put copy-pastable examples first. Then you
can look at all available inputs, now that you know how to use them.
2021-05-08 11:14:35 +03:00
Alexei Lozovsky 18f5f2cef4 Update npm format and resolve advisories (#35)
Just another day in JavaScriptLand: some "HIGH PRIORITY" vulnerability
has been fixed (CVE-2021-23337). Update our package-lock.json version
too because npm wants that.

(cherry picked from commit f5e8657374)

I'm doing this to shut GitHub Actions CI. It might be a good idea to
make a minor release with this as well. We'll see. But CI is going to
use the "release/v1" branch code and "npm audit" will complain.
2021-05-08 16:56:37 +09:00
Alexei Lozovsky f5e8657374 Update npm format and resolve advisories (#35)
Just another day in JavaScriptLand: some "HIGH PRIORITY" vulnerability
has been fixed (CVE-2021-23337). Update our package-lock.json version
too because npm wants that.
2021-05-08 10:51:14 +03:00
Alexei Lozovsky dd5e2fa0a7 Autodetect variables to export (#32)
Instead of using a hardcoded list of variables to export, use a more
smart approach: first inspect the original environment, then look what
variables have changed as a result of "vcvarsall.bat" invocation, and
export all those new values.

Also, log the variables we export to be more debugging-friendly.
2021-03-20 10:49:55 +02:00
Alexei Lozovsky 2962e34b14 Describe conflicts with "shell: bash" (#31) 2021-03-19 14:26:39 +02:00
Alexei Lozovsky d39d8f7626 msvc-dev-cmd v1.7.0 2021-03-17 22:30:38 +09:00
Frederik Seiffert 38903dd110 Export UCRTVersion and UniversalCRTSdkDir (#30)
These are required to build some components from the Swift toolchain.
2021-03-17 15:27:49 +02:00
Alexei Lozovsky 24b406e1cf msvc-dev-cmd v1.6.0 2021-03-07 15:29:22 +09:00
Alexei Lozovsky 6f493f9a67 Architecture aliases: Win32 & Win64 (#29)
By a public request, let's support aliases for architecture parameters.
Treat "arch: Win32" as "x86" and "Win64" as "x64".

Test this on CI just in case x86 breaks or something.
2021-03-07 08:23:48 +02:00
Alexei Lozovsky 754fb4dc40 Detect and report vcvarsall.bat errors (#28)
If the parameters passed to the script are incorrect -- for example,
architecture is set to something the script does not understand --
then the script will print an error message *and* exit successfully
without doing anything useful.

Detect the error messages, forward them to the user, and fail the
action. Hopefully, the information from the script will be enough
to pinpoint the source of the issue.

For example, if the action is run

    with:
      arch: Win32

then the output will be

    Found with vswhere: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat
    Error: [ERROR:vcvarsall.bat] Invalid argument found : Win32
    Error: Could not setup Developer Command Prompt: invalid parameters

which is close enough.
2021-03-07 08:16:28 +02:00
Ewout ter Hoeven aa2e60900e CI: Cleanup, checkout v2 (#24)
- Remove the fail-fast: tag, it's non-functional since a matrix isn't used anymore
- Update to the faster checkout v2
2021-02-01 14:01:31 +02:00
Alexei Lozovsky 376515093d msvc-dev-cmd v1.5.0 2020-12-13 15:07:07 +09:00
Alexei Lozovsky 87f7e3e8ba Async cleanup and improved logging (#21)
* Avoid unnecessary async-await

Since this is basically a linear script, we don't *really* need all this
async fluff, despite Node.js having a predisposition for async calls.
For one, it does not make much sense to immediately await an async call.
There is a synchronous version of exec -- execSync -- for that.

Suggested-by: Amin Yahyaabadi <aminyahyaabadi74@gmail.com>

* Make logging more verbose

Provide more insight in what paths are tried and where we have found
Visual Studio. Use info level so that it's visible without Actions
debugging being enabled. That way the users get to see a bit more
of the decision making process.
2020-12-13 08:03:03 +02:00
Alexei Lozovsky d9df5e2567 Add default vswhere location to PATH (#20)
Instead of checking "vswhere" in PATH and then in the default location
explicitly, just add the default locatio to PATH. That makes a single
attempt sufficient.
2020-12-13 07:49:04 +02:00
Alexei Lozovsky ccb28adcc4 Add node_modules on master with up-to-date deps
GitHub Actions tutorials suggest that you should not commit Node.js crap
onto your master branch, but it's not like this action has a lot of
dependencies, and not being able to test "ilammy/msvc-dev-cmd@master" is
so annoying... Therefore, do

    npm install --only production

and commit the results.
2020-12-11 20:05:07 +09:00
Serge Camille 3c1ec87255 Add VCINSTALLDIR to list of exported variables (#23)
This should allow windeployqt to pick up the exported environment variable.
2020-12-11 14:27:22 +09:00
Nicolas Jarnoux 75fbadd7d3 Check default vswhere location too (#19)
On some self-hosted runners "vswhere" is not available in the PATH.
Add another check in the findWithVswhere() function. It checks the
default installation of vswhere as stated by Microsoft, just in case
it is there but just not in the PATH.

Furthermore, the check refers to non-existent method core.warn()
instead of core.warning(). Use the correct method for reporting.
2020-10-18 13:38:45 +03:00
ilammy ed94116c4d msvc-dev-cmd v1.4.1 2020-10-03 17:54:54 +03:00
Alexei Lozovsky 840499b504 Avoid slow "vswhere" calls (#14)
Recently added Visual Studio location with "vswhere" seems to be very
slow when using "-find" with path patterns. As in, 5 minutes slow.

vswhere does not provide much insight into why this happens, but I guess
that's because filesystem operations (and search in particular) are not
very fast on Windows.

Improve the search performance by combining vswhere with probing. Use
vswhere to locate the installation root, and then probe around for the
batch script we need.

Also, don't use vswhere for Visual Studio 2015 as it does not seem to
work. Rely only on probing here.

And also, add some debug logs so that it's possible to track which path
has been used, if you're interested in it.
2020-10-03 17:51:55 +03:00
dependabot[bot] ecded17017 Bump @actions/core from 1.2.2 to 1.2.6 (#13)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.2 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 22:32:34 +03:00
21 changed files with 1733 additions and 267 deletions
+52 -6
View File
@@ -13,25 +13,71 @@ jobs:
test:
name: default
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Download Internet
run: npm install
- name: Enable Developer Command Prompt
- name: Run eslint
run: npm run lint
- name: Enable Developer Command Prompt (amd64)
uses: ./
- name: Compile and run some C code
with:
arch: amd64
- name: Compile and run some C code (amd64)
shell: cmd
run: |
cl.exe hello.c
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:
name: npm audit
runs-on: windows-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v2
- run: npm install
- 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
+2 -4
View File
@@ -11,13 +11,11 @@ jobs:
test:
name: release
runs-on: windows-latest
strategy:
fail-fast: false
steps:
- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Compile and run some C code
shell: cmd
run: |
@@ -28,5 +26,5 @@ jobs:
runs-on: windows-latest
steps:
- name: Check out source code
uses: actions/checkout@v1
uses: actions/checkout@v2
- run: npm audit --audit-level=moderate
+101 -12
View File
@@ -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.
## 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
- `arch` target architecture
- native compilation: `x86`, `x64` (default), `amd64` (synonym for x64)
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`,
`amd64_x86`, `amd64_arm`, `amd64_arm64`
- native compilation:
- `x64` (default) or its synonyms: `amd64`, `win64`, `x86_64`
- `x86` or its synonyms: `win32`
- cross-compilation: `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64_x86`, `amd64_arm`, `amd64_arm64`
- `sdk` Windows SDK to use
- do not specify to use the default SDK
- 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)
- `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
jobs:
test:
- uses: actions/checkout@v1
- uses: ilammy/msvc-dev-cmd@v1
- name: Build something requiring CL.EXE
run: |
cmake -G "NMake Makefiles" .
nmake
# ...
release:
steps:
# ...
- name: Configure build for amd64
uses: ilammy/msvc-dev-cmd@v1
with:
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
MIT, see [LICENSE](LICENSE).
+117 -42
View File
@@ -1,78 +1,103 @@
const core = require('@actions/core')
const child_process = require('child_process')
const exec = require('util').promisify(child_process.exec)
const fs = require('fs')
const path = require('path')
const process = require('process')
const PROGRAM_FILES_X86 = process.env['ProgramFiles(x86)']
const EDITIONS = ['Enterprise', 'Professional', 'Community']
const VERSIONS = ['2019', '2017']
const InterestingVariables = [
'INCLUDE',
'LIB',
'LIBPATH',
'Path',
'Platform',
'VisualStudioVersion',
/^VCTools/,
/^VSCMD_/,
/^WindowsSDK/i,
]
const VSWHERE_PATH = `${PROGRAM_FILES_X86}\\Microsoft Visual Studio\\Installer`
function findWithVswhere(pattern) {
let path = null;
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) {
console.log(e)
core.warning(`vswhere failed: ${e}`)
}
return path
return null
}
function findVcvarsall() {
// use vswhere
let path = findWithVswhere('**/Auxiliary/Build/vcvarsall.bat')
// If vswhere is available, ask it about the location of the latest Visual Studio.
let path = findWithVswhere('VC\\Auxiliary\\Build\\vcvarsall.bat')
if (path && fs.existsSync(path)) {
core.info(`Found with vswhere: ${path}`)
return path
}
core.info("Not found with vswhere")
const programFiles = process.env['ProgramFiles(x86)']
// Given the order of each list it should check
// for the more recent versions first and the
// highest grade edition first.
// If that does not work, try the standard installation locations,
// starting with the latest and moving to the oldest.
for (const ver of VERSIONS) {
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)) {
core.info(`Found standard location: ${path}`)
return path
}
}
}
core.info("Not found in standard locations")
// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
// us vswhere
path = findWithVswhere('**/vcbuildtools.bat')
if (path && fs.existsSync(path)) {
return path
}
path = `${programFiles}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
path = `${PROGRAM_FILES_X86}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`
if (fs.existsSync(path)) {
core.info(`Found VS 2015: ${path}`)
return path
}
core.info(`Not found in VS 2015 location: ${path}`)
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') {
core.info('This is not a Windows virtual environment, bye!')
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 toolset = core.getInput('toolset')
const uwp = core.getInput('uwp')
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:
// 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')
}
const command = `"${findVcvarsall()}" ${args.join(' ')} && set`
core.debug(`Running: ${command}`)
const { stdout } = await exec(command, {shell: "cmd"})
const environment = stdout.split('\r\n')
const vcvars = `"${findVcvarsall()}" ${args.join(' ')}`
core.debug(`vcvars command-line: ${vcvars}`)
for (let string of environment) {
const [name, value] = string.split('=')
for (let pattern of InterestingVariables) {
if (name.match(pattern)) {
core.exportVariable(name, value)
break
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('=')
old_env_vars[name] = value
}
// 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`)
}
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
View File
@@ -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
View File
@@ -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.
+2 -1
View File
@@ -89,6 +89,7 @@ try {
}
// Do stuff
core.info('Output to the actions build log')
}
catch (err) {
core.error(`Error ${err}, action may still succeed though`);
@@ -143,4 +144,4 @@ const core = require('@actions/core');
var pid = core.getState("pidToKill");
process.kill(pid);
```
```
-5
View File
@@ -13,9 +13,4 @@ interface CommandProperties {
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: any): 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 {};
+3 -16
View File
@@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const os = __importStar(require("os"));
const utils_1 = require("./utils");
/**
* Commands
*
@@ -61,28 +62,14 @@ class Command {
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) {
return toCommandValue(s)
return utils_1.toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
}
function escapeProperty(s) {
return toCommandValue(s)
return utils_1.toCommandValue(s)
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
+1 -1
View File
@@ -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;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ACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;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"}
+19 -3
View File
@@ -17,6 +17,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command");
const file_command_1 = require("./file-command");
const utils_1 = require("./utils");
const os = __importStar(require("os"));
const path = __importStar(require("path"));
/**
@@ -43,9 +45,17 @@ var ExitCode;
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function exportVariable(name, val) {
const convertedVal = command_1.toCommandValue(val);
const convertedVal = utils_1.toCommandValue(val);
process.env[name] = convertedVal;
command_1.issueCommand('set-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);
}
}
exports.exportVariable = exportVariable;
/**
@@ -61,7 +71,13 @@ exports.setSecret = setSecret;
* @param inputPath
*/
function addPath(inputPath) {
command_1.issueCommand('add-path', {}, inputPath);
const filePath = process.env['GITHUB_PATH'] || '';
if (filePath) {
file_command_1.issueCommand('PATH', inputPath);
}
else {
command_1.issueCommand('add-path', {}, inputPath);
}
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
exports.addPath = addPath;
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"core.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,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
View File
@@ -0,0 +1 @@
export declare function issueCommand(command: string, message: any): void;
+29
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -1,33 +1,36 @@
{
"_from": "@actions/core@^1.2",
"_id": "@actions/core@1.2.4",
"_args": [
[
"@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,
"_integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==",
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "range",
"type": "version",
"registry": true,
"raw": "@actions/core@^1.2",
"raw": "@actions/core@1.2.6",
"name": "@actions/core",
"escapedName": "@actions%2fcore",
"scope": "@actions",
"rawSpec": "^1.2",
"rawSpec": "1.2.6",
"saveSpec": null,
"fetchSpec": "^1.2"
"fetchSpec": "1.2.6"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz",
"_shasum": "96179dbf9f8d951dd74b40a0dbd5c22555d186ab",
"_spec": "@actions/core@^1.2",
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"_spec": "1.2.6",
"_where": "/Users/ilammy/Documents/dev/ilammy/msvc-dev-cmd",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Actions core lib",
"devDependencies": {
"@types/node": "^12.0.2"
@@ -37,9 +40,10 @@
"test": "__tests__"
},
"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": [
"github",
"actions",
@@ -57,10 +61,10 @@
"directory": "packages/core"
},
"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",
"tsc": "tsc"
},
"types": "lib/core.d.ts",
"version": "1.2.4"
"version": "1.2.6"
}
+1335 -157
View File
File diff suppressed because it is too large Load Diff
+2 -3
View File
@@ -1,11 +1,10 @@
{
"name": "msvc-dev-cmd",
"version": "1.3.0",
"version": "1.9.0",
"description": "GitHub Action to setup Developer Command Prompt for Microsoft Visual C++",
"main": "index.js",
"scripts": {
"lint": "eslint index.js",
"test": "eslint index.js"
"lint": "eslint index.js"
},
"repository": {
"type": "git",