diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 7cec3345..2ca10cdb 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -18,8 +18,36 @@ jobs: - uses: actions/setup-node@v1 with: node-version: '12.x' - - uses: lukka/get-cmake@v2 + # How to consume GitHub packages, from this message (!): https://github.community/t/download-from-github-package-registry-without-authentication/14407/35 + # Inspired from here: https://github.com/jcansdale-test/npmrc-configurations/blob/master/.github/workflows/blank.yml + - name: Authenticate to GitHub Packages + run: | + echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc + echo "@${{ github.repository_owner }}:registry=https://npm.pkg.github.com/" >> ~/.npmrc - run: | npm install npm run test name: build and test + + + tests: + name: '${{ matrix.os }}: functional tests' + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: checkout this action + uses: actions/checkout@v1 + with: + submodules: true + + - name: basic test for run-cmake + uses: ./ + with: + cmakeGenerator: 'Ninja' + cmakeListsOrSettingsJson: 'CMakeListsTxtBasic' + cmakeListsTxtPath: '${{ github.workspace }}/__tests__/theAssets/CMakeLists.txt' + buildDirectory: '${{ runner.workspace }}/b/ninja/' + diff --git a/.gitignore b/.gitignore index 54b8437a..d19f4550 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,6 @@ token.txt *.tgz build __tests__/build Directory -__tests__/b \ No newline at end of file +__tests__/b +!dist +.npmrc \ No newline at end of file diff --git a/README.md b/README.md index 8109d22e..ba4f2c26 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ It is __highly recommended__ to [use vcpkg as a submodule](https://github.com/lu # Cache/Restore the vcpkg's build artifacts. - name: Run vcpkg - uses: lukka/run-vcpkg@v2 + uses: lukka/run-vcpkg@v4 with: # Response file stored in source control, it provides the list of ports and triplet(s). vcpkgArguments: '@${{ env.vcpkgResponseFile }}' @@ -39,7 +39,7 @@ It is __highly recommended__ to [use vcpkg as a submodule](https://github.com/lu vcpkgDirectory: '${{ github.workspace }}/vcpkg' - name: 'Run CMake with Ninja' - uses: lukka/run-cmake@v2 + uses: lukka/run-cmake@v3 with: cmakeListsOrSettingsJson: CMakeListsTxtAdvanced cmakeListsTxtPath: '${{ github.workspace }}/cmakesettings.json/CMakeLists.txt' diff --git a/__tests__/basic.test.ts b/__tests__/basic.test.ts index 340c6c1a..2ea19a59 100644 --- a/__tests__/basic.test.ts +++ b/__tests__/basic.test.ts @@ -86,6 +86,7 @@ describe('run-cmake tests', () => { test('basic test for CMakeListsTxtAdvanced', () => { process.env.INPUT_CMAKELISTSORSETTINGSJSON = 'CMakeListsTxtAdvanced'; process.env.INPUT_BUILDDIRECTORY = buildDirectory; + process.env.INPUT_CMAKEAPPENDEDARGS = "-GNinja" process.env.INPUT_CMAKELISTSTXTPATH = path.join(assetDirectory, 'CMakeLists.txt'); process.env.INPUT_BUILDWITHCMAKE = 'true'; process.env.INPUT_USESHELL = 'true'; @@ -99,8 +100,9 @@ describe('run-cmake tests', () => { test('basic test for CMakeSettingsJson', () => { process.env.INPUT_CMAKELISTSORSETTINGSJSON = 'CMakeSettingsJson'; process.env.INPUT_BUILDDIRECTORY = buildDirectory; + // Avoid executing tests with VS generators because of: https://github.com/lukka/run-cmake/issues/26 process.platform === "win32" ? - process.env.INPUT_CONFIGURATIONREGEXFILTER = 'x64.*': + process.env.INPUT_CONFIGURATIONREGEXFILTER = 'x64-.*': process.env.INPUT_CONFIGURATIONREGEXFILTER = '.*inux.*'; process.env.INPUT_CMAKESETTINGSJSONPATH = path.join(assetDirectory, 'CMakeSettings.json'); process.env.INPUT_BUILDWITHCMAKE = 'true'; diff --git a/__tests__/theAssets/CMakeSettings.json b/__tests__/theAssets/CMakeSettings.json index ebc0d951..e1afd13a 100644 --- a/__tests__/theAssets/CMakeSettings.json +++ b/__tests__/theAssets/CMakeSettings.json @@ -48,7 +48,7 @@ "ctestCommandArgs": "" }, { - "name": "x64-Release-VS", + "name": "x64VS-Release", "generator": "Visual Studio 16 2019 Win64", "configurationType": "Release", "inheritEnvironments": [ diff --git a/dist/index.js b/dist/index.js index 1686f39b..aecfe31e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1030,7 +1030,106 @@ function wrappy (fn, cb) { /***/ }), -/***/ 35: +/***/ 42: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const merge2 = __webpack_require__(538); +function merge(streams) { + const mergedStream = merge2(streams); + streams.forEach((stream) => { + stream.once('error', (error) => mergedStream.emit('error', error)); + }); + mergedStream.once('close', () => propagateCloseEventToSources(streams)); + mergedStream.once('end', () => propagateCloseEventToSources(streams)); + return mergedStream; +} +exports.merge = merge; +function propagateCloseEventToSources(streams) { + streams.forEach((stream) => stream.emit('close')); +} + + +/***/ }), + +/***/ 43: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +class DirentFromStats { + constructor(name, stats) { + this.name = name; + this.isBlockDevice = stats.isBlockDevice.bind(stats); + this.isCharacterDevice = stats.isCharacterDevice.bind(stats); + this.isDirectory = stats.isDirectory.bind(stats); + this.isFIFO = stats.isFIFO.bind(stats); + this.isFile = stats.isFile.bind(stats); + this.isSocket = stats.isSocket.bind(stats); + this.isSymbolicLink = stats.isSymbolicLink.bind(stats); + } +} +function createDirentFromStats(name, stats) { + return new DirentFromStats(name, stats); +} +exports.createDirentFromStats = createDirentFromStats; + + +/***/ }), + +/***/ 49: +/***/ (function(module, __unusedexports, __webpack_require__) { + +var wrappy = __webpack_require__(11) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} + + +/***/ }), + +/***/ 72: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -1038,6 +1137,25 @@ function wrappy (fn, cb) { // Copyright (c) 2019-2020 Luca Cappa // Released under the term specified in file LICENSE.txt // SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -1048,696 +1166,236 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const baselib = __webpack_require__(42); -const core = __webpack_require__(470); -const toolrunner = __webpack_require__(9); -const ioutil = __webpack_require__(672); -const io = __webpack_require__(1); -const fs = __webpack_require__(747); -const path = __webpack_require__(622); -const cp = __webpack_require__(129); -function escapeCmdCommand(command) { - command = command.trim(); - if (!/^\".*\"$/.test(command)) - command = `\"${command}\"`; - return command; -} -function escapeShArgument(argument) { - // escape all blanks: blank -> \blank - return argument.replace(/ /g, '\\ '); -} -function escapeCmdExeArgument(argument) { - // \" -> \\" - argument = argument.replace(/(\\*)"/g, '$1$1\\"'); - // \$ -> \\$ - argument = argument.replace(/(\\*)$/g, '$1$1'); - // All other backslashes occur literally. - // Quote the whole thing: - argument = `"${argument}"`; - // Prefix with caret ^ any character to be escaped, as in: - // http://www.robvanderwoude.com/escapechars.php - // Do not escape %, let variable be passed in as is. - const metaCharsRegExp = /([()\][!^"`<>&|;, *?])/g; - argument = argument.replace(metaCharsRegExp, '^$1'); - return argument; -} -/** - * Run a command with arguments in a shell. - * Note: -G Ninja or -GNinja? The former works witha shell, the second does not work without a shell. - * e.spawnSync('cmake', ['-GNinja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> Configuring done. - * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Ninja - * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - * e.spawnSync('cmake', ['-GNinja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - * Hence the caller of this function is always using no spaces in between arguments. - * Exception is arbitrary text coming from the user, which will hit this problem when not useing a shell. - * - * Other corner cases: - * e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix - * e.spawnSync('cmake', ['-GUnix\ Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - > e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done - e.spawnSync('cmake', ['-G Unix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix Makefiles - * @static - * @param {string} commandPath - * @param {string[]} args - * @param {baselib.ExecOptions} [execOptions] - * @returns {Promise} - * @memberof ActionLib - */ -function exec(commandPath, args, execOptions) { - var _a, _b, _c, _d, _e, _f, _g; - return __awaiter(this, void 0, void 0, function* () { - core.debug(`exec(${commandPath}, ${JSON.stringify(args)}, {${(_a = execOptions) === null || _a === void 0 ? void 0 : _a.cwd}})<<`); - let useShell = false; - if (process.env.INPUT_USESHELL === 'true') - useShell = true; - else if (process.env.INPUT_USESHELL === 'false') { - useShell = false; - } - else if (process.env.INPUT_USESHELL) { - useShell = process.env.INPUT_USESHELL; - } - const opts = { - shell: useShell, - windowsVerbatimArguments: false, - cwd: (_b = execOptions) === null || _b === void 0 ? void 0 : _b.cwd, - env: (_c = execOptions) === null || _c === void 0 ? void 0 : _c.env, - stdio: "pipe", - }; - let args2 = args; - if ((typeof useShell === 'string' && useShell.includes('cmd')) || - (process.platform === 'win32' && typeof useShell === 'boolean' && useShell === true)) { - args2 = []; - args.map((arg) => args2.push(escapeCmdExeArgument(arg))); - // When using a shell, the command must be enclosed by quotes to handle blanks correctly. - commandPath = escapeCmdCommand(commandPath); - } - else if (((typeof useShell === 'string' && !useShell.includes('cmd')) || - (process.platform !== 'win32' && typeof useShell === 'boolean' && useShell === true))) { - args2 = []; - args.map((arg) => args2.push(escapeShArgument(arg))); - // When using a Unix shell, blanks needs to be escaped in the command as well. - commandPath = escapeShArgument(commandPath); - } - args = args2; - core.debug(`cp.spawn(${commandPath}, ${JSON.stringify(args)}, {cwd=${(_d = opts) === null || _d === void 0 ? void 0 : _d.cwd}, shell=${(_e = opts) === null || _e === void 0 ? void 0 : _e.shell}, path=${JSON.stringify((_g = (_f = opts) === null || _f === void 0 ? void 0 : _f.env) === null || _g === void 0 ? void 0 : _g.PATH)}})`); - return new Promise((resolve, reject) => { - const child = cp.spawn(`${commandPath}`, args, opts); - if (execOptions && child.stdout) { - child.stdout.on('data', (chunk) => { - if (execOptions.listeners && execOptions.listeners.stdout) { - execOptions.listeners.stdout(chunk); - } - process.stdout.write(chunk); - }); +exports.NinjaProvider = void 0; +const path = __importStar(__webpack_require__(622)); +const baselibutils = __importStar(__webpack_require__(758)); +class NinjaProvider { + constructor(baseLib) { + this.baseLib = baseLib; + this.baseUtils = new baselibutils.BaseLibUtils(baseLib); + } + download(url) { + return __awaiter(this, void 0, void 0, function* () { + if (!url) { + if (this.baseUtils.isLinux()) { + url = `${NinjaProvider.baseUrl}/ninja-linux.zip`; + } + else if (this.baseUtils.isDarwin()) { + url = `${NinjaProvider.baseUrl}/ninja-mac.zip`; + } + else if (this.baseUtils.isWin32()) { + url = `${NinjaProvider.baseUrl}/ninja-win.zip`; + } } - if (execOptions && child.stderr) { - child.stderr.on('data', (chunk) => { - if (execOptions.listeners && execOptions.listeners.stderr) { - execOptions.listeners.stderr(chunk); - } - process.stdout.write(chunk); - }); + // Create the name of the executable, i.e. ninja or ninja.exe . + let ninjaExeName = 'ninja'; + if (this.baseUtils.isWin32()) { + ninjaExeName += ".exe"; } - child.on('error', (error) => { - core.warning(`${error}`); - // Wait one second to get still some output. - setTimeout(() => { - reject(error); - child.removeAllListeners(); - }, 1000); - }); - child.on('exit', (exitCode) => { - core.debug(`Exit code '${exitCode}' received from command '${commandPath}'`); - // Do not resolve yet, wait for the close event. - }); - child.on('close', (exitCode) => { - core.debug(`STDIO streams have closed for command '${commandPath}'`); - child.removeAllListeners(); - resolve(exitCode); - }); + const ninjaPath = yield this.baseUtils.downloadArchive(url); + const ninjaFullPath = path.join(ninjaPath, ninjaExeName); + if (this.baseUtils.isLinux() || this.baseUtils.isDarwin()) { + yield this.baseLib.exec('chmod', ['+x', ninjaFullPath]); + } + return ninjaFullPath; }); - }); -} -class ToolRunner { - constructor(path) { - this.path = path; - this.arguments = []; - } - _argStringToArray(text) { - return this.__argStringToArray(text); } - exec(options) { - return exec(this.path, this.arguments, options); + findNinjaTool() { + return __awaiter(this, void 0, void 0, function* () { + const ninjaPath = yield this.baseLib.which('ninja', false); + return ninjaPath; + }); } - line(val) { - this.arguments = this.arguments.concat(toolrunner.argStringToArray(val)); + ; + /** + * Retrieve the path to 'ninja' executable. If the provided path to ninja is no existent + * it will download the ninja archive from the provided one, if the latter not provided from + * the default URL for ths host platform. + * @param {(string | undefined)} ninjaPath Optional path to ninja executable. + * @param {string} ninjaDownloadUrl Optional URL to download ninja from. + * @returns {Promise} The full path to the ninja executable. + * @memberof NinjaDownloader + */ + retrieveNinjaPath(ninjaPath, ninjaDownloadUrl) { + return __awaiter(this, void 0, void 0, function* () { + if (!ninjaPath) { + this.baseLib.debug("Path to ninja executable has not been explicitly specified on the task. Searching for it now..."); + ninjaPath = yield this.findNinjaTool(); + if (!ninjaPath) { + this.baseLib.debug("Cannot find Ninja in PATH environment variable."); + ninjaPath = + yield this.download(ninjaDownloadUrl); + if (!ninjaPath) { + throw new Error("Cannot find nor download Ninja."); + } + } + } + this.baseLib.debug(`Returning ninja at: ${ninjaPath}`); + return ninjaPath; + }); } - arg(val) { - if (val instanceof Array) { - this.arguments = this.arguments.concat(val); - } - else if (typeof (val) === 'string') { - this.arguments = this.arguments.concat(val.trim()); - } - } - execSync(options) { - return __awaiter(this, void 0, void 0, function* () { - let stdout = ""; - let stderr = ""; - let options2; - if (options) { - options2 = this.convertExecOptions(options); - options2.listeners = { - stdout: (data) => { - stdout += data.toString(); - }, - stderr: (data) => { - stderr += data.toString(); - } - }; - } - const exitCode = yield exec(this.path, this.arguments, options2); - const res2 = { - code: exitCode, - stdout: stdout, - stderr: stderr - }; - return Promise.resolve(res2); - }); - } - convertExecOptions(options) { - var _a, _b, _c, _d, _e, _f; - const result = { - cwd: (_a = options.cwd, (_a !== null && _a !== void 0 ? _a : process.cwd())), - env: (_b = options.env, (_b !== null && _b !== void 0 ? _b : process.env)), - silent: (_c = options.silent, (_c !== null && _c !== void 0 ? _c : false)), - failOnStdErr: (_d = options.failOnStdErr, (_d !== null && _d !== void 0 ? _d : false)), - ignoreReturnCode: (_e = options.ignoreReturnCode, (_e !== null && _e !== void 0 ? _e : false)), - windowsVerbatimArguments: (_f = options.windowsVerbatimArguments, (_f !== null && _f !== void 0 ? _f : false)), - listeners: { - stdout: (data) => void { - // Nothing to do. - }, - stderr: (data) => void { - // Nothing to do. - }, - stdline: (data) => void { - // Nothing to do. - }, - errline: (data) => void { - // Nothing to do. - }, - debug: (data) => void { - // Nothing to do. - }, - } - }; - result.outStream = options.outStream || process.stdout; - result.errStream = options.errStream || process.stderr; - return result; - } - __argStringToArray(argString) { - const args = []; - let inQuotes = false; - let escaped = false; - let lastCharWasSpace = true; - let arg = ''; - const append = function (c) { - // we only escape double quotes. - if (escaped && c !== '"') { - arg += '\\'; - } - arg += c; - escaped = false; - }; - for (let i = 0; i < argString.length; i++) { - const c = argString.charAt(i); - if (c === ' ' && !inQuotes) { - if (!lastCharWasSpace) { - args.push(arg); - arg = ''; - } - lastCharWasSpace = true; - continue; - } - else { - lastCharWasSpace = false; - } - if (c === '"') { - if (!escaped) { - inQuotes = !inQuotes; - } - else { - append(c); - } - continue; - } - if (c === "\\" && escaped) { - append(c); - continue; - } - if (c === "\\" && inQuotes) { - escaped = true; - continue; - } - append(c); - lastCharWasSpace = false; - } - if (!lastCharWasSpace) { - args.push(arg.trim()); - } - return args; - } - ; } -exports.ToolRunner = ToolRunner; -class ActionLib { - getInput(name, isRequired) { - const value = core.getInput(name, { required: isRequired }); - this.debug(`getInput(${name}, ${isRequired}) -> '${value}'`); - return value; - } - getBoolInput(name, isRequired) { - var _a; - const value = (_a = core.getInput(name, { required: isRequired }), (_a !== null && _a !== void 0 ? _a : "")).toUpperCase() === "TRUE"; - this.debug(`getBoolInput(${name}, ${isRequired}) -> '${value}'`); - return value; - } - getPathInput(name, isRequired, checkExists) { - const value = path.resolve(core.getInput(name, { required: isRequired })); - this.debug(`getPathInput(${name}) -> '${value}'`); - if (checkExists) { - if (!fs.existsSync(value)) - throw new Error(`input path '${value}' for '${name}' does not exist.`); - } - return value; - } - isFilePathSupplied(name) { - var _a, _b; - // normalize paths - const pathValue = this.resolve((_a = this.getPathInput(name, false, false), (_a !== null && _a !== void 0 ? _a : ''))); - const repoRoot = this.resolve((_b = process.env.GITHUB_WORKSPACE, (_b !== null && _b !== void 0 ? _b : ''))); - const isSupplied = pathValue !== repoRoot; - this.debug(`isFilePathSupplied(s file path=('${name}') -> '${isSupplied}'`); - return isSupplied; - } - getDelimitedInput(name, delim, required) { - const input = core.getInput(name, { required: required }); - const inputs = input.split(delim); - this.debug(`getDelimitedInput(${name}, ${delim}, ${required}) -> '${inputs}'`); - return inputs; - } - // Set an environment variable, re-usable in subsequent actions. - setVariable(name, value) { - core.exportVariable(name, value); - } - // Set the output of the action. - setOutput(name, value) { - core.setOutput(name, value); - } - getVariable(name) { - var _a; - //?? Is it really fine to return an empty string in case of undefined variable? - return _a = process.env[name], (_a !== null && _a !== void 0 ? _a : ""); - } - debug(message) { - core.debug(message); - } - error(message) { - core.error(message); +exports.NinjaProvider = NinjaProvider; +NinjaProvider.baseUrl = 'https://github.com/ninja-build/ninja/releases/download/v1.10.0'; +//# sourceMappingURL=ninja.js.map + +/***/ }), + +/***/ 74: +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +const util = __webpack_require__(669); +const braces = __webpack_require__(783); +const picomatch = __webpack_require__(827); +const utils = __webpack_require__(265); +const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); + +/** + * Returns an array of strings that match one or more glob patterns. + * + * ```js + * const mm = require('micromatch'); + * // mm(list, patterns[, options]); + * + * console.log(mm(['a.js', 'a.txt'], ['*.js'])); + * //=> [ 'a.js' ] + * ``` + * @param {String|Array} list List of strings to match. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} options See available [options](#options) + * @return {Array} Returns an array of matches + * @summary false + * @api public + */ + +const micromatch = (list, patterns, options) => { + patterns = [].concat(patterns); + list = [].concat(list); + + let omit = new Set(); + let keep = new Set(); + let items = new Set(); + let negatives = 0; + + let onResult = state => { + items.add(state.output); + if (options && options.onResult) { + options.onResult(state); } - warning(message) { - core.warning(message); + }; + + for (let i = 0; i < patterns.length; i++) { + let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); + let negated = isMatch.state.negated || isMatch.state.negatedExtglob; + if (negated) negatives++; + + for (let item of list) { + let matched = isMatch(item, true); + + let match = negated ? !matched.isMatch : matched.isMatch; + if (!match) continue; + + if (negated) { + omit.add(matched.output); + } else { + omit.delete(matched.output); + keep.add(matched.output); + } } - tool(name) { - return new ToolRunner(name); + } + + let result = negatives === patterns.length ? [...items] : [...keep]; + let matches = result.filter(item => !omit.has(item)); + + if (options && matches.length === 0) { + if (options.failglob === true) { + throw new Error(`No matches found for "${patterns.join(', ')}"`); } - exec(path, args, options) { - return __awaiter(this, void 0, void 0, function* () { - return yield exec(path, args, options); - }); + + if (options.nonull === true || options.nullglob === true) { + return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; } - execSync(path, args, options) { - return __awaiter(this, void 0, void 0, function* () { - const exitCode = yield exec(`"${path}"`, args, options); - const res2 = { - code: exitCode, - stdout: "", - stderr: "" - }; - return Promise.resolve(res2); - }); - } - which(name, required) { - return __awaiter(this, void 0, void 0, function* () { - core.debug(`"which(${name})<<`); - const filePath = yield io.which(name, required); - console.log(`tool: ${filePath}`); - core.debug(`"which(${name}) >> ${filePath}`); - return filePath; - }); - } - rmRF(path) { - return __awaiter(this, void 0, void 0, function* () { - yield io.rmRF(path); - }); - } - mkdirP(path) { - return __awaiter(this, void 0, void 0, function* () { - yield io.mkdirP(path); - }); - } - cd(path) { - process.chdir(path); - } - writeFile(path, content) { - fs.writeFileSync(path, content); - } - resolve(apath) { - core.debug(`"resolve(${apath})<<`); - const resolvedPath = path.resolve(apath); - core.debug(`"resolve(${apath})>> '${resolvedPath})'`); - return resolvedPath; - } - stats(path) { - return fs.statSync(path); - } - exist(path) { - return ioutil.exists(path); - } - getBinDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE is not set."); - } - const binPath = baselib.normalizePath(path.resolve(path.join(process.env.GITHUB_WORKSPACE, "../b/"))); - if (!fs.existsSync(binPath)) { - core.debug(`BinDir '${binPath}' does not exists, creating it...`); - fs.mkdirSync(binPath); - } - return binPath; - } - getSrcDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE env var is not set."); - } - const srcPath = baselib.normalizePath(path.resolve(process.env.GITHUB_WORKSPACE)); - if (!fs.existsSync(srcPath)) { - throw new Error(`SourceDir '${srcPath}' does not exists.`); - } - return srcPath; - } - getArtifactsDir() { - if (!process.env.GITHUB_WORKSPACE) { - throw new Error("GITHUB_WORKSPACE is not set."); - } - //?? HACK. How to get the value of '{{ runner.temp }}' in JS's action? - const artifactsPath = baselib.normalizePath(path.resolve(path.join(process.env.GITHUB_WORKSPACE, "../../_temp"))); - if (!fs.existsSync(artifactsPath)) { - core.debug(`ArtifactsDir '${artifactsPath}' does not exists, creating it...`); - fs.mkdirSync(artifactsPath); - } - return artifactsPath; - } - beginOperation(message) { - core.startGroup(message); - } - endOperation() { - core.endGroup(); - } - addMatcher(file) { - console.log(`::add-matcher::${file}`); - } - removeMatcher(file) { - console.log(`::remove-matcher::${file}`); - } -} -exports.ActionLib = ActionLib; - -//# sourceMappingURL=action-lib.js.map - + } -/***/ }), + return matches; +}; -/***/ 42: -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/** + * Backwards compatibility + */ -"use strict"; +micromatch.match = micromatch; -// Copyright (c) 2019-2020 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); /** - * Normalize a filesystem path with path.normalize(), then remove any trailing space. + * Returns a matcher function from the given glob `pattern` and `options`. + * The returned function takes a string to match as its only argument and returns + * true if the string is a match. * - * @export - * @param {string} aPath The string representing a filesystem path. - * @returns {string} The normalizeed path without trailing slash. + * ```js + * const mm = require('micromatch'); + * // mm.matcher(pattern[, options]); + * + * const isMatch = mm.matcher('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @param {String} `pattern` Glob pattern + * @param {Object} `options` + * @return {Function} Returns a matcher function. + * @api public */ -function normalizePath(aPath) { - aPath = path.normalize(aPath); - if (/[\\\/]$/.test(aPath)) - aPath = aPath.slice(0, -1); - return aPath; -} -exports.normalizePath = normalizePath; - -//# sourceMappingURL=base-lib.js.map - - -/***/ }), - -/***/ 43: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -class DirentFromStats { - constructor(name, stats) { - this.name = name; - this.isBlockDevice = stats.isBlockDevice.bind(stats); - this.isCharacterDevice = stats.isCharacterDevice.bind(stats); - this.isDirectory = stats.isDirectory.bind(stats); - this.isFIFO = stats.isFIFO.bind(stats); - this.isFile = stats.isFile.bind(stats); - this.isSocket = stats.isSocket.bind(stats); - this.isSymbolicLink = stats.isSymbolicLink.bind(stats); - } -} -function createDirentFromStats(name, stats) { - return new DirentFromStats(name, stats); -} -exports.createDirentFromStats = createDirentFromStats; - - -/***/ }), - -/***/ 49: -/***/ (function(module, __unusedexports, __webpack_require__) { - -var wrappy = __webpack_require__(11) -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) - - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) - } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f -} - -/***/ }), +micromatch.matcher = (pattern, options) => picomatch(pattern, options); -/***/ 74: -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const mm = require('micromatch'); + * // mm.isMatch(string, patterns[, options]); + * + * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(mm.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ -"use strict"; +micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); +/** + * Backwards compatibility + */ -const util = __webpack_require__(669); -const braces = __webpack_require__(783); -const picomatch = __webpack_require__(827); -const utils = __webpack_require__(265); -const isEmptyString = val => typeof val === 'string' && (val === '' || val === './'); +micromatch.any = micromatch.isMatch; /** - * Returns an array of strings that match one or more glob patterns. + * Returns a list of strings that _**do not match any**_ of the given `patterns`. * * ```js * const mm = require('micromatch'); - * // mm(list, patterns[, options]); + * // mm.not(list, patterns[, options]); * - * console.log(mm(['a.js', 'a.txt'], ['*.js'])); - * //=> [ 'a.js' ] + * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); + * //=> ['b.b', 'c.c'] * ``` - * @param {String|Array} list List of strings to match. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} options See available [options](#options) - * @return {Array} Returns an array of matches - * @summary false + * @param {Array} `list` Array of strings to match. + * @param {String|Array} `patterns` One or more glob pattern to use for matching. + * @param {Object} `options` See available [options](#options) for changing how matches are performed + * @return {Array} Returns an array of strings that **do not match** the given patterns. * @api public */ -const micromatch = (list, patterns, options) => { - patterns = [].concat(patterns); - list = [].concat(list); - - let omit = new Set(); - let keep = new Set(); - let items = new Set(); - let negatives = 0; - - let onResult = state => { - items.add(state.output); - if (options && options.onResult) { - options.onResult(state); - } - }; - - for (let i = 0; i < patterns.length; i++) { - let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); - let negated = isMatch.state.negated || isMatch.state.negatedExtglob; - if (negated) negatives++; - - for (let item of list) { - let matched = isMatch(item, true); - - let match = negated ? !matched.isMatch : matched.isMatch; - if (!match) continue; - - if (negated) { - omit.add(matched.output); - } else { - omit.delete(matched.output); - keep.add(matched.output); - } - } - } - - let result = negatives === patterns.length ? [...items] : [...keep]; - let matches = result.filter(item => !omit.has(item)); - - if (options && matches.length === 0) { - if (options.failglob === true) { - throw new Error(`No matches found for "${patterns.join(', ')}"`); - } - - if (options.nonull === true || options.nullglob === true) { - return options.unescape ? patterns.map(p => p.replace(/\\/g, '')) : patterns; - } - } - - return matches; -}; - -/** - * Backwards compatibility - */ - -micromatch.match = micromatch; - -/** - * Returns a matcher function from the given glob `pattern` and `options`. - * The returned function takes a string to match as its only argument and returns - * true if the string is a match. - * - * ```js - * const mm = require('micromatch'); - * // mm.matcher(pattern[, options]); - * - * const isMatch = mm.matcher('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @param {String} `pattern` Glob pattern - * @param {Object} `options` - * @return {Function} Returns a matcher function. - * @api public - */ - -micromatch.matcher = (pattern, options) => picomatch(pattern, options); - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const mm = require('micromatch'); - * // mm.isMatch(string, patterns[, options]); - * - * console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(mm.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Backwards compatibility - */ - -micromatch.any = micromatch.isMatch; - -/** - * Returns a list of strings that _**do not match any**_ of the given `patterns`. - * - * ```js - * const mm = require('micromatch'); - * // mm.not(list, patterns[, options]); - * - * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a')); - * //=> ['b.b', 'c.c'] - * ``` - * @param {Array} `list` Array of strings to match. - * @param {String|Array} `patterns` One or more glob pattern to use for matching. - * @param {Object} `options` See available [options](#options) for changing how matches are performed - * @return {Array} Returns an array of strings that **do not match** the given patterns. - * @api public - */ - -micromatch.not = (list, patterns, options = {}) => { - patterns = [].concat(patterns).map(String); - let result = new Set(); - let items = []; +micromatch.not = (list, patterns, options = {}) => { + patterns = [].concat(patterns).map(String); + let result = new Set(); + let items = []; let onResult = state => { if (options.onResult) options.onResult(state); @@ -3573,91 +3231,6 @@ exports.realpath = function realpath(p, cache, cb) { module.exports = require("child_process"); -/***/ }), - -/***/ 141: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -// Copyright (c) 2019-2020 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const utils = __webpack_require__(477); -function findNinjaTool() { - return __awaiter(this, void 0, void 0, function* () { - const ninjaPath = yield utils.getBaseLib().which('ninja', false); - return ninjaPath; - }); -} -exports.findNinjaTool = findNinjaTool; -; -class NinjaDownloader { - static download(url) { - return __awaiter(this, void 0, void 0, function* () { - let ninjaPath = ''; - if (!url) { - if (utils.isLinux()) { - url = `${NinjaDownloader.baseUrl}/ninja-linux.zip`; - } - else if (utils.isDarwin()) { - url = `${NinjaDownloader.baseUrl}/ninja-mac.zip`; - } - else if (utils.isWin32()) { - url = `${NinjaDownloader.baseUrl}/ninja-win.zip`; - } - } - // Create the name of the executable, i.e. ninja or ninja.exe . - let ninjaExeName = 'ninja'; - if (utils.isWin32()) { - ninjaExeName += ".exe"; - } - ninjaPath = yield utils.Downloader.downloadArchive(url); - ninjaPath = path.join(ninjaPath, ninjaExeName); - if (utils.isLinux() || utils.isDarwin()) { - yield utils.getBaseLib().exec('chmod', ['+x', ninjaPath]); - } - return `${ninjaPath}`; - }); - } -} -exports.NinjaDownloader = NinjaDownloader; -NinjaDownloader.baseUrl = 'https://github.com/ninja-build/ninja/releases/download/v1.10.0'; -function retrieveNinjaPath(ninjaPath, ninjaDownloadUrl) { - return __awaiter(this, void 0, void 0, function* () { - const baseLib = utils.getBaseLib(); - if (!ninjaPath) { - baseLib.debug("Path to ninja executable has not been explicitly specified on the task. Searching for it now..."); - ninjaPath = yield findNinjaTool(); - if (!ninjaPath) { - baseLib.debug("Cannot find Ninja in PATH environment variable."); - ninjaPath = - yield NinjaDownloader.download(ninjaDownloadUrl); - if (!ninjaPath) { - throw new Error("Cannot find nor download Ninja."); - } - } - } - baseLib.debug(`Returning ninja at: ${ninjaPath}`); - return ninjaPath; - }); -} -exports.retrieveNinjaPath = retrieveNinjaPath; - -//# sourceMappingURL=ninja.js.map - - /***/ }), /***/ 143: @@ -3737,87 +3310,6 @@ function readdir(directory, settings) { exports.readdir = readdir; -/***/ }), - -/***/ 159: -/***/ (function(module) { - -"use strict"; - -const singleComment = Symbol('singleComment'); -const multiComment = Symbol('multiComment'); -const stripWithoutWhitespace = () => ''; -const stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, ' '); - -const isEscaped = (jsonString, quotePosition) => { - let index = quotePosition - 1; - let backslashCount = 0; - - while (jsonString[index] === '\\') { - index -= 1; - backslashCount += 1; - } - - return Boolean(backslashCount % 2); -}; - -module.exports = (jsonString, options = {}) => { - const strip = options.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; - - let insideString = false; - let insideComment = false; - let offset = 0; - let result = ''; - - for (let i = 0; i < jsonString.length; i++) { - const currentCharacter = jsonString[i]; - const nextCharacter = jsonString[i + 1]; - - if (!insideComment && currentCharacter === '"') { - const escaped = isEscaped(jsonString, i); - if (!escaped) { - insideString = !insideString; - } - } - - if (insideString) { - continue; - } - - if (!insideComment && currentCharacter + nextCharacter === '//') { - result += jsonString.slice(offset, i); - offset = i; - insideComment = singleComment; - i++; - } else if (insideComment === singleComment && currentCharacter + nextCharacter === '\r\n') { - i++; - insideComment = false; - result += strip(jsonString, offset, i); - offset = i; - continue; - } else if (insideComment === singleComment && currentCharacter === '\n') { - insideComment = false; - result += strip(jsonString, offset, i); - offset = i; - } else if (!insideComment && currentCharacter + nextCharacter === '/*') { - result += jsonString.slice(offset, i); - offset = i; - insideComment = multiComment; - i++; - continue; - } else if (insideComment === multiComment && currentCharacter + nextCharacter === '*/') { - i++; - insideComment = false; - result += strip(jsonString, offset, i + 1); - offset = i + 1; - continue; - } - } - - return result + (insideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset)); -}; - - /***/ }), /***/ 162: @@ -4270,20 +3762,368 @@ module.exports = require("https"); /***/ }), -/***/ 225: -/***/ (function(__unusedmodule, exports) { +/***/ 214: +/***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; - -exports.isInteger = num => { - if (typeof num === 'number') { - return Number.isInteger(num); - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isInteger(Number(num)); - } - return false; +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CMakeRunner = void 0; +const baseutillib = __importStar(__webpack_require__(758)); +const path = __importStar(__webpack_require__(622)); +const cmakesettings_runner_1 = __webpack_require__(454); +const cmakeglobals = __importStar(__webpack_require__(330)); +const ninjalib = __importStar(__webpack_require__(72)); +const using_statement_1 = __webpack_require__(443); +const cmakelib = __importStar(__webpack_require__(233)); +var RunCMakeModeType; +(function (RunCMakeModeType) { + RunCMakeModeType[RunCMakeModeType["CMakeListsTxtBasic"] = 1] = "CMakeListsTxtBasic"; + RunCMakeModeType[RunCMakeModeType["CMakeListsTxtAdvanced"] = 2] = "CMakeListsTxtAdvanced"; + RunCMakeModeType[RunCMakeModeType["CMakeSettingsJson"] = 3] = "CMakeSettingsJson"; +})(RunCMakeModeType || (RunCMakeModeType = {})); +function getTargetType(typeString) { + return RunCMakeModeType[typeString]; +} +const CMakeGenerator = { + 'Unknown': {}, + 'VS16Arm': { 'G': 'Visual Studio 16 2019', 'A': 'ARM', 'MultiConfiguration': true }, + 'VS16Win32': { 'G': 'Visual Studio 16 2019', 'A': 'Win32', 'MultiConfiguration': true }, + 'VS16Win64': { 'G': 'Visual Studio 16 2019', 'A': 'x64', 'MultiConfiguration': true }, + 'VS16Arm64': { 'G': 'Visual Studio 16 2019', 'A': 'ARM64', 'MultiConfiguration': true }, + 'VS15Arm': { 'G': 'Visual Studio 15 2017', 'A': 'ARM', 'MultiConfiguration': true }, + 'VS15Win32': { 'G': 'Visual Studio 15 2017', 'A': 'Win32', 'MultiConfiguration': true }, + 'VS15Win64': { 'G': 'Visual Studio 15 2017', 'A': 'x64', 'MultiConfiguration': true }, + 'VS15Arm64': { 'G': 'Visual Studio 15 2017', 'A': 'ARM64', 'MultiConfiguration': true }, + 'Ninja': { 'G': 'Ninja', 'A': '', 'MultiConfiguration': false }, + 'NinjaMulti': { 'G': 'Ninja Multi-Config', 'A': '', 'MultiConfiguration': true }, + 'UnixMakefiles': { 'G': 'Unix Makefiles', 'A': '', 'MultiConfiguration': false } +}; +function getGenerator(generatorString) { + const generatorName = CMakeGenerator[generatorString]; + return generatorName; +} +class CMakeRunner { + /* + // Unfortunately there is not a way to discriminate between a value provided by the user + // from a default value (not provided by the user), hence it is not possible to identify + // what the user provided. + private static warnIfUnused(inputName: string, taskMode: TaskModeType): void { + if (inputName in CMakeRunner.modePerInput) { + const usedInMode: TaskModeType[] = CMakeRunner.modePerInput[name]; + if (usedInMode) { + if (usedInMode.indexOf(taskMode) < 0) { } + + //??this.tl.warning(`The input '${inputName}' is ignored in mode '${taskMode}'`); + } + } + } + */ + constructor(tl) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + this.tl = tl; + this.buildDir = ""; + this.generator = {}; + this.baseUtils = new baseutillib.BaseLibUtils(this.tl); + this.cmakeUtils = new cmakelib.CMakeUtils(this.baseUtils); + this.ninjaLib = new ninjalib.NinjaProvider(this.tl); + const mode = (_a = this.tl.getInput(cmakeglobals.cmakeListsOrSettingsJson, true)) !== null && _a !== void 0 ? _a : ""; + const runMode = getTargetType(mode); + if (!runMode) { + throw new Error(`ctor(): invalid mode '${mode}'.`); + } + this.runMode = runMode; + let required = this.runMode === RunCMakeModeType.CMakeSettingsJson; + this.cmakeSettingsJsonPath = (_b = this.tl.getPathInput(cmakeglobals.cmakeSettingsJsonPath, required, required)) !== null && _b !== void 0 ? _b : ""; + required = this.runMode !== RunCMakeModeType.CMakeSettingsJson; + this.cmakeListsTxtPath = (_c = this.tl.getPathInput(cmakeglobals.cmakeListsTxtPath, required, required)) !== null && _c !== void 0 ? _c : ""; + this.buildDir = (_d = this.tl.getInput(cmakeglobals.buildDirectory, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _d !== void 0 ? _d : ""; + this.appendedArgs = (_e = this.tl.getInput(cmakeglobals.cmakeAppendedArgs, false)) !== null && _e !== void 0 ? _e : ""; + this.configurationFilter = (_f = this.tl.getInput(cmakeglobals.configurationRegexFilter, false)) !== null && _f !== void 0 ? _f : ""; + this.ninjaPath = ''; + if (this.tl.isFilePathSupplied(cmakeglobals.ninjaPath)) { + this.ninjaPath = (_g = tl.getInput(cmakeglobals.ninjaPath, false)) !== null && _g !== void 0 ? _g : ""; + } + this.cmakeToolchainPath = ""; + if (this.tl.isFilePathSupplied(cmakeglobals.cmakeToolchainPath)) { + this.cmakeToolchainPath = (_h = tl.getInput(cmakeglobals.cmakeToolchainPath, false)) !== null && _h !== void 0 ? _h : ""; + } + const gen = (_j = this.tl.getInput(cmakeglobals.cmakeGenerator, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _j !== void 0 ? _j : ""; + this.generator = getGenerator(gen); + this.ninjaDownloadUrl = (_k = this.tl.getInput(cmakeglobals.ninjaDownloadUrl, false)) !== null && _k !== void 0 ? _k : ""; + this.doBuild = (_l = this.tl.getBoolInput(cmakeglobals.buildWithCMake, false)) !== null && _l !== void 0 ? _l : false; + this.doBuildArgs = (_m = this.tl.getInput(cmakeglobals.buildWithCMakeArgs, false)) !== null && _m !== void 0 ? _m : ""; + this.cmakeSourceDir = path.dirname((_o = baseutillib.BaseLibUtils.normalizePath(this.cmakeListsTxtPath)) !== null && _o !== void 0 ? _o : ""); + this.useVcpkgToolchainFile = (_p = this.tl.getBoolInput(cmakeglobals.useVcpkgToolchainFile, false)) !== null && _p !== void 0 ? _p : false; + this.cmakeBuildType = (_q = this.tl.getInput(cmakeglobals.cmakeBuildType, this.runMode === RunCMakeModeType.CMakeListsTxtBasic)) !== null && _q !== void 0 ? _q : ""; + this.vcpkgTriplet = (_r = (this.tl.getInput(cmakeglobals.cmakeVcpkgTriplet, false) || + process.env.RUNVCPKG_VCPKG_TRIPLET)) !== null && _r !== void 0 ? _r : ""; + this.sourceScript = (_s = this.tl.getInput(cmakeglobals.cmakeWrapperCommand, false)) !== null && _s !== void 0 ? _s : ""; + } + run() { + return __awaiter(this, void 0, void 0, function* () { + this.tl.debug('run()<<'); + yield this.configure(); + this.tl.debug('run()>>'); + }); + } + configure() { + var _a; + return __awaiter(this, void 0, void 0, function* () { + this.tl.debug('configure()<<'); + // Contains the '--config ' when using multiconfiguration generators. + let prependedBuildArguments = ""; + let cmakeArgs = []; + switch (this.runMode) { + case RunCMakeModeType.CMakeListsTxtAdvanced: + case RunCMakeModeType.CMakeListsTxtBasic: { + // Search for CMake tool and run it. + let cmake; + if (this.sourceScript) { + cmake = this.tl.tool(this.sourceScript); + cmakeArgs.push(yield this.tl.which('cmake', true)); + } + else { + cmake = this.tl.tool(yield this.tl.which('cmake', true)); + } + if (this.runMode === RunCMakeModeType.CMakeListsTxtAdvanced) { + // If Ninja is required, specify the path to it. + if (this.baseUtils.isNinjaGenerator([this.appendedArgs])) { + if (!this.baseUtils.isMakeProgram([this.appendedArgs])) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); + } + } + if (this.appendedArgs) { + this.tl.debug(`Parsing additional CMake args: ${this.appendedArgs}`); + const addedArgs = cmake._argStringToArray(this.appendedArgs); + this.tl.debug(`Appending args: ${JSON.stringify(addedArgs)}`); + cmakeArgs = [...cmakeArgs, ...addedArgs]; + } + } + else if (this.runMode === RunCMakeModeType.CMakeListsTxtBasic) { + const generatorName = this.generator['G']; + const generatorArch = this.generator['A']; + const generatorIsMultiConf = (_a = this.generator['MultiConfiguration']) !== null && _a !== void 0 ? _a : false; + cmakeArgs.push(`-G${generatorName}`); + if (generatorArch) { + cmakeArgs.push(`-A${generatorArch}`); + } + if (CMakeRunner.isNinjaGenerator(generatorName)) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); + } + if (this.cmakeToolchainPath) { + cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${this.cmakeToolchainPath}`); + } + // Add CMake's build type, unless a multi configuration generator is being used. + if (!generatorIsMultiConf) { + cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${this.cmakeBuildType}`); + } + prependedBuildArguments = this.prependBuildConfigIfNeeded(this.doBuildArgs, generatorIsMultiConf, this.cmakeBuildType); + } + // Use vcpkg toolchain if requested. + if (this.useVcpkgToolchainFile === true) { + cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.tl); + } + // The source directory is required for any mode. + cmakeArgs.push(this.cmakeSourceDir); + this.tl.debug(`CMake arguments: ${cmakeArgs}`); + for (const arg of cmakeArgs) { + cmake.arg(arg); + } + // Ensure the build directory is existing. + yield this.tl.mkdirP(this.buildDir); + const options = { + cwd: this.buildDir, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env + }; + this.tl.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); + let code = -1; + yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.tl, this.cmakeSourceDir), (matcher) => __awaiter(this, void 0, void 0, function* () { + code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield cmake.exec(options); })); + })); + if (code !== 0) { + throw new Error(`"CMake failed with error code: '${code}'.`); + } + if (this.doBuild) { + yield using_statement_1.using(baseutillib.Matcher.createMatcher(CMakeRunner.getBuildMatcher(this.buildDir, this.tl), this.tl), (matcher) => __awaiter(this, void 0, void 0, function* () { + yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield CMakeRunner.build(this.tl, this.buildDir, prependedBuildArguments + this.doBuildArgs, options); })); + })); + } + break; + } + case RunCMakeModeType.CMakeSettingsJson: { + const cmakeJson = new cmakesettings_runner_1.CMakeSettingsJsonRunner(this.tl, this.cmakeSettingsJsonPath, this.configurationFilter, this.appendedArgs, this.tl.getSrcDir(), this.vcpkgTriplet, this.useVcpkgToolchainFile, this.doBuild, this.ninjaPath, this.ninjaDownloadUrl, this.sourceScript, this.buildDir); + yield this.baseUtils.wrapOp("Run CMake with CMakeSettings.json", () => __awaiter(this, void 0, void 0, function* () { return yield cmakeJson.run(); })); + break; + } + } + }); + } + static isNinjaGenerator(generatorName) { + return generatorName === CMakeGenerator['Ninja']['G'] || + generatorName === CMakeGenerator['NinjaMulti']['G']; + } + /// If not already provided, creates the '--config ' argument to pass when building. + /// Return a string of arguments to prepend the build arguments. + prependBuildConfigIfNeeded(buildArgs, multiConfi, buildType) { + let prependArgs = ""; + if (multiConfi && !buildArgs.includes("--config")) { + prependArgs = ` --config ${buildType} `; + } + return prependArgs; + } + /** + * Build with CMake. + * @export + * @param {string} buildDir + * @param {string} buildArgs + * @param {trm.IExecOptions} options + * @param {string} sourceScript + * @returns {Promise} + */ + static build(baseLib, buildDir, buildArgs, options) { + return __awaiter(this, void 0, void 0, function* () { + // Run CMake with the given arguments + const cmake = baseLib.tool(yield baseLib.which('cmake', true)); + cmake.arg("--build"); + cmake.arg("."); + if (buildArgs) + cmake.line(buildArgs); + // Run the command in the build directory + options.cwd = buildDir; + console.log(`Building with CMake in build directory '${options.cwd}' ...`); + const code = yield cmake.exec(options); + if (code !== 0) { + throw new Error(`"Build failed with error code: '${code}'."`); + } + }); + } + static getDefaultMatcher() { + const plat = process.platform; + return plat === "win32" ? CMakeRunner.msvcMatcher : + plat === "darwin" ? CMakeRunner.clangMatcher : CMakeRunner.gccMatcher; + } + static getCompilerMatcher(line) { + let matcherName = undefined; + if (line.includes('g++') || line.includes('gcc') || line.includes('c++')) + matcherName = CMakeRunner.gccMatcher; + else if (line.includes('cl.exe')) + matcherName = CMakeRunner.msvcMatcher; + else if (line.includes('clang')) + matcherName = CMakeRunner.clangMatcher; + return matcherName; + } + static getBuildMatcher(buildDir, tl) { + var _a; + let cxxMatcher; + let ccMatcher; + const utils = new baseutillib.BaseLibUtils(tl); + try { + const cmakeCacheTxtPath = path.join(buildDir, "CMakeCache.txt"); + const [ok, cacheContent] = utils.readFile(cmakeCacheTxtPath); + tl.debug(`Loaded fileCMakeCache.txt at path='${cmakeCacheTxtPath}'`); + if (ok) { + for (const line of cacheContent.split('\n')) { + tl.debug(`text=${line}`); + if (line.includes("CMAKE_CXX_COMPILER:")) { + tl.debug(`Found CXX compiler: '${line}'.`); + cxxMatcher = CMakeRunner.getCompilerMatcher(line); + tl.debug(`Matcher selected for CXX: ${cxxMatcher}`); + break; + } + if (line.includes("CMAKE_C_COMPILER:")) { + tl.debug(`Found C compiler: '${line}'.`); + ccMatcher = CMakeRunner.getCompilerMatcher(line); + tl.debug(`Matcher selected for CC: ${ccMatcher}`); + break; + } + } + } + } + catch (error) { + tl.debug(error.toString()); + } + const defaultMatcher = CMakeRunner.getDefaultMatcher(); + tl.debug(`Default matcher according to platform is: ${defaultMatcher}`); + const selectedMatcher = (_a = cxxMatcher !== null && cxxMatcher !== void 0 ? cxxMatcher : ccMatcher) !== null && _a !== void 0 ? _a : defaultMatcher; + tl.debug(`Selected matcher: ${selectedMatcher}`); + return selectedMatcher; + } +} +exports.CMakeRunner = CMakeRunner; +CMakeRunner.modePerInput = { + [cmakeglobals.cmakeListsTxtPath]: [RunCMakeModeType.CMakeListsTxtBasic, RunCMakeModeType.CMakeListsTxtAdvanced], + [cmakeglobals.cmakeSettingsJsonPath]: [RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.cmakeToolchainPath]: [RunCMakeModeType.CMakeListsTxtBasic], + /*[globals.useVcpkgToolchainFile]: all */ + /*[globals.vcpkgTriplet]: all */ + [cmakeglobals.cmakeBuildType]: [RunCMakeModeType.CMakeListsTxtBasic], + [cmakeglobals.cmakeGenerator]: [RunCMakeModeType.CMakeListsTxtBasic], + /*[globals.buildDirectory]: all */ + [cmakeglobals.cmakeAppendedArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.configurationRegexFilter]: [RunCMakeModeType.CMakeSettingsJson], + [cmakeglobals.buildWithCMakeArgs]: [RunCMakeModeType.CMakeListsTxtAdvanced, RunCMakeModeType.CMakeListsTxtBasic] +}; +CMakeRunner.gccMatcher = 'gcc'; +CMakeRunner.clangMatcher = 'clang'; +CMakeRunner.msvcMatcher = 'msvc'; +//# sourceMappingURL=cmake-runner.js.map + +/***/ }), + +/***/ 225: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; }; /** @@ -4763,10 +4603,143 @@ function getSettings(settingsOrOptions = {}) { /***/ }), -/***/ 239: -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ 233: +/***/ (function(__unusedmodule, exports, __webpack_require__) { -var Utils = __webpack_require__(643), +"use strict"; + +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CMakeUtils = void 0; +const path = __importStar(__webpack_require__(622)); +const vcpkgGlobals = __importStar(__webpack_require__(946)); +class CMakeUtils { + constructor(baseUtils) { + this.baseUtils = baseUtils; + } + injectEnvVariables(vcpkgRoot, triplet, baseLib) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + if (!vcpkgRoot) { + vcpkgRoot = (_a = process.env[vcpkgGlobals.outVcpkgRootPath]) !== null && _a !== void 0 ? _a : ""; + if (!vcpkgRoot) { + throw new Error(`${vcpkgGlobals.outVcpkgRootPath} environment variable is not set.`); + } + } + // Search for vcpkg tool and run it + let vcpkgPath = path.join(vcpkgRoot, 'vcpkg'); + if (this.baseUtils.isWin32()) { + vcpkgPath += '.exe'; + } + const vcpkg = baseLib.tool(vcpkgPath); + vcpkg.arg("env"); + vcpkg.arg("--bin"); + vcpkg.arg("--include"); + vcpkg.arg("--tools"); + vcpkg.arg("--python"); + vcpkg.line(`--triplet ${triplet} set`); + const options = { + cwd: vcpkgRoot, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env + }; + const output = yield vcpkg.execSync(options); + if (output.code !== 0) { + throw new Error(`${output.stdout}\n\n${output.stderr}`); + } + const map = this.baseUtils.parseVcpkgEnvOutput(output.stdout); + for (const key in map) { + if (this.baseUtils.isVariableStrippingPath(key)) + continue; + if (key.toUpperCase() === "PATH") { + process.env[key] = process.env[key] + path.delimiter + map[key]; + } + else { + process.env[key] = map[key]; + } + baseLib.debug(`set ${key}=${process.env[key]}`); + } + }); + } + injectVcpkgToolchain(args, triplet, baseLib) { + return __awaiter(this, void 0, void 0, function* () { + args = args !== null && args !== void 0 ? args : []; + const vcpkgRoot = process.env[vcpkgGlobals.outVcpkgRootPath]; + // if RUNVCPKG_VCPKG_ROOT is defined, then use it, and put aside into + // VCPKG_CHAINLOAD_TOOLCHAIN_FILE the existing toolchain. + if (vcpkgRoot && vcpkgRoot.length > 1) { + const toolchainFile = this.baseUtils.getToolchainFile(args); + args = this.baseUtils.removeToolchainFile(args); + const vcpkgToolchain = path.join(vcpkgRoot, '/scripts/buildsystems/vcpkg.cmake'); + args.push(`-DCMAKE_TOOLCHAIN_FILE=${vcpkgToolchain}`); + if (toolchainFile) { + args.push(`-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${toolchainFile}`); + } + // If the triplet is provided, specify the same triplet on the cmd line and set the environment for msvc. + if (triplet) { + args.push(`-DVCPKG_TARGET_TRIPLET=${triplet}`); + // For Windows build agents, inject the environment variables used + // for the MSVC compiler using the 'vcpkg env' command. + // This is not be needed for others compiler on Windows, but it should be harmless. + if (this.baseUtils.isWin32() && triplet) { + if (triplet.indexOf("windows") !== -1) { + process.env.CC = "cl.exe"; + process.env.CXX = "cl.exe"; + baseLib.setVariable("CC", "cl.exe"); + baseLib.setVariable("CXX", "cl.exe"); + } + yield this.injectEnvVariables(vcpkgRoot, triplet, baseLib); + } + } + } + return args; + }); + } +} +exports.CMakeUtils = CMakeUtils; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 239: +/***/ (function(module, __unusedexports, __webpack_require__) { + +var Utils = __webpack_require__(643), Constants = Utils.Constants; /* The central directory file header */ @@ -6420,6 +6393,36 @@ function plural(ms, msAbs, n, name) { } +/***/ }), + +/***/ 330: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +Object.defineProperty(exports, "__esModule", { value: true }); +exports.useVcpkgToolchainFile = exports.cmakeWrapperCommand = exports.cmakeVcpkgTriplet = exports.cmakeBuildType = exports.buildWithCMakeArgs = exports.buildWithCMake = exports.cmakeToolchainPath = exports.cmakeGenerator = exports.cmakeListsOrSettingsJson = exports.ninjaDownloadUrl = exports.ninjaPath = exports.configurationRegexFilter = exports.cmakeAppendedArgs = exports.buildDirectory = exports.cmakeListsTxtPath = exports.cmakeSettingsJsonPath = void 0; +exports.cmakeSettingsJsonPath = 'cmakeSettingsJsonPath'; +exports.cmakeListsTxtPath = 'cmakeListsTxtPath'; +exports.buildDirectory = 'buildDirectory'; +exports.cmakeAppendedArgs = 'cmakeAppendedArgs'; +exports.configurationRegexFilter = 'configurationRegexFilter'; +exports.ninjaPath = 'ninjaPath'; +exports.ninjaDownloadUrl = 'ninjaDownloadUrl'; +exports.cmakeListsOrSettingsJson = 'cmakeListsOrSettingsJson'; +exports.cmakeGenerator = 'cmakeGenerator'; +exports.cmakeToolchainPath = 'cmakeToolchainPath'; +exports.buildWithCMake = 'buildWithCMake'; +exports.buildWithCMakeArgs = 'buildWithCMakeArgs'; +exports.cmakeBuildType = 'cmakeBuildType'; +exports.cmakeVcpkgTriplet = 'vcpkgTriplet'; +exports.cmakeWrapperCommand = 'cmakeWrapperCommand'; +exports.useVcpkgToolchainFile = 'useVcpkgToolchainFile'; +//# sourceMappingURL=cmake-globals.js.map + /***/ }), /***/ 332: @@ -6807,39 +6810,6 @@ module.exports = function (/*Buffer*/input) { module.exports = require("assert"); -/***/ }), - -/***/ 358: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -// Copyright (c) 2019-2020 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -Object.defineProperty(exports, "__esModule", { value: true }); -exports.cmakeSettingsJsonPath = 'cmakeSettingsJsonPath'; -exports.cmakeListsTxtPath = 'cmakeListsTxtPath'; -exports.buildDirectory = 'buildDirectory'; -exports.cmakeAppendedArgs = 'cmakeAppendedArgs'; -exports.configurationRegexFilter = 'configurationRegexFilter'; -exports.ninjaPath = 'ninjaPath'; -exports.ninjaDownloadUrl = 'ninjaDownloadUrl'; -exports.cmakeListsOrSettingsJson = 'cmakeListsOrSettingsJson'; -exports.cmakeGenerator = 'cmakeGenerator'; -exports.cmakeToolchainPath = 'cmakeToolchainPath'; -exports.buildWithCMake = 'buildWithCMake'; -exports.buildWithCMakeArgs = 'buildWithCMakeArgs'; -exports.cmakeBuildType = 'cmakeBuildType'; -exports.vcpkgTriplet = 'vcpkgTriplet'; -exports.cmakeWrapperCommand = 'cmakeWrapperCommand'; -exports.useVcpkgToolchainFile = 'useVcpkgToolchainFile'; -exports.outVcpkgRootPath = "RUNVCPKG_VCPKG_ROOT"; -exports.outVcpkgTriplet = "RUNVCPKG_VCPKG_TRIPLET"; - -//# sourceMappingURL=cmake-globals.js.map - - /***/ }), /***/ 364: @@ -8605,755 +8575,1501 @@ Glob.prototype.resume = function () { this._emitMatch(e[0], e[1]) } } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) - } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} + + +/***/ }), + +/***/ 403: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(622); +const fsStat = __webpack_require__(231); +const fs = __webpack_require__(874); +class Settings { + constructor(_options = {}) { + this._options = _options; + this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); + this.fs = fs.createFileSystemAdapter(this._options.fs); + this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); + this.stats = this._getValue(this._options.stats, false); + this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); + this.fsStatSettings = new fsStat.Settings({ + followSymbolicLink: this.followSymbolicLinks, + fs: this.fs, + throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink + }); + } + _getValue(option, value) { + return option === undefined ? value : option; + } +} +exports.default = Settings; + + +/***/ }), + +/***/ 406: +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + +const taskManager = __webpack_require__(384); +const async_1 = __webpack_require__(113); +const stream_1 = __webpack_require__(775); +const sync_1 = __webpack_require__(78); +const settings_1 = __webpack_require__(332); +const utils = __webpack_require__(444); +function FastGlob(source, options) { + try { + assertPatternsInput(source); + } + catch (error) { + return Promise.reject(error); + } + const works = getWorks(source, async_1.default, options); + return Promise.all(works).then(utils.array.flatten); +} +// https://github.com/typescript-eslint/typescript-eslint/issues/60 +// eslint-disable-next-line no-redeclare +(function (FastGlob) { + function sync(source, options) { + assertPatternsInput(source); + const works = getWorks(source, sync_1.default, options); + return utils.array.flatten(works); + } + FastGlob.sync = sync; + function stream(source, options) { + assertPatternsInput(source); + const works = getWorks(source, stream_1.default, options); + /** + * The stream returned by the provider cannot work with an asynchronous iterator. + * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. + * This affects performance (+25%). I don't see best solution right now. + */ + return utils.stream.merge(works); + } + FastGlob.stream = stream; + function generateTasks(source, options) { + assertPatternsInput(source); + const patterns = [].concat(source); + const settings = new settings_1.default(options); + return taskManager.generate(patterns, settings); + } + FastGlob.generateTasks = generateTasks; + function isDynamicPattern(source, options) { + assertPatternsInput(source); + const settings = new settings_1.default(options); + return utils.pattern.isDynamicPattern(source, settings); + } + FastGlob.isDynamicPattern = isDynamicPattern; + function escapePath(source) { + assertPatternsInput(source); + return utils.path.escape(source); + } + FastGlob.escapePath = escapePath; +})(FastGlob || (FastGlob = {})); +function getWorks(source, _Provider, options) { + const patterns = [].concat(source); + const settings = new settings_1.default(options); + const tasks = taskManager.generate(patterns, settings); + const provider = new _Provider(settings); + return tasks.map(provider.read, provider); +} +function assertPatternsInput(source) { + if ([].concat(source).every(isString)) { + return; + } + throw new TypeError('Patterns must be a string or an array of strings'); +} +function isString(source) { + return typeof source === 'string'; +} +module.exports = FastGlob; + + +/***/ }), + +/***/ 411: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ActionLib = exports.ActionToolRunner = void 0; +const utils = __importStar(__webpack_require__(758)); +const core = __importStar(__webpack_require__(470)); +const toolrunner = __importStar(__webpack_require__(9)); +const ioutil = __importStar(__webpack_require__(672)); +const io = __importStar(__webpack_require__(1)); +const fs = __importStar(__webpack_require__(747)); +const path = __importStar(__webpack_require__(622)); +const cp = __importStar(__webpack_require__(129)); +function escapeCmdCommand(command) { + command = command.trim(); + if (!/^\".*\"$/.test(command)) + command = `\"${command}\"`; + return command; +} +function escapeShArgument(argument) { + // escape all blanks: blank -> \blank + return argument.replace(/ /g, '\\ '); +} +function escapeCmdExeArgument(argument) { + // \" -> \\" + argument = argument.replace(/(\\*)"/g, '$1$1\\"'); + // \$ -> \\$ + argument = argument.replace(/(\\*)$/g, '$1$1'); + // All other backslashes occur literally. + // Quote the whole thing: + argument = `"${argument}"`; + // Prefix with caret ^ any character to be escaped, as in: + // http://www.robvanderwoude.com/escapechars.php + // Do not escape %, let variable be passed in as is. + const metaCharsRegExp = /([()\][!^"`<>&|;, *?])/g; + argument = argument.replace(metaCharsRegExp, '^$1'); + return argument; +} +/** + * Run a command with arguments in a shell. + * Note: -G Ninja or -GNinja? The former works witha shell, the second does not work without a shell. + * e.spawnSync('cmake', ['-GNinja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> Configuring done. + * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Ninja + * e.spawnSync('cmake', ['-G Ninja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + * e.spawnSync('cmake', ['-GNinja', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + * Hence the caller of this function is always using no spaces in between arguments. + * Exception is arbitrary text coming from the user, which will hit this problem when not useing a shell. + * + * Other corner cases: + * e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:true, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix + * e.spawnSync('cmake', ['-GUnix\ Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + > e.spawnSync('cmake', ['-GUnix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> -- Configuring done + e.spawnSync('cmake', ['-G Unix Makefiles', '.'], {shell:false, stdio:'inherit', cwd:'/Users/git_repos/cmake-task-tests/'}) -> CMake Error: Could not create named generator Unix Makefiles + * @static + * @param {string} commandPath + * @param {string[]} args + * @param {baselib.ExecOptions} [execOptions] + * @returns {Promise} + * @memberof ActionLib + */ +function exec(commandPath, args, execOptions) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + core.debug(`exec(${commandPath}, ${JSON.stringify(args)}, {${execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd}})<<`); + let useShell = false; + if (process.env.INPUT_USESHELL === 'true') + useShell = true; + else if (process.env.INPUT_USESHELL === 'false') { + useShell = false; + } + else if (process.env.INPUT_USESHELL) { + useShell = process.env.INPUT_USESHELL; + } + const opts = { + shell: useShell, + windowsVerbatimArguments: false, + cwd: execOptions === null || execOptions === void 0 ? void 0 : execOptions.cwd, + env: execOptions === null || execOptions === void 0 ? void 0 : execOptions.env, + stdio: "pipe", + }; + let args2 = args; + if ((typeof useShell === 'string' && useShell.includes('cmd')) || + (process.platform === 'win32' && typeof useShell === 'boolean' && useShell === true)) { + args2 = []; + args.map((arg) => args2.push(escapeCmdExeArgument(arg))); + // When using a shell, the command must be enclosed by quotes to handle blanks correctly. + commandPath = escapeCmdCommand(commandPath); + } + else if (((typeof useShell === 'string' && !useShell.includes('cmd')) || + (process.platform !== 'win32' && typeof useShell === 'boolean' && useShell === true))) { + args2 = []; + args.map((arg) => args2.push(escapeShArgument(arg))); + // When using a Unix shell, blanks needs to be escaped in the command as well. + commandPath = escapeShArgument(commandPath); + } + args = args2; + core.debug(`cp.spawn(${commandPath}, ${JSON.stringify(args)}, {cwd=${opts === null || opts === void 0 ? void 0 : opts.cwd}, shell=${opts === null || opts === void 0 ? void 0 : opts.shell}, path=${JSON.stringify((_a = opts === null || opts === void 0 ? void 0 : opts.env) === null || _a === void 0 ? void 0 : _a.PATH)}})`); + return new Promise((resolve, reject) => { + const child = cp.spawn(`${commandPath}`, args, opts); + if (execOptions && child.stdout) { + child.stdout.on('data', (chunk) => { + if (execOptions.listeners && execOptions.listeners.stdout) { + execOptions.listeners.stdout(chunk); + } + process.stdout.write(chunk); + }); + } + if (execOptions && child.stderr) { + child.stderr.on('data', (chunk) => { + if (execOptions.listeners && execOptions.listeners.stderr) { + execOptions.listeners.stderr(chunk); + } + process.stdout.write(chunk); + }); + } + child.on('error', (error) => { + core.warning(`${error}`); + // Wait one second to get still some output. + setTimeout(() => { + reject(error); + child.removeAllListeners(); + }, 1000); + }); + child.on('exit', (exitCode) => { + core.debug(`Exit code '${exitCode}' received from command '${commandPath}'`); + // Do not resolve yet, wait for the close event. + }); + child.on('close', (exitCode) => { + core.debug(`STDIO streams have closed for command '${commandPath}'`); + child.removeAllListeners(); + resolve(exitCode); + }); + }); + }); +} +class ActionToolRunner { + constructor(path) { + this.path = path; + this.arguments = []; + } + _argStringToArray(text) { + return this.__argStringToArray(text); + } + exec(options) { + return exec(this.path, this.arguments, options); + } + line(val) { + this.arguments = this.arguments.concat(toolrunner.argStringToArray(val)); + } + arg(val) { + if (val instanceof Array) { + this.arguments = this.arguments.concat(val); + } + else if (typeof (val) === 'string') { + this.arguments = this.arguments.concat(val.trim()); + } + } + execSync(options) { + return __awaiter(this, void 0, void 0, function* () { + let stdout = ""; + let stderr = ""; + let options2; + if (options) { + options2 = this.convertExecOptions(options); + options2.listeners = { + stdout: (data) => { + stdout += data.toString(); + }, + stderr: (data) => { + stderr += data.toString(); + } + }; + } + const exitCode = yield exec(this.path, this.arguments, options2); + const res2 = { + code: exitCode, + stdout: stdout, + stderr: stderr + }; + return Promise.resolve(res2); + }); + } + convertExecOptions(options) { + var _a, _b, _c, _d, _e, _f; + const result = { + cwd: (_a = options.cwd) !== null && _a !== void 0 ? _a : process.cwd(), + env: (_b = options.env) !== null && _b !== void 0 ? _b : process.env, + silent: (_c = options.silent) !== null && _c !== void 0 ? _c : false, + failOnStdErr: (_d = options.failOnStdErr) !== null && _d !== void 0 ? _d : false, + ignoreReturnCode: (_e = options.ignoreReturnCode) !== null && _e !== void 0 ? _e : false, + windowsVerbatimArguments: (_f = options.windowsVerbatimArguments) !== null && _f !== void 0 ? _f : false, + listeners: { + stdout: (data) => void { + // Nothing to do. + }, + stderr: (data) => void { + // Nothing to do. + }, + stdline: (data) => void { + // Nothing to do. + }, + errline: (data) => void { + // Nothing to do. + }, + debug: (data) => void { + // Nothing to do. + }, + } + }; + result.outStream = options.outStream || process.stdout; + result.errStream = options.errStream || process.stderr; + return result; + } + __argStringToArray(argString) { + const args = []; + let inQuotes = false; + let escaped = false; + let lastCharWasSpace = true; + let arg = ''; + const append = function (c) { + // we only escape double quotes. + if (escaped && c !== '"') { + arg += '\\'; + } + arg += c; + escaped = false; + }; + for (let i = 0; i < argString.length; i++) { + const c = argString.charAt(i); + if (c === ' ' && !inQuotes) { + if (!lastCharWasSpace) { + args.push(arg); + arg = ''; + } + lastCharWasSpace = true; + continue; + } + else { + lastCharWasSpace = false; + } + if (c === '"') { + if (!escaped) { + inQuotes = !inQuotes; + } + else { + append(c); + } + continue; + } + if (c === "\\" && escaped) { + append(c); + continue; + } + if (c === "\\" && inQuotes) { + escaped = true; + continue; + } + append(c); + lastCharWasSpace = false; + } + if (!lastCharWasSpace) { + args.push(arg.trim()); + } + return args; + } + ; +} +exports.ActionToolRunner = ActionToolRunner; +class ActionLib { + getInput(name, isRequired) { + const value = core.getInput(name, { required: isRequired }); + this.debug(`getInput(${name}, ${isRequired}) -> '${value}'`); + return value; + } + getBoolInput(name, isRequired) { + var _a; + const value = ((_a = core.getInput(name, { required: isRequired })) !== null && _a !== void 0 ? _a : "").toUpperCase() === "TRUE"; + this.debug(`getBoolInput(${name}, ${isRequired}) -> '${value}'`); + return value; + } + getPathInput(name, isRequired, checkExists) { + const value = path.resolve(core.getInput(name, { required: isRequired })); + this.debug(`getPathInput(${name}) -> '${value}'`); + if (checkExists) { + if (!fs.existsSync(value)) + throw new Error(`input path '${value}' for '${name}' does not exist.`); + } + return value; + } + isFilePathSupplied(name) { + var _a, _b; + // normalize paths + const pathValue = this.resolve((_a = this.getPathInput(name, false, false)) !== null && _a !== void 0 ? _a : ''); + const repoRoot = this.resolve((_b = process.env.GITHUB_WORKSPACE) !== null && _b !== void 0 ? _b : ''); + const isSupplied = pathValue !== repoRoot; + this.debug(`isFilePathSupplied(s file path=('${name}') -> '${isSupplied}'`); + return isSupplied; + } + getDelimitedInput(name, delim, required) { + const input = core.getInput(name, { required: required }); + const inputs = input.split(delim); + this.debug(`getDelimitedInput(${name}, ${delim}, ${required}) -> '${inputs}'`); + return inputs; + } + // Set an environment variable, re-usable in subsequent actions. + setVariable(name, value) { + core.exportVariable(name, value); + } + // Set the output of the action. + setOutput(name, value) { + core.setOutput(name, value); + } + getVariable(name) { + var _a; + //?? Is it really fine to return an empty string in case of undefined variable? + return (_a = process.env[name]) !== null && _a !== void 0 ? _a : ""; + } + debug(message) { + core.debug(message); + } + error(message) { + core.error(message); + } + warning(message) { + core.warning(message); + } + info(message) { + core.info(message); + } + tool(name) { + return new ActionToolRunner(name); + } + exec(path, args, options) { + return __awaiter(this, void 0, void 0, function* () { + return yield exec(path, args, options); + }); + } + execSync(path, args, options) { + return __awaiter(this, void 0, void 0, function* () { + const exitCode = yield exec(`"${path}"`, args, options); + const res2 = { + code: exitCode, + stdout: "", + stderr: "" + }; + return Promise.resolve(res2); + }); + } + which(name, required) { + return __awaiter(this, void 0, void 0, function* () { + core.debug(`"which(${name})<<`); + const filePath = yield io.which(name, required); + console.log(`tool: ${filePath}`); + core.debug(`"which(${name}) >> ${filePath}`); + return filePath; + }); } - } -} - -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') - - if (this.aborted) - return - - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } - - //console.error('PROCESS %d', this._processing, pattern) - - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. - - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return - - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break - - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } - - var remain = pattern.slice(n) - - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix - - var abs = this._makeAbs(read) - - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() - - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} - -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} - -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() - - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' - - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) - } - if (m) - matchedEntries.push(e) + rmRF(path) { + return __awaiter(this, void 0, void 0, function* () { + yield io.rmRF(path); + }); } - } - - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() - - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. - - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) - - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e - } - - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) + mkdirP(path) { + return __awaiter(this, void 0, void 0, function* () { + yield io.mkdirP(path); + }); } - // This was the last one, and no stats were needed - return cb() - } - - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e + cd(path) { + process.chdir(path); + } + writeFile(path, content) { + fs.writeFileSync(path, content); + } + resolve(apath) { + core.debug(`"resolve(${apath})<<`); + const resolvedPath = path.resolve(apath); + core.debug(`"resolve(${apath})>> '${resolvedPath})'`); + return resolvedPath; + } + stats(path) { + return fs.statSync(path); + } + exist(path) { + return ioutil.exists(path); + } + getBinDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE is not set."); + } + const binPath = utils.BaseLibUtils.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../b/")); + if (!fs.existsSync(binPath)) { + core.debug(`BinDir '${binPath}' does not exists, creating it...`); + fs.mkdirSync(binPath); + } + return binPath; + } + getSrcDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE env var is not set."); + } + const srcPath = utils.BaseLibUtils.normalizePath(process.env.GITHUB_WORKSPACE); + if (!fs.existsSync(srcPath)) { + throw new Error(`SourceDir '${srcPath}' does not exists.`); + } + return srcPath; + } + getArtifactsDir() { + if (!process.env.GITHUB_WORKSPACE) { + throw new Error("GITHUB_WORKSPACE is not set."); + } + //?? HACK. How to get the value of '{{ runner.temp }}' in JS's action? + const artifactsPath = utils.BaseLibUtils.normalizePath(path.join(process.env.GITHUB_WORKSPACE, "../../_temp")); + if (!fs.existsSync(artifactsPath)) { + core.debug(`ArtifactsDir '${artifactsPath}' does not exists, creating it...`); + fs.mkdirSync(artifactsPath); + } + return artifactsPath; + } + beginOperation(message) { + core.startGroup(message); + } + endOperation() { + core.endGroup(); + } + addMatcher(file) { + console.log(`::add-matcher::${file}`); + } + removeMatcher(file) { + console.log(`::remove-matcher::${file}`); } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() } +exports.ActionLib = ActionLib; +//# sourceMappingURL=action-lib.js.map -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return - } - - var abs = isAbsolute(e) ? e : this._makeAbs(e) - - if (this.mark) - e = this._mark(e) +/***/ }), - if (this.absolute) - e = abs +/***/ 413: +/***/ (function(module) { - if (this.matches[index][e]) - return +module.exports = require("stream"); - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return - } +/***/ }), - this.matches[index][e] = true +/***/ 417: +/***/ (function(module) { - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) +module.exports = require("crypto"); - this.emit('match', e) -} +/***/ }), -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return +/***/ 418: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const path = __webpack_require__(622); +const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([*?|(){}[\]]|^!|[@+!](?=\())/g; +/** + * Designed to work only with simple paths: `dir\\file`. + */ +function unixify(filepath) { + return filepath.replace(/\\/g, '/'); +} +exports.unixify = unixify; +function makeAbsolute(cwd, filepath) { + return path.resolve(cwd, filepath); +} +exports.makeAbsolute = makeAbsolute; +function escape(pattern) { + return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +} +exports.escape = escape; - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - if (lstatcb) - fs.lstat(abs, lstatcb) +/***/ }), - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() +/***/ 431: +/***/ (function(__unusedmodule, exports, __webpack_require__) { - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym +"use strict"; - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } +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 }); +const os = __importStar(__webpack_require__(87)); +/** + * Commands + * + * Command Format: + * ::name key=value,key=value::message + * + * Examples: + * ::warning::This is the message + * ::set-env name=MY_VAR::some value + */ +function issueCommand(command, properties, message) { + const cmd = new Command(command, properties, message); + process.stdout.write(cmd.toString() + os.EOL); } - -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return - - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) - - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() - - if (Array.isArray(c)) - return cb(null, c) - } - - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) +exports.issueCommand = issueCommand; +function issue(name, message = '') { + issueCommand(name, {}, message); } - -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) - } +exports.issue = issue; +const CMD_STRING = '::'; +class Command { + constructor(command, properties, message) { + if (!command) { + command = 'missing.command'; + } + this.command = command; + this.properties = properties; + this.message = message; + } + toString() { + let cmdStr = CMD_STRING + this.command; + if (this.properties && Object.keys(this.properties).length > 0) { + cmdStr += ' '; + let first = true; + for (const key in this.properties) { + if (this.properties.hasOwnProperty(key)) { + const val = this.properties[key]; + if (val) { + if (first) { + first = false; + } + else { + cmdStr += ','; + } + cmdStr += `${key}=${escapeProperty(val)}`; + } + } + } + } + cmdStr += `${CMD_STRING}${escapeData(this.message)}`; + return cmdStr; + } } +function escapeData(s) { + return (s || '') + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A'); +} +function escapeProperty(s) { + return (s || '') + .replace(/%/g, '%25') + .replace(/\r/g, '%0D') + .replace(/\n/g, '%0A') + .replace(/:/g, '%3A') + .replace(/,/g, '%2C'); +} +//# sourceMappingURL=command.js.map -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return - - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } - } +/***/ }), - this.cache[abs] = entries - return cb(null, entries) -} +/***/ 435: +/***/ (function(module, __unusedexports, __webpack_require__) { -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return +"use strict"; - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break +const fill = __webpack_require__(730); +const utils = __webpack_require__(225); - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } +const compile = (ast, options = {}) => { + let walk = (node, parent = {}) => { + let invalidBlock = utils.isInvalidBrace(parent); + let invalidNode = node.invalid === true && options.escapeInvalid === true; + let invalid = invalidBlock === true || invalidNode === true; + let prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; - return cb() -} + if (node.isOpen === true) { + return prefix + node.value; + } + if (node.isClose === true) { + return prefix + node.value; + } -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} + if (node.type === 'open') { + return invalid ? (prefix + node.value) : '('; + } + if (node.type === 'close') { + return invalid ? (prefix + node.value) : ')'; + } -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); + } - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() + if (node.value) { + return node.value; + } - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); + let range = fill(...args, { ...options, wrap: false, toRegex: true }); - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } - var isSym = this.symlinks[abs] - var len = entries.length + if (node.nodes) { + for (let child of node.nodes) { + output += walk(child, node); + } + } + return output; + }; - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() + return walk(ast); +}; - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue +module.exports = compile; - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) - } +/***/ }), - cb() -} +/***/ 440: +/***/ (function(module) { -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { +"use strict"; - //console.error('ps2', prefix, exists) - if (!this.matches[index]) - this.matches[index] = Object.create(null) +function reusify (Constructor) { + var head = new Constructor() + var tail = head - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() + function get () { + var current = head - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) + if (current.next) { + head = current.next } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' + head = new Constructor() + tail = head } + + current.next = null + + return current } - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') + function release (obj) { + tail.next = obj + tail = obj + } - // Mark this as a match - this._emitMatch(index, prefix) - cb() + return { + get: get, + release: release + } } -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' +module.exports = reusify - if (f.length > this.maxLength) - return cb() - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] +/***/ }), - if (Array.isArray(c)) - c = 'DIR' +/***/ 441: +/***/ (function(module, __unusedexports, __webpack_require__) { - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) +"use strict"; - if (needDir && c === 'FILE') - return cb() - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. - } +const fill = __webpack_require__(730); +const stringify = __webpack_require__(382); +const utils = __webpack_require__(225); - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) - } - } +const append = (queue = '', stash = '', enclose = false) => { + let result = []; - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) + queue = [].concat(queue); + stash = [].concat(stash); - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) - } + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; } -} -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() + for (let item of queue) { + if (Array.isArray(item)) { + for (let value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); + } + } } + return utils.flatten(result); +}; - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat - - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c - - if (needDir && c === 'FILE') - return cb() - - return cb(null, c, stat) -} +const expand = (ast, options = {}) => { + let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; + let walk = (node, parent = {}) => { + node.queue = []; -/***/ }), + let p = parent; + let q = parent.queue; -/***/ 403: -/***/ (function(__unusedmodule, exports, __webpack_require__) { + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const fsStat = __webpack_require__(231); -const fs = __webpack_require__(874); -class Settings { - constructor(_options = {}) { - this._options = _options; - this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false); - this.fs = fs.createFileSystemAdapter(this._options.fs); - this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep); - this.stats = this._getValue(this._options.stats, false); - this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true); - this.fsStatSettings = new fsStat.Settings({ - followSymbolicLink: this.followSymbolicLinks, - fs: this.fs, - throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink - }); - } - _getValue(option, value) { - return option === undefined ? value : option; - } -} -exports.default = Settings; + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } -/***/ }), + if (node.nodes && node.ranges > 0) { + let args = utils.reduce(node.nodes); -/***/ 406: -/***/ (function(module, __unusedexports, __webpack_require__) { + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } -"use strict"; - -const taskManager = __webpack_require__(384); -const async_1 = __webpack_require__(113); -const stream_1 = __webpack_require__(775); -const sync_1 = __webpack_require__(78); -const settings_1 = __webpack_require__(332); -const utils = __webpack_require__(444); -function FastGlob(source, options) { - try { - assertPatternsInput(source); - } - catch (error) { - return Promise.reject(error); - } - const works = getWorks(source, async_1.default, options); - return Promise.all(works).then(utils.array.flatten); -} -// https://github.com/typescript-eslint/typescript-eslint/issues/60 -// eslint-disable-next-line no-redeclare -(function (FastGlob) { - function sync(source, options) { - assertPatternsInput(source); - const works = getWorks(source, sync_1.default, options); - return utils.array.flatten(works); - } - FastGlob.sync = sync; - function stream(source, options) { - assertPatternsInput(source); - const works = getWorks(source, stream_1.default, options); - /** - * The stream returned by the provider cannot work with an asynchronous iterator. - * To support asynchronous iterators, regardless of the number of tasks, we always multiplex streams. - * This affects performance (+25%). I don't see best solution right now. - */ - return utils.stream.merge(works); - } - FastGlob.stream = stream; - function generateTasks(source, options) { - assertPatternsInput(source); - const patterns = [].concat(source); - const settings = new settings_1.default(options); - return taskManager.generate(patterns, settings); - } - FastGlob.generateTasks = generateTasks; - function isDynamicPattern(source, options) { - assertPatternsInput(source); - const settings = new settings_1.default(options); - return utils.pattern.isDynamicPattern(source, settings); - } - FastGlob.isDynamicPattern = isDynamicPattern; - function escapePath(source) { - assertPatternsInput(source); - return utils.path.escape(source); - } - FastGlob.escapePath = escapePath; -})(FastGlob || (FastGlob = {})); -function getWorks(source, _Provider, options) { - const patterns = [].concat(source); - const settings = new settings_1.default(options); - const tasks = taskManager.generate(patterns, settings); - const provider = new _Provider(settings); - return tasks.map(provider.read, provider); -} -function assertPatternsInput(source) { - if ([].concat(source).every(isString)) { - return; - } - throw new TypeError('Patterns must be a string or an array of strings'); -} -function isString(source) { - return typeof source === 'string'; -} -module.exports = FastGlob; + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } -/***/ }), + let enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; -/***/ 413: -/***/ (function(module) { + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } -module.exports = require("stream"); + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i]; -/***/ }), + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } -/***/ 417: -/***/ (function(module) { + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; -module.exports = require("crypto"); /***/ }), -/***/ 418: +/***/ 443: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([*?|(){}[\]]|^!|[@+!](?=\())/g; -/** - * Designed to work only with simple paths: `dir\\file`. - */ -function unixify(filepath) { - return filepath.replace(/\\/g, '/'); -} -exports.unixify = unixify; -function makeAbsolute(cwd, filepath) { - return path.resolve(cwd, filepath); -} -exports.makeAbsolute = makeAbsolute; -function escape(pattern) { - return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, '\\$2'); +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } -exports.escape = escape; +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(666)); /***/ }), -/***/ 431: +/***/ 444: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const array = __webpack_require__(453); +exports.array = array; +const errno = __webpack_require__(115); +exports.errno = errno; +const fs = __webpack_require__(43); +exports.fs = fs; +const path = __webpack_require__(418); +exports.path = path; +const pattern = __webpack_require__(724); +exports.pattern = pattern; +const stream = __webpack_require__(42); +exports.stream = stream; + + +/***/ }), + +/***/ 453: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +function flatten(items) { + return items.reduce((collection, item) => [].concat(collection, item), []); +} +exports.flatten = flatten; + -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 }); -const os = __importStar(__webpack_require__(87)); -/** - * Commands - * - * Command Format: - * ::name key=value,key=value::message - * - * Examples: - * ::warning::This is the message - * ::set-env name=MY_VAR::some value - */ -function issueCommand(command, properties, message) { - const cmd = new Command(command, properties, message); - process.stdout.write(cmd.toString() + os.EOL); -} -exports.issueCommand = issueCommand; -function issue(name, message = '') { - issueCommand(name, {}, message); -} -exports.issue = issue; -const CMD_STRING = '::'; -class Command { - constructor(command, properties, message) { - if (!command) { - command = 'missing.command'; - } - this.command = command; - this.properties = properties; - this.message = message; - } - toString() { - let cmdStr = CMD_STRING + this.command; - if (this.properties && Object.keys(this.properties).length > 0) { - cmdStr += ' '; - let first = true; - for (const key in this.properties) { - if (this.properties.hasOwnProperty(key)) { - const val = this.properties[key]; - if (val) { - if (first) { - first = false; - } - else { - cmdStr += ','; - } - cmdStr += `${key}=${escapeProperty(val)}`; - } - } - } - } - cmdStr += `${CMD_STRING}${escapeData(this.message)}`; - return cmdStr; - } -} -function escapeData(s) { - return (s || '') - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A'); -} -function escapeProperty(s) { - return (s || '') - .replace(/%/g, '%25') - .replace(/\r/g, '%0D') - .replace(/\n/g, '%0A') - .replace(/:/g, '%3A') - .replace(/,/g, '%2C'); -} -//# sourceMappingURL=command.js.map - /***/ }), -/***/ 432: +/***/ 454: /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -9361,6 +10077,25 @@ function escapeProperty(s) { // Copyright (c) 2019-2020 Luca Cappa // Released under the term specified in file LICENSE.txt // SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -9370,16 +10105,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const crypto = __webpack_require__(417); -const fs = __webpack_require__(747); -const path = __webpack_require__(622); -const utils = __webpack_require__(477); -const stripJsonComments = __webpack_require__(159); -const ninjalib = __webpack_require__(141); -const globals = __webpack_require__(358); -const cmakerunner = __webpack_require__(997); +exports.CMakeSettingsJsonRunner = exports.parseConfigurations = exports.parseEnvironments = exports.PropertyEvaluator = exports.Configuration = exports.Environment = void 0; +const baseutillib = __importStar(__webpack_require__(758)); +const crypto = __importStar(__webpack_require__(417)); +const path = __importStar(__webpack_require__(622)); +__webpack_require__(966); +const ninjalib = __importStar(__webpack_require__(72)); +const globals = __importStar(__webpack_require__(330)); +const cmakerunner = __importStar(__webpack_require__(214)); +const cmakeutil = __importStar(__webpack_require__(233)); const using_statement_1 = __webpack_require__(443); +const strip_json_comments_1 = __importDefault(__webpack_require__(966)); class CMakeGenerators { } CMakeGenerators.ARM64 = ["ARM64", "ARM64"]; @@ -9452,6 +10192,10 @@ class Configuration { this.cmakeToolchain = cmakeToolchain; this.variables = variables; this.inheritEnvironments = inheritEnvironments; + baseutillib.BaseLibUtils.throwIfUndefined(name, "name"); + baseutillib.BaseLibUtils.throwIfUndefined(buildDir, "buildDir"); + baseutillib.BaseLibUtils.throwIfUndefined(cmakeSettingsJsonPath, "cmakeSettingsJsonPath"); + this.buildDir = path.normalize(buildDir); } /** * Add to current process the environment variables defined in this configuration. @@ -9578,7 +10322,7 @@ class PropertyEvaluator { if (env != null) { for (const v of env.variables) { if (v.name === variable) { - return _a = v.value, (_a !== null && _a !== void 0 ? _a : ""); + return (_a = v.value) !== null && _a !== void 0 ? _a : ""; } } } @@ -9661,7 +10405,7 @@ class PropertyEvaluator { } } this.tl.debug(`evalutated to: '${String(res)}'.`); - return (res !== null && res !== void 0 ? res : ''); + return res !== null && res !== void 0 ? res : ''; } } exports.PropertyEvaluator = PropertyEvaluator; @@ -9740,7 +10484,8 @@ function parseConfigurations(configurationsJson, cmakeSettingsJson, sourceDir) { } exports.parseConfigurations = parseConfigurations; class CMakeSettingsJsonRunner { - constructor(cmakeSettingsJson, configurationFilter, appendedCMakeArgs, workspaceRoot, vcpkgTriplet, useVcpkgToolchain, doBuild, ninjaPath, ninjaDownloadUrl, sourceScript, buildDir, tl) { + constructor(baseLib, cmakeSettingsJson, configurationFilter, appendedCMakeArgs, workspaceRoot, vcpkgTriplet, useVcpkgToolchain, doBuild, ninjaPath, ninjaDownloadUrl, sourceScript, buildDir) { + this.baseLib = baseLib; this.cmakeSettingsJson = cmakeSettingsJson; this.configurationFilter = configurationFilter; this.appendedCMakeArgs = appendedCMakeArgs; @@ -9752,19 +10497,25 @@ class CMakeSettingsJsonRunner { this.ninjaDownloadUrl = ninjaDownloadUrl; this.sourceScript = sourceScript; this.buildDir = buildDir; - this.tl = tl; + this.baseLib.debug(`CMakeSettingsJsonRunner()<<`); this.configurationFilter = configurationFilter; - this.buildDir = path.normalize(path.resolve(this.buildDir)); - if (!fs.existsSync(cmakeSettingsJson)) { + this.baseUtils = new baseutillib.BaseLibUtils(this.baseLib); + this.cmakeUtils = new cmakeutil.CMakeUtils(this.baseUtils); + this.ninjaLib = new ninjalib.NinjaProvider(this.baseLib); + this.baseLib.debug(`buildDir=${buildDir}`); + this.buildDir = baseutillib.BaseLibUtils.normalizePath(buildDir); + this.baseLib.debug(`normalized buildDir=${this.buildDir}`); + if (!this.baseLib.exist(cmakeSettingsJson)) { throw new Error(`File '${cmakeSettingsJson}' does not exist.`); } + this.baseLib.debug(`CMakeSettingsJsonRunner()>>`); } parseConfigurations(json) { let configurations = []; if (json.configurations) { - configurations = parseConfigurations(json.configurations, this.cmakeSettingsJson, this.tl.getSrcDir()); + configurations = parseConfigurations(json.configurations, this.cmakeSettingsJson, this.baseLib.getSrcDir()); } - this.tl.debug(`CMakeSettings.json parsed configurations: '${String(configurations)}'.`); + this.baseLib.debug(`CMakeSettings.json parsed configurations: '${String(configurations)}'.`); return configurations; } static parseEnvironments(envsJson) { @@ -9776,27 +10527,30 @@ class CMakeSettingsJsonRunner { if (json.environments != null) { globalEnvs = CMakeSettingsJsonRunner.parseEnvironments(json.environments); } - this.tl.debug("CMakeSettings.json parsed global environments."); + this.baseLib.debug("CMakeSettings.json parsed global environments."); for (const envName in globalEnvs) { - this.tl.debug(`'${envName}'=${String(globalEnvs[envName])}`); + this.baseLib.debug(`'${envName}'=${String(globalEnvs[envName])}`); } return globalEnvs; } run() { return __awaiter(this, void 0, void 0, function* () { - let content = fs.readFileSync(this.cmakeSettingsJson); + const [success, content] = this.baseUtils.readFile(this.cmakeSettingsJson); + if (!success) { + throw new Error(`Cannot read file: '${this.cmakeSettingsJson}'.`); + } // Remove any potential BOM at the beginning. - content = content.toString().trimLeft(); - this.tl.debug(`Content of file CMakeSettings.json: '${content}'.`); + const contentTrimmed = content.toString().trimLeft(); + this.baseLib.debug(`Content of file CMakeSettings.json: '${contentTrimmed}'.`); // Strip any comment out of the JSON content. - const cmakeSettingsJson = JSON.parse(stripJsonComments(content)); + const cmakeSettingsJson = JSON.parse(strip_json_comments_1.default(contentTrimmed)); const configurations = this.parseConfigurations(cmakeSettingsJson); const globalEnvs = this.parseGlobalEnvironments(cmakeSettingsJson); const regex = new RegExp(this.configurationFilter); const filteredConfigurations = configurations.filter(configuration => { return regex.test(configuration.name); }); - this.tl.debug(`CMakeSettings.json filtered configurations: '${String(filteredConfigurations)}'."`); + this.baseLib.debug(`CMakeSettings.json filtered configurations: '${String(filteredConfigurations)}'."`); if (filteredConfigurations.length === 0) { throw new Error(`No matching configuration for filter: '${this.configurationFilter}'.`); } @@ -9805,20 +10559,20 @@ class CMakeSettingsJsonRunner { for (const configuration of filteredConfigurations) { const msg = `Process configuration: '${configuration.name}'.`; try { - this.tl.beginOperation(msg); + this.baseLib.beginOperation(msg); console.log(msg); let cmakeArgs = []; // Search for CMake tool and run it let cmake; if (this.sourceScript) { - cmake = this.tl.tool(this.sourceScript); - cmakeArgs.push(yield this.tl.which('cmake', true)); + cmake = this.baseLib.tool(this.sourceScript); + cmakeArgs.push(yield this.baseLib.which('cmake', true)); } else { - cmake = this.tl.tool(yield this.tl.which('cmake', true)); + cmake = this.baseLib.tool(yield this.baseLib.which('cmake', true)); } // Evaluate all variables in the configuration. - const evaluator = new PropertyEvaluator(configuration, globalEnvs, this.tl); + const evaluator = new PropertyEvaluator(configuration, globalEnvs, this.baseLib); const evaledConf = configuration.evaluate(evaluator); // Set all variable in the configuration in the process environment. evaledConf.setEnvironment(globalEnvs); @@ -9828,9 +10582,9 @@ class CMakeSettingsJsonRunner { // 2. the default location in CMakeSettings.json is under the source tree, whose content is not deleted upon each build run. // Instead if users did not provided a specific path, let's force it to // "$(Build.ArtifactStagingDirectory)/{name}" which should be empty. - console.log(`Note: the run-cmake task always ignore the 'buildRoot' value specified in the CMakeSettings.json (buildRoot=${configuration.buildDir}). User can override the default value by setting the '${globals.buildDirectory}' input.`); - const artifactsDir = yield this.tl.getArtifactsDir(); - if (utils.normalizePath(this.buildDir) === utils.normalizePath(artifactsDir)) { + console.log(`Note: run-cmake always ignores the 'buildRoot' value specified in the CMakeSettings.json (buildRoot=${configuration.buildDir}). User can override the default value by setting the '${globals.buildDirectory}' input.`); + const artifactsDir = yield this.baseLib.getArtifactsDir(); + if (baseutillib.BaseLibUtils.normalizePath(this.buildDir) === baseutillib.BaseLibUtils.normalizePath(artifactsDir)) { // The build directory goes into the artifact directory in a subdir // named with the configuration name. evaledConf.buildDir = path.join(artifactsDir, configuration.name); @@ -9842,8 +10596,8 @@ class CMakeSettingsJsonRunner { } console.log(`Overriding build directory to: '${evaledConf.buildDir}'`); cmakeArgs = cmakeArgs.concat(evaledConf.getGeneratorArgs().filter(this.notEmpty)); - if (utils.isNinjaGenerator(cmakeArgs)) { - const ninjaPath = yield ninjalib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); + if (this.baseUtils.isNinjaGenerator(cmakeArgs)) { + const ninjaPath = yield this.ninjaLib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); } if (!this.isMultiConfigGenerator(evaledConf.generator)) { @@ -9857,7 +10611,7 @@ class CMakeSettingsJsonRunner { } // Use vcpkg toolchain if requested. if (this.useVcpkgToolchain === true) { - cmakeArgs = yield utils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet); + cmakeArgs = yield this.cmakeUtils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet, this.baseLib); } // Add the current args in the tool, add // custom args, and reset the args. @@ -9875,7 +10629,7 @@ class CMakeSettingsJsonRunner { } // Append user provided CMake arguments. cmake.line(this.appendedCMakeArgs); - yield this.tl.mkdirP(evaledConf.buildDir); + yield this.baseLib.mkdirP(evaledConf.buildDir); const options = { cwd: evaledConf.buildDir, failOnStdErr: false, @@ -9886,18 +10640,18 @@ class CMakeSettingsJsonRunner { windowsVerbatimArguments: false, env: process.env }; - this.tl.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); + this.baseLib.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); let code = -1; - yield using_statement_1.using(utils.createMatcher('cmake', this.cmakeSettingsJson), (matcher) => __awaiter(this, void 0, void 0, function* () { - code = yield utils.wrapOp("Generate project files with CMake", () => cmake.exec(options)); + yield using_statement_1.using(baseutillib.Matcher.createMatcher('cmake', this.baseLib, this.cmakeSettingsJson), (matcher) => __awaiter(this, void 0, void 0, function* () { + code = yield this.baseUtils.wrapOp("Generate project files with CMake", () => cmake.exec(options)); })); if (code !== 0) { throw new Error(`"CMake failed with error code: '${code}'."`); } if (this.doBuild) { - yield using_statement_1.using(utils.createMatcher(cmakerunner.CMakeRunner.getBuildMatcher(this.buildDir, this.tl)), (matcher) => __awaiter(this, void 0, void 0, function* () { - yield utils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { - return yield cmakerunner.CMakeRunner.build(this.tl, evaledConf.buildDir, + yield using_statement_1.using(baseutillib.Matcher.createMatcher(cmakerunner.CMakeRunner.getBuildMatcher(this.buildDir, this.baseLib), this.baseLib), (matcher) => __awaiter(this, void 0, void 0, function* () { + yield this.baseUtils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { + return yield cmakerunner.CMakeRunner.build(this.baseLib, evaledConf.buildDir, // CMakeSettings.json contains in buildCommandArgs the arguments to the make program //only. They need to be put after '--', otherwise would be passed to directly to cmake. ` ${evaledConf.getGeneratorBuildArgs()} -- ${evaledConf.makeArgs}`, options); @@ -9908,7 +10662,7 @@ class CMakeSettingsJsonRunner { process.env.PATH = originalPath; } finally { - this.tl.endOperation(); + this.baseLib.endOperation(); } } }); @@ -9920,288 +10674,9 @@ class CMakeSettingsJsonRunner { return generatorName.includes("Visual Studio") || generatorName.includes("Ninja Multi-Config"); } -} -exports.CMakeSettingsJsonRunner = CMakeSettingsJsonRunner; - -//# sourceMappingURL=cmakesettings-runner.js.map - - -/***/ }), - -/***/ 435: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -const fill = __webpack_require__(730); -const utils = __webpack_require__(225); - -const compile = (ast, options = {}) => { - let walk = (node, parent = {}) => { - let invalidBlock = utils.isInvalidBrace(parent); - let invalidNode = node.invalid === true && options.escapeInvalid === true; - let invalid = invalidBlock === true || invalidNode === true; - let prefix = options.escapeInvalid === true ? '\\' : ''; - let output = ''; - - if (node.isOpen === true) { - return prefix + node.value; - } - if (node.isClose === true) { - return prefix + node.value; - } - - if (node.type === 'open') { - return invalid ? (prefix + node.value) : '('; - } - - if (node.type === 'close') { - return invalid ? (prefix + node.value) : ')'; - } - - if (node.type === 'comma') { - return node.prev.type === 'comma' ? '' : (invalid ? node.value : '|'); - } - - if (node.value) { - return node.value; - } - - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - let range = fill(...args, { ...options, wrap: false, toRegex: true }); - - if (range.length !== 0) { - return args.length > 1 && range.length > 1 ? `(${range})` : range; - } - } - - if (node.nodes) { - for (let child of node.nodes) { - output += walk(child, node); - } - } - return output; - }; - - return walk(ast); -}; - -module.exports = compile; - - -/***/ }), - -/***/ 440: -/***/ (function(module) { - -"use strict"; - - -function reusify (Constructor) { - var head = new Constructor() - var tail = head - - function get () { - var current = head - - if (current.next) { - head = current.next - } else { - head = new Constructor() - tail = head - } - - current.next = null - - return current - } - - function release (obj) { - tail.next = obj - tail = obj - } - - return { - get: get, - release: release - } -} - -module.exports = reusify - - -/***/ }), - -/***/ 441: -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -const fill = __webpack_require__(730); -const stringify = __webpack_require__(382); -const utils = __webpack_require__(225); - -const append = (queue = '', stash = '', enclose = false) => { - let result = []; - - queue = [].concat(queue); - stash = [].concat(stash); - - if (!stash.length) return queue; - if (!queue.length) { - return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; - } - - for (let item of queue) { - if (Array.isArray(item)) { - for (let value of item) { - result.push(append(value, stash, enclose)); - } - } else { - for (let ele of stash) { - if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; - result.push(Array.isArray(ele) ? append(item, ele, enclose) : (item + ele)); - } - } - } - return utils.flatten(result); -}; - -const expand = (ast, options = {}) => { - let rangeLimit = options.rangeLimit === void 0 ? 1000 : options.rangeLimit; - - let walk = (node, parent = {}) => { - node.queue = []; - - let p = parent; - let q = parent.queue; - - while (p.type !== 'brace' && p.type !== 'root' && p.parent) { - p = p.parent; - q = p.queue; - } - - if (node.invalid || node.dollar) { - q.push(append(q.pop(), stringify(node, options))); - return; - } - - if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { - q.push(append(q.pop(), ['{}'])); - return; - } - - if (node.nodes && node.ranges > 0) { - let args = utils.reduce(node.nodes); - - if (utils.exceedsLimit(...args, options.step, rangeLimit)) { - throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); - } - - let range = fill(...args, options); - if (range.length === 0) { - range = stringify(node, options); - } - - q.push(append(q.pop(), range)); - node.nodes = []; - return; - } - - let enclose = utils.encloseBrace(node); - let queue = node.queue; - let block = node; - - while (block.type !== 'brace' && block.type !== 'root' && block.parent) { - block = block.parent; - queue = block.queue; - } - - for (let i = 0; i < node.nodes.length; i++) { - let child = node.nodes[i]; - - if (child.type === 'comma' && node.type === 'brace') { - if (i === 1) queue.push(''); - queue.push(''); - continue; - } - - if (child.type === 'close') { - q.push(append(q.pop(), queue, enclose)); - continue; - } - - if (child.value && child.type !== 'open') { - queue.push(append(queue.pop(), child.value)); - continue; - } - - if (child.nodes) { - walk(child, node); - } - } - - return queue; - }; - - return utils.flatten(walk(ast)); -}; - -module.exports = expand; - - -/***/ }), - -/***/ 443: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(666)); - - -/***/ }), - -/***/ 444: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const array = __webpack_require__(453); -exports.array = array; -const errno = __webpack_require__(115); -exports.errno = errno; -const fs = __webpack_require__(43); -exports.fs = fs; -const path = __webpack_require__(418); -exports.path = path; -const pattern = __webpack_require__(724); -exports.pattern = pattern; -const stream = __webpack_require__(913); -exports.stream = stream; - - -/***/ }), - -/***/ 453: -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -function flatten(items) { - return items.reduce((collection, item) => [].concat(collection, item), []); -} -exports.flatten = flatten; - +} +exports.CMakeSettingsJsonRunner = CMakeSettingsJsonRunner; +//# sourceMappingURL=cmakesettings-runner.js.map /***/ }), @@ -10559,445 +11034,40 @@ exports.getState = getState; /***/ }), -/***/ 474: -/***/ (function(module, __unusedexports, __webpack_require__) { - -module.exports = function (/*Buffer*/inbuf) { - - var zlib = __webpack_require__(761); - - var opts = {chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024}; - - return { - deflate: function () { - return zlib.deflateRawSync(inbuf, opts); - }, - - deflateAsync: function (/*Function*/callback) { - var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0; - tmp.on('data', function (data) { - parts.push(data); - total += data.length; - }); - tmp.on('end', function () { - var buf = Buffer.alloc(total), written = 0; - buf.fill(0); - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - part.copy(buf, written); - written += part.length; - } - callback && callback(buf); - }); - tmp.end(inbuf); - } - } -}; - - -/***/ }), - -/***/ 477: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -// Copyright (c) 2019-2020 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const admZip = __webpack_require__(639); -const fs = __webpack_require__(747); -const os = __webpack_require__(87); -const path = __webpack_require__(622); -const http = __webpack_require__(549); -const del = __webpack_require__(245); -const globals = __webpack_require__(358); -// TODO starts: remove this block and create a class where the BaseLib is passed -// in ctor -let baseLib; -function setBaseLib(tl) { - baseLib = tl; -} -exports.setBaseLib = setBaseLib; -function getBaseLib() { - return baseLib; -} -exports.getBaseLib = getBaseLib; -// TODO ends -function isVariableStrippingPath(variableName) { - // Avoid that the PATH is minimized by MSBuild props: - // https://github.com/lukka/run-cmake/issues/8#issuecomment-606956604 - return (variableName.toUpperCase() === "__VSCMD_PREINIT_PATH"); -} -/** - * Check whether the current generator selected in the command line - * is -G Ninja or -G Ninja Multi-Config. - * @export - * @param {string} commandLineString The command line as string - * @returns {boolean} - */ -function isNinjaGenerator(args) { - for (const arg of args) { - if (/-G[\s]*(?:\"Ninja.*\"|Ninja.*)/.test(arg)) - return true; - } - return false; -} -exports.isNinjaGenerator = isNinjaGenerator; -function isMakeProgram(args) { - for (const arg of args) { - if (/-DCMAKE_MAKE_PROGRAM/.test(arg)) - return true; - } - return false; -} -exports.isMakeProgram = isMakeProgram; -function isToolchainFile(args) { - for (const arg of args) { - if (/-DCMAKE_TOOLCHAIN_FILE/.test(arg)) - return true; - } - return false; -} -exports.isToolchainFile = isToolchainFile; -function getToolchainFile(args) { - baseLib.debug(`getToolchainFile(${JSON.stringify(args)})<<`); - for (const arg of args) { - const matches = /-DCMAKE_TOOLCHAIN_FILE(?::[^\s]*)?=([^\s]*)/.exec(arg); - if (matches != null) { - if (matches.length > 1) { - baseLib.debug(`match found=${matches[1]}`); - return matches[1]; - } - } - } - return undefined; -} -exports.getToolchainFile = getToolchainFile; -function removeToolchainFile(args) { - return args.filter(a => !/-DCMAKE_TOOLCHAIN_FILE(:[A-Za-z]+)?=[^\s]+/.test(a)); -} -exports.removeToolchainFile = removeToolchainFile; -function mkdir(target, options) { - fs.mkdirSync(target, options); -} -exports.mkdir = mkdir; -function rm(target) { - del.sync(target); -} -exports.rm = rm; -function test(aPath) { - const result = fs.existsSync(aPath); - return result; -} -exports.test = test; -function downloadFile(url) { - return __awaiter(this, void 0, void 0, function* () { - const downloadsDirName = "dl"; - // validate parameters - if (!url) { - throw new Error('downloadFile: Parameter "url" must be set.'); - } - const downloadsDirectory = path.join(yield baseLib.getBinDir(), downloadsDirName); - const scrubbedUrl = url.replace(/[/\:?]/g, '_'); - const targetPath = path.join(downloadsDirectory, scrubbedUrl); - const marker = targetPath + '.completed'; - // skip if already downloaded - if (test(marker)) { - console.log(`Found downloaded file at: ${targetPath}`); - return Promise.resolve(targetPath); - } - else { - console.log(`Downloading url '${url}' to file '${targetPath}'.`); - // delete any previous partial attempt - if (test(targetPath)) { - rm(targetPath); - } - // download the file - mkdir(downloadsDirectory, { recursive: true }); - const file = fs.createWriteStream(targetPath, { autoClose: true }); - return new Promise((resolve, reject) => { - const request = http.https.get(url, (response) => { - response.pipe(file).on('finish', () => { - baseLib.debug(`statusCode: ${response.statusCode}.`); - baseLib.debug(`headers: ${response.headers}.`); - console.log(`'${url}' downloaded to: '${targetPath}'`); - fs.writeFileSync(marker, ''); - request.end(); - resolve(targetPath); - }).on('error', (error) => reject(new Error(`statusCode='${response.statusCode}', error='${error.toString()}'.`))); - }); - }); - } - }); -} -exports.downloadFile = downloadFile; -function isWin32() { - return os.platform().toLowerCase() === 'win32'; -} -exports.isWin32 = isWin32; -function isLinux() { - return os.platform().toLowerCase() === 'linux'; -} -exports.isLinux = isLinux; -function isDarwin() { - return os.platform().toLowerCase() === 'darwin'; -} -exports.isDarwin = isDarwin; -class Downloader { - static downloadFile(url) { - return __awaiter(this, void 0, void 0, function* () { - return yield downloadFile(url); - }); - } - /** - * Downloads and extracts an archive file. - * @returns The path to the extracted content. - */ - static downloadArchive(url) { - return __awaiter(this, void 0, void 0, function* () { - if (!url) { - throw new Error('downloadArchive: url must be provided!'); - } - try { - const targetFileName = url.replace(/[\/\\:?]/g, '_'); - // 'x' for extracted content. - const targetPath = path.join(yield baseLib.getBinDir(), 'x', targetFileName); - const marker = targetPath + '.completed'; - if (!test(marker)) { - // download the whole archive. - const archivePath = yield downloadFile(url); - // extract the archive overwriting anything. - console.log(`Extracting archive '${archivePath}' ...`); - mkdir(targetPath, { recursive: true }); - const zip = new admZip(archivePath); - zip.extractAllTo(targetPath, true); - // write the completed file marker. - fs.writeFileSync(marker, ''); - } - return targetPath; - } - catch (exception) { - throw new Error(`Failed to download the Ninja executable: '${exception}'.`); - } - }); - } -} -exports.Downloader = Downloader; -; -function parseVcpkgEnvOutput(data) { - const map = {}; - const regex = { - param: /^\s*([^=]+?)\s*=\s*(.*?)\s*$/, - }; - const lines = data.split(/[\r\n]+/); - for (const line of lines) { - if (regex.param.test(line)) { - const match = line.match(regex.param); - if (match) { - map[match[1]] = match[2]; - } - } - } - return map; -} -function injectEnvVariables(vcpkgRoot, triplet) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - if (!vcpkgRoot) { - vcpkgRoot = (_a = process.env[globals.outVcpkgRootPath], (_a !== null && _a !== void 0 ? _a : "")); - if (!vcpkgRoot) { - throw new Error(`${globals.outVcpkgRootPath} environment variable is not set.`); - } - } - // Search for CMake tool and run it - let vcpkgPath = path.join(vcpkgRoot, 'vcpkg'); - if (isWin32()) { - vcpkgPath += '.exe'; - } - const vcpkg = baseLib.tool(vcpkgPath); - vcpkg.arg("env"); - vcpkg.arg("--bin"); - vcpkg.arg("--include"); - vcpkg.arg("--tools"); - vcpkg.arg("--python"); - vcpkg.line(`--triplet ${triplet} set`); - const options = { - cwd: vcpkgRoot, - failOnStdErr: false, - errStream: process.stdout, - outStream: process.stdout, - ignoreReturnCode: true, - silent: false, - windowsVerbatimArguments: false, - env: process.env - }; - const output = yield vcpkg.execSync(options); - if (output.code !== 0) { - throw new Error(`${output.stdout}\n\n${output.stderr}`); - } - const map = parseVcpkgEnvOutput(output.stdout); - for (const key in map) { - if (isVariableStrippingPath(key)) - continue; - if (key.toUpperCase() === "PATH") { - process.env[key] = process.env[key] + path.delimiter + map[key]; - } - else { - process.env[key] = map[key]; - } - baseLib.debug(`set ${key}=${process.env[key]}`); - } - }); -} -exports.injectEnvVariables = injectEnvVariables; -function injectVcpkgToolchain(args, triplet) { - return __awaiter(this, void 0, void 0, function* () { - args = (args !== null && args !== void 0 ? args : []); - const vcpkgRoot = process.env[globals.outVcpkgRootPath]; - // if RUNVCPKG_VCPKG_ROOT is defined, then use it, and put aside into - // VCPKG_CHAINLOAD_TOOLCHAIN_FILE the existing toolchain. - if (vcpkgRoot && vcpkgRoot.length > 1) { - const toolchainFile = getToolchainFile(args); - args = removeToolchainFile(args); - const vcpkgToolchain = path.join(vcpkgRoot, '/scripts/buildsystems/vcpkg.cmake'); - args.push(`-DCMAKE_TOOLCHAIN_FILE=${vcpkgToolchain}`); - if (toolchainFile) { - args.push(`-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${toolchainFile}`); - } - // If the triplet is provided, specify the same triplet on the cmd line and set the environment for msvc. - if (triplet) { - args.push(`-DVCPKG_TARGET_TRIPLET=${triplet}`); - // For Windows build agents, inject the environment variables used - // for the MSVC compiler using the 'vcpkg env' command. - // This is not be needed for others compiler on Windows, but it should be harmless. - if (isWin32() && triplet) { - if (triplet.indexOf("windows") !== -1) { - process.env.CC = "cl.exe"; - process.env.CXX = "cl.exe"; - baseLib.setVariable("CC", "cl.exe"); - baseLib.setVariable("CXX", "cl.exe"); - } - yield injectEnvVariables(vcpkgRoot, triplet); - } - } - } - return args; - }); -} -exports.injectVcpkgToolchain = injectVcpkgToolchain; -/** - * Get a set of commands to be run in the shell of the host OS. - * @export - * @param {string[]} args - * @returns {(trm.ToolRunner | undefined)} - */ -function getScriptCommand(args) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - let tool; - if (isWin32()) { - const cmdExe = (_a = process.env.COMSPEC, (_a !== null && _a !== void 0 ? _a : "cmd.exe")); - const cmdPath = yield baseLib.which(cmdExe, true); - tool = baseLib.tool(cmdPath); - tool.arg('/c'); - tool.line(args); - } - else { - const shPath = yield baseLib.which('sh', true); - tool = baseLib.tool(shPath); - tool.arg('-c'); - tool.arg(args); - return tool; - } - }); -} -exports.getScriptCommand = getScriptCommand; -/** - * Normalize a filesystem path with path.normalize(), then remove any trailing space. - * - * @export - * @param {string} aPath The string representing a filesystem path. - * @returns {string} The normalized path without trailing slash. - */ -function normalizePath(aPath) { - aPath = path.normalize(aPath); - if (/[\\\/]$/.test(aPath) && aPath.length > 1) - aPath = aPath.slice(0, -1); - return aPath; -} -exports.normalizePath = normalizePath; -function wrapOp(name, fn) { - return __awaiter(this, void 0, void 0, function* () { - baseLib.beginOperation(name); - let result; - try { - result = yield fn(); - } - finally { - baseLib.endOperation(); - } - return result; - }); -} -exports.wrapOp = wrapOp; -function wrapOpSync(name, fn) { - baseLib.beginOperation(name); - let result; - try { - result = fn(); - } - finally { - baseLib.endOperation(); - } - return result; -} -exports.wrapOpSync = wrapOpSync; -class Matcher { - constructor(name, fromPath) { - this.name = name; - this.fromPath = fromPath; - const matcherFilePath = path.join(__dirname, `${name}.json`); - fromPath; - /* //?? TODO This code should be removed. - if (fromPath) { - try { - const content = fs.readFileSync(matcherFilePath); - const json: any = JSON.parse(content.toString()); - json.problemMatcher[0].pattern[0].fromPath = fromPath; - fs.writeFileSync(matcherFilePath, JSON.stringify(json), - { - encoding: "utf8", - flag: "w+" - }); - baseLib.debug(fs.readFileSync(matcherFilePath).toString()); - } catch (err) { - baseLib.debug(`Failure in Matcher: ${err}`); - } - }*/ - baseLib.addMatcher(matcherFilePath); - } - dispose() { - baseLib.removeMatcher(path.join(__dirname, `${this.name}.json`)); - } -} -exports.Matcher = Matcher; -function createMatcher(name, fromPath) { - return new Matcher(name, fromPath); -} -exports.createMatcher = createMatcher; - -//# sourceMappingURL=utils.js.map +/***/ 474: +/***/ (function(module, __unusedexports, __webpack_require__) { + +module.exports = function (/*Buffer*/inbuf) { + + var zlib = __webpack_require__(761); + + var opts = {chunkSize: (parseInt(inbuf.length / 1024) + 1) * 1024}; + + return { + deflate: function () { + return zlib.deflateRawSync(inbuf, opts); + }, + + deflateAsync: function (/*Function*/callback) { + var tmp = zlib.createDeflateRaw(opts), parts = [], total = 0; + tmp.on('data', function (data) { + parts.push(data); + total += data.length; + }); + tmp.on('end', function () { + var buf = Buffer.alloc(total), written = 0; + buf.fill(0); + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + part.copy(buf, written); + written += part.length; + } + callback && callback(buf); + }); + tmp.end(inbuf); + } + } +}; /***/ }), @@ -12888,23 +12958,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const libaction = __webpack_require__(35); +const libaction = __webpack_require__(778); +const runcmakelib = __webpack_require__(832); const core = __webpack_require__(470); -const cmakerunner = __webpack_require__(997); -const utils = __webpack_require__(477); function main() { + var _a; return __awaiter(this, void 0, void 0, function* () { try { const actionLib = new libaction.ActionLib(); - utils.setBaseLib(actionLib); - const runner = new cmakerunner.CMakeRunner(actionLib); + const runner = new runcmakelib.CMakeRunner(actionLib); yield runner.run(); core.info('run-cmake action execution succeeded'); process.exitCode = 0; } catch (err) { + const error = err; + if ((_a = error) === null || _a === void 0 ? void 0 : _a.stack) { + core.info(error.stack); + } const errorAsString = ((err !== null && err !== void 0 ? err : "undefined error")).toString(); - core.debug('Error: ' + errorAsString); core.setFailed(`run-cmake action execution failed: '${errorAsString}'`); process.exitCode = -1000; } @@ -16115,6 +16187,27 @@ module.exports = require("fs"); /***/ }), +/***/ 758: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(928), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + /***/ 761: /***/ (function(module) { @@ -16246,6 +16339,27 @@ class ProviderStream extends provider_1.default { exports.default = ProviderStream; +/***/ }), + +/***/ 778: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(411), exports); +//# sourceMappingURL=index.js.map + /***/ }), /***/ 783: @@ -18558,6 +18672,30 @@ function Task () { module.exports = fastqueue +/***/ }), + +/***/ 832: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(__webpack_require__(330), exports); +__exportStar(__webpack_require__(214), exports); +__exportStar(__webpack_require__(454), exports); +__exportStar(__webpack_require__(72), exports); +//# sourceMappingURL=index.js.map + /***/ }), /***/ 833: @@ -19192,97 +19330,547 @@ module.exports = function (xs, fn) { if (isArray(x)) res.push.apply(res, x); else res.push(x); } - return res; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - - -/***/ }), - -/***/ 912: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const utils = __webpack_require__(444); -class EntryTransformer { - constructor(_settings) { - this._settings = _settings; - } - getTransformer() { - return (entry) => this._transform(entry); - } - _transform(entry) { - let filepath = entry.path; - if (this._settings.absolute) { - filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); - filepath = utils.path.unixify(filepath); - } - if (this._settings.markDirectories && entry.dirent.isDirectory()) { - filepath += '/'; - } - if (!this._settings.objectMode) { - return filepath; - } - return Object.assign(Object.assign({}, entry), { path: filepath }); - } -} -exports.default = EntryTransformer; - - -/***/ }), - -/***/ 913: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const merge2 = __webpack_require__(538); -function merge(streams) { - const mergedStream = merge2(streams); - streams.forEach((stream) => { - stream.once('error', (error) => mergedStream.emit('error', error)); - }); - mergedStream.once('close', () => propagateCloseEventToSources(streams)); - mergedStream.once('end', () => propagateCloseEventToSources(streams)); - return mergedStream; -} -exports.merge = merge; -function propagateCloseEventToSources(streams) { - streams.forEach((stream) => stream.emit('close')); -} - - -/***/ }), - -/***/ 914: -/***/ (function(module) { - -"use strict"; -/*! - * is-number - * - * Copyright (c) 2014-present, Jon Schlinkert. - * Released under the MIT License. - */ - - - -module.exports = function(num) { - if (typeof num === 'number') { - return num - num === 0; - } - if (typeof num === 'string' && num.trim() !== '') { - return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); - } - return false; -}; - + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + + +/***/ }), + +/***/ 912: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const utils = __webpack_require__(444); +class EntryTransformer { + constructor(_settings) { + this._settings = _settings; + } + getTransformer() { + return (entry) => this._transform(entry); + } + _transform(entry) { + let filepath = entry.path; + if (this._settings.absolute) { + filepath = utils.path.makeAbsolute(this._settings.cwd, filepath); + filepath = utils.path.unixify(filepath); + } + if (this._settings.markDirectories && entry.dirent.isDirectory()) { + filepath += '/'; + } + if (!this._settings.objectMode) { + return filepath; + } + return Object.assign(Object.assign({}, entry), { path: filepath }); + } +} +exports.default = EntryTransformer; + + +/***/ }), + +/***/ 914: +/***/ (function(module) { + +"use strict"; +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + + + +module.exports = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; + + +/***/ }), + +/***/ 928: +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Matcher = exports.BaseLibUtils = void 0; +const fs = __importStar(__webpack_require__(747)); +const os = __importStar(__webpack_require__(87)); +const path = __importStar(__webpack_require__(622)); +const adm_zip_1 = __importDefault(__webpack_require__(639)); +const http = __importStar(__webpack_require__(549)); +const del = __importStar(__webpack_require__(245)); +class BaseLibUtils { + constructor(baseLib) { + this.baseLib = baseLib; + } + isVcpkgSubmodule(gitPath, fullVcpkgPath) { + return __awaiter(this, void 0, void 0, function* () { + try { + const options = { + cwd: process.env.BUILD_SOURCESDIRECTORY, + failOnStdErr: false, + errStream: process.stdout, + outStream: process.stdout, + ignoreReturnCode: true, + silent: false, + windowsVerbatimArguments: false, + env: process.env + }; + const res = yield this.baseLib.execSync(gitPath, ['submodule', 'status', fullVcpkgPath], options); + let isSubmodule = false; + if (res.error !== null) { + isSubmodule = res.code == 0; + let msg; + msg = `'git submodule ${fullVcpkgPath}': exit code='${res.code}' `; + // If not null or undefined. + if (res.stdout) { + msg += `, stdout='${res.stdout.trim()}'`; + } + // If not null or undefined. + if (res.stderr) { + msg += `, stderr='${res.stderr.trim()}'`; + } + msg += '.'; + this.baseLib.debug(msg); + } + return isSubmodule; + } + catch (error) { + this.baseLib.warning(`ïsVcpkgSubmodule() failed: ${error}`); + return false; + } + }); + } + throwIfErrorCode(errorCode) { + if (errorCode !== 0) { + const errMsg = `Last command execution failed with error code '${errorCode}'.`; + this.baseLib.error(errMsg); + throw new Error(errMsg); + } + } + isWin32() { + return os.platform().toLowerCase() === 'win32'; + } + isMacos() { + return os.platform().toLowerCase() === 'darwin'; + } + // freeBSD or openBSD + isBSD() { + return os.platform().toLowerCase().indexOf("bsd") != -1; + } + isLinux() { + return os.platform().toLowerCase() === 'linux'; + } + isDarwin() { + return os.platform().toLowerCase() === 'darwin'; + } + getVcpkgExePath(vcpkgRoot) { + const vcpkgExe = this.isWin32() ? "vcpkg.exe" : "vcpkg"; + const vcpkgExePath = path.join(vcpkgRoot, vcpkgExe); + return vcpkgExePath; + } + directoryExists(path) { + try { + return this.baseLib.stats(path).isDirectory(); + } + catch (error) { + this.baseLib.debug(`directoryExists(${path}): ${"" + error}`); + return false; + } + } + fileExists(path) { + try { + return this.baseLib.stats(path).isFile(); + } + catch (error) { + this.baseLib.debug(`fileExists(${path}): ${"" + error}`); + return false; + } + } + readFile(path) { + try { + const readString = fs.readFileSync(path, { encoding: 'utf8', flag: 'r' }); + this.baseLib.debug(`readFile(${path})='${readString}'.`); + return [true, readString]; + } + catch (error) { + this.baseLib.debug(`readFile(${path}): ${"" + error}`); + return [false, error]; + } + } + writeFile(file, content) { + this.baseLib.debug(`Writing to file '${file}' content '${content}'.`); + this.baseLib.writeFile(file, content); + } + getDefaultTriplet() { + const envVar = process.env["VCPKG_DEFAULT_TRIPLET"]; + if (envVar) { + return envVar; + } + else { + if (this.isWin32()) { + return "x86-windows"; + } + else if (this.isLinux()) { + return "x64-linux"; + } + else if (this.isMacos()) { + return "x64-osx"; + } + else if (this.isBSD()) { + return "x64-freebsd"; + } + } + return ""; + } + static extractTriplet(args, readFile) { + let triplet = null; + // Split string on any 'whitespace' character + const argsSplitted = args.split(/\s/).filter((a) => a.length != 0); + let index = 0; + for (; index < argsSplitted.length; index++) { + let arg = argsSplitted[index].trim(); + // remove all whitespace characters (e.g. newlines, tabs, blanks) + arg = arg.replace(/\s/, ''); + if (arg === "--triplet") { + index++; + if (index < argsSplitted.length) { + triplet = argsSplitted[index]; + return triplet.trim(); + } + } + if (arg.startsWith("@")) { + const [ok, content] = readFile(arg.substring(1)); + if (ok) { + const t = BaseLibUtils.extractTriplet(content, readFile); + if (t) { + return t.trim(); + } + } + } + } + return triplet; + } + resolveArguments(args, readFile) { + let resolvedArguments = ""; + // Split string on any 'whitespace' character + const argsSplitted = args.split(/\s/).filter((a) => a.length != 0); + let index = 0; + for (; index < argsSplitted.length; index++) { + let arg = argsSplitted[index].trim(); + // remove all whitespace characters (e.g. newlines, tabs, blanks) + arg = arg.replace(/\s/, ''); + let isResponseFile = false; + if (arg.startsWith("@")) { + const resolvedFilePath = BaseLibUtils.normalizePath(arg); + if (this.baseLib.exist(resolvedFilePath)) { + const [ok, content] = readFile(resolvedFilePath); + if (ok && content) { + isResponseFile = true; + resolvedArguments += content; + } + } + } + if (!isResponseFile) { + resolvedArguments += arg; + } + } + return resolvedArguments; + } + // Force 'name' env variable to have value of 'value'. + setEnvVar(name, value) { + // Set variable both as env var and as step variable, which might be re-used in subseqeunt steps. + process.env[name] = value; + this.baseLib.setVariable(name, value); + this.baseLib.debug(`Set variable and the env variable '${name}' to value '${value}'.`); + } + trimString(value) { + var _a; + return (_a = value === null || value === void 0 ? void 0 : value.trim()) !== null && _a !== void 0 ? _a : ""; + } + wrapOp(name, fn) { + return __awaiter(this, void 0, void 0, function* () { + this.baseLib.beginOperation(name); + let result; + try { + result = yield fn(); + } + finally { + this.baseLib.endOperation(); + } + return result; + }); + } + wrapOpSync(name, fn) { + this.baseLib.beginOperation(name); + let result; + try { + result = fn(); + } + finally { + this.baseLib.endOperation(); + } + return result; + } + /** + * Check whether the current generator selected in the command line + * is -G Ninja or -G Ninja Multi-Config. + * @export + * @param {string} commandLineString The command line as string + * @returns {boolean} + */ + isNinjaGenerator(args) { + for (const arg of args) { + if (/-G[\s]*(?:\"Ninja.*\"|Ninja.*)/.test(arg)) + return true; + } + return false; + } + isMakeProgram(args) { + for (const arg of args) { + if (/-DCMAKE_MAKE_PROGRAM/.test(arg)) + return true; + } + return false; + } + isToolchainFile(args) { + for (const arg of args) { + if (/-DCMAKE_TOOLCHAIN_FILE/.test(arg)) + return true; + } + return false; + } + getToolchainFile(args) { + this.baseLib.debug(`getToolchainFile(${JSON.stringify(args)})<<`); + for (const arg of args) { + const matches = /-DCMAKE_TOOLCHAIN_FILE(?::[^\s]*)?=([^\s]*)/.exec(arg); + if (matches != null) { + if (matches.length > 1) { + this.baseLib.debug(`match found=${matches[1]}`); + return matches[1]; + } + } + } + return undefined; + } + removeToolchainFile(args) { + return args.filter(a => !/-DCMAKE_TOOLCHAIN_FILE(:[A-Za-z]+)?=[^\s]+/.test(a)); + } + mkdir(target, options) { + fs.mkdirSync(target, options); + } + rm(target) { + del.sync(target); + } + test(aPath) { + const result = fs.existsSync(aPath); + return result; + } + downloadFile(url) { + return __awaiter(this, void 0, void 0, function* () { + const downloadsDirName = "dl"; + // validate parameters + if (!url) { + throw new Error('downloadFile: Parameter "url" must be set.'); + } + const downloadsDirectory = path.join(yield this.baseLib.getBinDir(), downloadsDirName); + const scrubbedUrl = url.replace(/[/\:?]/g, '_'); + const targetPath = path.join(downloadsDirectory, scrubbedUrl); + const marker = targetPath + '.completed'; + // skip if already downloaded + if (this.test(marker)) { + console.log(`Found downloaded file at: ${targetPath}`); + return Promise.resolve(targetPath); + } + else { + console.log(`Downloading url '${url}' to file '${targetPath}'.`); + // delete any previous partial attempt + if (this.test(targetPath)) { + this.rm(targetPath); + } + // download the file + this.mkdir(downloadsDirectory, { recursive: true }); + const file = fs.createWriteStream(targetPath, { autoClose: true }); + return new Promise((resolve, reject) => { + const request = http.https.get(url, (response) => { + response.pipe(file).on('finish', () => { + this.baseLib.debug(`statusCode: ${response.statusCode}.`); + this.baseLib.debug(`headers: ${response.headers}.`); + console.log(`'${url}' downloaded to: '${targetPath}'`); + fs.writeFileSync(marker, ''); + request.end(); + resolve(targetPath); + }).on('error', (error) => reject(new Error(`statusCode='${response.statusCode}', error='${error.toString()}'.`))); + }); + }); + } + }); + } + /** + * Downloads and extracts an archive file. + * @returns The path to the extracted content. + */ + downloadArchive(url) { + return __awaiter(this, void 0, void 0, function* () { + if (!url) { + throw new Error('downloadArchive: url must be provided!'); + } + try { + const targetFileName = url.replace(/[\/\\:?]/g, '_'); + // 'x' for extracted content. + const targetPath = path.join(yield this.baseLib.getBinDir(), 'x', targetFileName); + const marker = targetPath + '.completed'; + if (!this.test(marker)) { + // download the whole archive. + const archivePath = yield this.downloadFile(url); + // extract the archive overwriting anything. + console.log(`Extracting archive '${archivePath}' ...`); + this.mkdir(targetPath, { recursive: true }); + const zip = new adm_zip_1.default(archivePath); + zip.extractAllTo(targetPath, true); + // write the completed file marker. + fs.writeFileSync(marker, ''); + } + return targetPath; + } + catch (exception) { + throw new Error(`Failed to download the Ninja executable: '${exception}'.`); + } + }); + } + /** + * Get a set of commands to be run in the shell of the host OS. + * @export + * @param {string[]} args + * @returns {(trm.ToolRunner | undefined)} + */ + getScriptCommand(args) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + let tool; + if (this.isWin32()) { + const cmdExe = (_a = process.env.COMSPEC) !== null && _a !== void 0 ? _a : "cmd.exe"; + const cmdPath = yield this.baseLib.which(cmdExe, true); + tool = this.baseLib.tool(cmdPath); + tool.arg('/c'); + tool.line(args); + } + else { + const shPath = yield this.baseLib.which('sh', true); + tool = this.baseLib.tool(shPath); + tool.arg('-c'); + tool.arg(args); + return tool; + } + }); + } + isVariableStrippingPath(variableName) { + // Avoid that the PATH is minimized by MSBuild props: + // https://github.com/lukka/run-cmake/issues/8#issuecomment-606956604 + return (variableName.toUpperCase() === "__VSCMD_PREINIT_PATH"); + } + parseVcpkgEnvOutput(data) { + const map = {}; + const regex = { + param: /^\s*([^=]+?)\s*=\s*(.*?)\s*$/, + }; + const lines = data.split(/[\r\n]+/); + for (const line of lines) { + if (regex.param.test(line)) { + const match = line.match(regex.param); + if (match) { + map[match[1]] = match[2]; + } + } + } + return map; + } + /** + * Normalize a filesystem path with path.normalize(), then remove any trailing space. + * + * @export + * @param {string} aPath The string representing a filesystem path. + * @returns {string} The normalized path without trailing slash. + */ + static normalizePath(aPath) { + aPath = path.normalize(aPath); + if (/[\\\/]$/.test(aPath) && aPath.length > 1) + aPath = aPath.slice(0, -1); + return aPath; + } + static throwIfUndefined(obj, name) { + if (obj === undefined) + throw new Error(`Agument '${name}' is undefined`); + } +} +exports.BaseLibUtils = BaseLibUtils; +BaseLibUtils.cachingFormatEnvName = 'AZP_CACHING_CONTENT_FORMAT'; +class Matcher { + constructor(name, baseLib, fromPath) { + this.name = name; + this.baseLib = baseLib; + this.fromPath = fromPath; + const matcherFilePath = path.join(__dirname, `${name}.json`); + fromPath; + this.baseLib.addMatcher(matcherFilePath); + } + dispose() { + this.baseLib.removeMatcher(path.join(__dirname, `${this.name}.json`)); + } + static createMatcher(name, baseLib, fromPath) { + return new Matcher(name, baseLib, fromPath); + } +} +exports.Matcher = Matcher; +//# sourceMappingURL=utils.js.map /***/ }), @@ -19359,6 +19947,33 @@ function clone (obj) { } +/***/ }), + +/***/ 946: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +// Copyright (c) 2019-2020 Luca Cappa +// Released under the term specified in file LICENSE.txt +// SPDX short identifier: MIT +Object.defineProperty(exports, "__esModule", { value: true }); +exports.setupOnly = exports.vcpkgRoot = exports.doNotUpdateVcpkg = exports.cleanAfterBuild = exports.vcpkgLastBuiltCommitId = exports.vcpkgArtifactIgnoreEntries = exports.vcpkgDirectory = exports.vcpkgTriplet = exports.outVcpkgTriplet = exports.outVcpkgRootPath = exports.vcpkgCommitId = exports.vcpkgGitURL = exports.vcpkgArguments = void 0; +exports.vcpkgArguments = 'vcpkgArguments'; +exports.vcpkgGitURL = 'vcpkgGitURL'; +exports.vcpkgCommitId = 'vcpkgGitCommitId'; +exports.outVcpkgRootPath = "RUNVCPKG_VCPKG_ROOT"; +exports.outVcpkgTriplet = "RUNVCPKG_VCPKG_TRIPLET"; +exports.vcpkgTriplet = "vcpkgTriplet"; +exports.vcpkgDirectory = "vcpkgDirectory"; +exports.vcpkgArtifactIgnoreEntries = "vcpkgArtifactIgnoreEntries"; +exports.vcpkgLastBuiltCommitId = 'vcpkgLastBuiltCommitId'; +exports.cleanAfterBuild = 'cleanAfterBuild'; +exports.doNotUpdateVcpkg = 'doNotUpdateVcpkg'; +exports.vcpkgRoot = 'VCPKG_ROOT'; +exports.setupOnly = 'setupOnly'; +//# sourceMappingURL=vcpkg-globals.js.map + /***/ }), /***/ 949: @@ -19405,18 +20020,103 @@ exports.default = Reader; /***/ 962: /***/ (function(__unusedmodule, exports, __webpack_require__) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const common = __webpack_require__(617); -class Reader { - constructor(_root, _settings) { - this._root = _root; - this._settings = _settings; - this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); - } -} -exports.default = Reader; +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const common = __webpack_require__(617); +class Reader { + constructor(_root, _settings) { + this._root = _root; + this._settings = _settings; + this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator); + } +} +exports.default = Reader; + + +/***/ }), + +/***/ 966: +/***/ (function(module) { + +"use strict"; + +const singleComment = Symbol('singleComment'); +const multiComment = Symbol('multiComment'); +const stripWithoutWhitespace = () => ''; +const stripWithWhitespace = (string, start, end) => string.slice(start, end).replace(/\S/g, ' '); + +const isEscaped = (jsonString, quotePosition) => { + let index = quotePosition - 1; + let backslashCount = 0; + + while (jsonString[index] === '\\') { + index -= 1; + backslashCount += 1; + } + + return Boolean(backslashCount % 2); +}; + +module.exports = (jsonString, options = {}) => { + if (typeof jsonString !== 'string') { + throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``); + } + + const strip = options.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; + + let insideString = false; + let insideComment = false; + let offset = 0; + let result = ''; + + for (let i = 0; i < jsonString.length; i++) { + const currentCharacter = jsonString[i]; + const nextCharacter = jsonString[i + 1]; + + if (!insideComment && currentCharacter === '"') { + const escaped = isEscaped(jsonString, i); + if (!escaped) { + insideString = !insideString; + } + } + + if (insideString) { + continue; + } + + if (!insideComment && currentCharacter + nextCharacter === '//') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = singleComment; + i++; + } else if (insideComment === singleComment && currentCharacter + nextCharacter === '\r\n') { + i++; + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + continue; + } else if (insideComment === singleComment && currentCharacter === '\n') { + insideComment = false; + result += strip(jsonString, offset, i); + offset = i; + } else if (!insideComment && currentCharacter + nextCharacter === '/*') { + result += jsonString.slice(offset, i); + offset = i; + insideComment = multiComment; + i++; + continue; + } else if (insideComment === multiComment && currentCharacter + nextCharacter === '*/') { + i++; + insideComment = false; + result += strip(jsonString, offset, i + 1); + offset = i + 1; + continue; + } + } + + return result + (insideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset)); +}; /***/ }), @@ -19443,329 +20143,6 @@ function createFileSystemAdapter(fsMethods) { exports.createFileSystemAdapter = createFileSystemAdapter; -/***/ }), - -/***/ 997: -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -// Copyright (c) 2019-2020 Luca Cappa -// Released under the term specified in file LICENSE.txt -// SPDX short identifier: MIT -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = __webpack_require__(622); -const fs = __webpack_require__(747); -const cmakesettings_runner_1 = __webpack_require__(432); -const globals = __webpack_require__(358); -const ninjalib = __webpack_require__(141); -const utils = __webpack_require__(477); -const using_statement_1 = __webpack_require__(443); -var TaskModeType; -(function (TaskModeType) { - TaskModeType[TaskModeType["CMakeListsTxtBasic"] = 1] = "CMakeListsTxtBasic"; - TaskModeType[TaskModeType["CMakeListsTxtAdvanced"] = 2] = "CMakeListsTxtAdvanced"; - TaskModeType[TaskModeType["CMakeSettingsJson"] = 3] = "CMakeSettingsJson"; -})(TaskModeType || (TaskModeType = {})); -function getTargetType(typeString) { - return TaskModeType[typeString]; -} -const CMakeGenerator = { - 'Unknown': {}, - 'VS16Arm': { 'G': 'Visual Studio 16 2019', 'A': 'ARM', 'MultiConfiguration': true }, - 'VS16Win32': { 'G': 'Visual Studio 16 2019', 'A': 'Win32', 'MultiConfiguration': true }, - 'VS16Win64': { 'G': 'Visual Studio 16 2019', 'A': 'x64', 'MultiConfiguration': true }, - 'VS16Arm64': { 'G': 'Visual Studio 16 2019', 'A': 'ARM64', 'MultiConfiguration': true }, - 'VS15Arm': { 'G': 'Visual Studio 15 2017', 'A': 'ARM', 'MultiConfiguration': true }, - 'VS15Win32': { 'G': 'Visual Studio 15 2017', 'A': 'Win32', 'MultiConfiguration': true }, - 'VS15Win64': { 'G': 'Visual Studio 15 2017', 'A': 'x64', 'MultiConfiguration': true }, - 'VS15Arm64': { 'G': 'Visual Studio 15 2017', 'A': 'ARM64', 'MultiConfiguration': true }, - 'Ninja': { 'G': 'Ninja', 'A': '', 'MultiConfiguration': false }, - 'NinjaMulti': { 'G': 'Ninja Multi-Config', 'A': '', 'MultiConfiguration': true }, - 'UnixMakefiles': { 'G': 'Unix Makefiles', 'A': '', 'MultiConfiguration': false } -}; -function getGenerator(generatorString) { - const generatorName = CMakeGenerator[generatorString]; - return generatorName; -} -class CMakeRunner { - constructor(tl) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; - this.tl = tl; - this.buildDir = ""; - this.generator = {}; - const mode = (_a = this.tl.getInput(globals.cmakeListsOrSettingsJson, true), (_a !== null && _a !== void 0 ? _a : "")); - const taskMode = getTargetType(mode); - if (!taskMode) { - throw new Error(`ctor(): invalid task mode '${mode}'.`); - } - this.taskMode = taskMode; - let required = this.taskMode === TaskModeType.CMakeSettingsJson; - this.cmakeSettingsJsonPath = (_b = this.tl.getPathInput(globals.cmakeSettingsJsonPath, required, required), (_b !== null && _b !== void 0 ? _b : "")); - required = this.taskMode !== TaskModeType.CMakeSettingsJson; - this.cmakeListsTxtPath = (_c = this.tl.getPathInput(globals.cmakeListsTxtPath, required, required), (_c !== null && _c !== void 0 ? _c : "")); - this.buildDir = (_d = this.tl.getInput(globals.buildDirectory, this.taskMode === TaskModeType.CMakeListsTxtBasic), (_d !== null && _d !== void 0 ? _d : "")); - this.appendedArgs = (_e = this.tl.getInput(globals.cmakeAppendedArgs, false), (_e !== null && _e !== void 0 ? _e : "")); - this.configurationFilter = (_f = this.tl.getInput(globals.configurationRegexFilter, false), (_f !== null && _f !== void 0 ? _f : "")); - this.ninjaPath = ''; - if (this.tl.isFilePathSupplied(globals.ninjaPath)) { - this.ninjaPath = (_g = tl.getInput(globals.ninjaPath, false), (_g !== null && _g !== void 0 ? _g : "")); - } - this.cmakeToolchainPath = ""; - if (this.tl.isFilePathSupplied(globals.cmakeToolchainPath)) { - this.cmakeToolchainPath = (_h = tl.getInput(globals.cmakeToolchainPath, false), (_h !== null && _h !== void 0 ? _h : "")); - } - const gen = (_j = this.tl.getInput(globals.cmakeGenerator, this.taskMode === TaskModeType.CMakeListsTxtBasic), (_j !== null && _j !== void 0 ? _j : "")); - this.generator = getGenerator(gen); - this.ninjaDownloadUrl = (_k = this.tl.getInput(globals.ninjaDownloadUrl, false), (_k !== null && _k !== void 0 ? _k : "")); - this.doBuild = (_l = this.tl.getBoolInput(globals.buildWithCMake, false), (_l !== null && _l !== void 0 ? _l : false)); - this.doBuildArgs = (_m = this.tl.getInput(globals.buildWithCMakeArgs, false), (_m !== null && _m !== void 0 ? _m : "")); - this.cmakeSourceDir = path.dirname((_o = path.resolve(this.cmakeListsTxtPath), (_o !== null && _o !== void 0 ? _o : ""))); - this.useVcpkgToolchainFile = (_p = this.tl.getBoolInput(globals.useVcpkgToolchainFile, false), (_p !== null && _p !== void 0 ? _p : false)); - this.cmakeBuildType = (_q = this.tl.getInput(globals.cmakeBuildType, this.taskMode === TaskModeType.CMakeListsTxtBasic), (_q !== null && _q !== void 0 ? _q : "")); - this.vcpkgTriplet = (_r = (this.tl.getInput(globals.vcpkgTriplet, false) || - process.env.RUNVCPKG_VCPKG_TRIPLET), (_r !== null && _r !== void 0 ? _r : "")); - this.sourceScript = (_s = this.tl.getInput(globals.cmakeWrapperCommand, false), (_s !== null && _s !== void 0 ? _s : "")); - } - static warnIfUnused(inputName, taskMode) { - if (inputName in CMakeRunner.modePerInput) { - const usedInMode = CMakeRunner.modePerInput[name]; - if (usedInMode) { - if (usedInMode.indexOf(taskMode) < 0) { } - // Unfortunately there is not a way to discriminate between a value provided by the user - // from a default value (not provided by the user), hence it is not possible to identify - // what the user provided. - //??this.tl.warning(`The input '${inputName}' is ignored in mode '${taskMode}'`); - } - } - } - run() { - return __awaiter(this, void 0, void 0, function* () { - this.tl.debug('run()<<'); - yield this.configure(); - }); - } - configure() { - var _a; - return __awaiter(this, void 0, void 0, function* () { - this.tl.debug('configure()<<'); - // Contains the '--config ' when using multiconfiguration generators. - let prependedBuildArguments = ""; - let cmakeArgs = []; - switch (this.taskMode) { - case TaskModeType.CMakeListsTxtAdvanced: - case TaskModeType.CMakeListsTxtBasic: { - // Search for CMake tool and run it. - let cmake; - if (this.sourceScript) { - cmake = this.tl.tool(this.sourceScript); - cmakeArgs.push(yield this.tl.which('cmake', true)); - } - else { - cmake = this.tl.tool(yield this.tl.which('cmake', true)); - } - if (this.taskMode === TaskModeType.CMakeListsTxtAdvanced) { - // If Ninja is required, specify the path to it. - if (utils.isNinjaGenerator([this.appendedArgs])) { - if (!utils.isMakeProgram([this.appendedArgs])) { - const ninjaPath = yield ninjalib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); - cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); - } - } - if (this.appendedArgs) { - this.tl.debug(`Parsing additional CMake args: ${this.appendedArgs}`); - const addedArgs = cmake._argStringToArray(this.appendedArgs); - this.tl.debug(`Appending args: ${JSON.stringify(addedArgs)}`); - cmakeArgs = [...cmakeArgs, ...addedArgs]; - } - } - else if (this.taskMode === TaskModeType.CMakeListsTxtBasic) { - const generatorName = this.generator['G']; - const generatorArch = this.generator['A']; - const generatorIsMultiConf = (_a = this.generator['MultiConfiguration'], (_a !== null && _a !== void 0 ? _a : false)); - cmakeArgs.push(`-G${generatorName}`); - if (generatorArch) { - cmakeArgs.push(`-A${generatorArch}`); - } - if (CMakeRunner.isNinjaGenerator(generatorName)) { - const ninjaPath = yield ninjalib.retrieveNinjaPath(this.ninjaPath, this.ninjaDownloadUrl); - cmakeArgs.push(`-DCMAKE_MAKE_PROGRAM=${ninjaPath}`); - } - if (this.cmakeToolchainPath) { - cmakeArgs.push(`-DCMAKE_TOOLCHAIN_FILE=${this.cmakeToolchainPath}`); - } - // Add CMake's build type, unless a multi configuration generator is being used. - if (!generatorIsMultiConf) { - cmakeArgs.push(`-DCMAKE_BUILD_TYPE=${this.cmakeBuildType}`); - } - prependedBuildArguments = this.prependBuildConfigIfNeeded(this.doBuildArgs, generatorIsMultiConf, this.cmakeBuildType); - } - // Use vcpkg toolchain if requested. - if (this.useVcpkgToolchainFile === true) { - cmakeArgs = yield utils.injectVcpkgToolchain(cmakeArgs, this.vcpkgTriplet); - } - // The source directory is required for any mode. - cmakeArgs.push(this.cmakeSourceDir); - this.tl.debug(`CMake arguments: ${cmakeArgs}`); - for (const arg of cmakeArgs) { - cmake.arg(arg); - } - // Ensure the build directory is existing. - yield this.tl.mkdirP(this.buildDir); - const options = { - cwd: this.buildDir, - failOnStdErr: false, - errStream: process.stdout, - outStream: process.stdout, - ignoreReturnCode: true, - silent: false, - windowsVerbatimArguments: false, - env: process.env - }; - this.tl.debug(`Generating project files with CMake in build directory '${options.cwd}' ...`); - let code = -1; - yield using_statement_1.using(utils.createMatcher('cmake', this.cmakeSourceDir), (matcher) => __awaiter(this, void 0, void 0, function* () { - code = yield utils.wrapOp("Generate project files with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield cmake.exec(options); })); - })); - if (code !== 0) { - throw new Error(`"CMake failed with error code: '${code}'.`); - } - if (this.doBuild) { - yield using_statement_1.using(utils.createMatcher(CMakeRunner.getBuildMatcher(this.buildDir, this.tl)), (matcher) => __awaiter(this, void 0, void 0, function* () { - yield utils.wrapOp("Build with CMake", () => __awaiter(this, void 0, void 0, function* () { return yield CMakeRunner.build(this.tl, this.buildDir, prependedBuildArguments + this.doBuildArgs, options); })); - })); - } - break; - } - case TaskModeType.CMakeSettingsJson: { - const cmakeJson = new cmakesettings_runner_1.CMakeSettingsJsonRunner(this.cmakeSettingsJsonPath, this.configurationFilter, this.appendedArgs, this.tl.getSrcDir(), this.vcpkgTriplet, this.useVcpkgToolchainFile, this.doBuild, this.ninjaPath, this.ninjaDownloadUrl, this.sourceScript, this.buildDir, this.tl); - yield utils.wrapOp("Run CMake with CMakeSettings.json", () => __awaiter(this, void 0, void 0, function* () { return yield cmakeJson.run(); })); - break; - } - } - }); - } - static isNinjaGenerator(generatorName) { - return generatorName === CMakeGenerator['Ninja']['G'] || - generatorName === CMakeGenerator['NinjaMulti']['G']; - } - /// If not already provided, creates the '--config ' argument to pass when building. - /// Return a string of arguments to prepend the build arguments. - prependBuildConfigIfNeeded(buildArgs, multiConfi, buildType) { - let prependArgs = ""; - if (multiConfi && !buildArgs.includes("--config")) { - prependArgs = ` --config ${buildType} `; - } - return prependArgs; - } - /** - * Build with CMake. - * @export - * @param {string} buildDir - * @param {string} buildArgs - * @param {trm.IExecOptions} options - * @param {string} sourceScript - * @returns {Promise} - */ - static build(baseLib, buildDir, buildArgs, options) { - return __awaiter(this, void 0, void 0, function* () { - // Run CMake with the given arguments - const cmake = baseLib.tool(yield baseLib.which('cmake', true)); - cmake.arg("--build"); - cmake.arg("."); - if (buildArgs) - cmake.line(buildArgs); - // Run the command in the build directory - options.cwd = buildDir; - console.log(`Building with CMake in build directory '${options.cwd}' ...`); - const code = yield cmake.exec(options); - if (code !== 0) { - throw new Error(`"Build failed with error code: '${code}'."`); - } - }); - } - static getDefaultMatcher() { - const plat = process.platform; - return plat === "win32" ? CMakeRunner.msvcMatcher : - plat === "darwin" ? CMakeRunner.clangMatcher : CMakeRunner.gccMatcher; - } - static getCompilerMatcher(line) { - let matcherName = undefined; - if (line.includes('g++') || line.includes('gcc') || line.includes('c++')) - matcherName = CMakeRunner.gccMatcher; - else if (line.includes('cl.exe')) - matcherName = CMakeRunner.msvcMatcher; - else if (line.includes('clang')) - matcherName = CMakeRunner.clangMatcher; - return matcherName; - } - static getBuildMatcher(buildDir, tl) { - var _a; - let cxxMatcher; - let ccMatcher; - try { - const cmakeCacheTxtPath = path.join(buildDir, "CMakeCache.txt"); - const cache = fs.readFileSync(cmakeCacheTxtPath); - tl.debug(`Loaded fileCMakeCache.txt at path='${cmakeCacheTxtPath}'`); - if (cache) { - const cacheContent = cache.toString(); - for (const line of cacheContent.split('\n')) { - tl.debug(`text=${line}`); - if (line.includes("CMAKE_CXX_COMPILER:")) { - tl.debug(`Found CXX compiler: '${line}'.`); - cxxMatcher = CMakeRunner.getCompilerMatcher(line); - tl.debug(`Matcher selected for CXX: ${cxxMatcher}`); - break; - } - if (line.includes("CMAKE_C_COMPILER:")) { - tl.debug(`Found C compiler: '${line}'.`); - ccMatcher = CMakeRunner.getCompilerMatcher(line); - tl.debug(`Matcher selected for CC: ${ccMatcher}`); - break; - } - } - } - } - catch (error) { - tl.debug(error.toString()); - } - const defaultMatcher = CMakeRunner.getDefaultMatcher(); - tl.debug(`Default matcher according to platform is: ${defaultMatcher}`); - const selectedMatcher = (_a = (cxxMatcher !== null && cxxMatcher !== void 0 ? cxxMatcher : ccMatcher), (_a !== null && _a !== void 0 ? _a : defaultMatcher)); - tl.debug(`Selected matcher: ${selectedMatcher}`); - return selectedMatcher; - } -} -exports.CMakeRunner = CMakeRunner; -CMakeRunner.modePerInput = { - [globals.cmakeListsTxtPath]: [TaskModeType.CMakeListsTxtBasic, TaskModeType.CMakeListsTxtAdvanced], - [globals.cmakeSettingsJsonPath]: [TaskModeType.CMakeSettingsJson], - [globals.cmakeToolchainPath]: [TaskModeType.CMakeListsTxtBasic], - /*[globals.useVcpkgToolchainFile]: all */ - /*[globals.vcpkgTriplet]: all */ - [globals.cmakeBuildType]: [TaskModeType.CMakeListsTxtBasic], - [globals.cmakeGenerator]: [TaskModeType.CMakeListsTxtBasic], - /*[globals.buildDirectory]: all */ - [globals.cmakeAppendedArgs]: [TaskModeType.CMakeListsTxtAdvanced, TaskModeType.CMakeSettingsJson], - [globals.configurationRegexFilter]: [TaskModeType.CMakeSettingsJson], - [globals.buildWithCMakeArgs]: [TaskModeType.CMakeListsTxtAdvanced, TaskModeType.CMakeListsTxtBasic] -}; -CMakeRunner.gccMatcher = 'gcc'; -CMakeRunner.clangMatcher = 'clang'; -CMakeRunner.msvcMatcher = 'msvc'; - -//# sourceMappingURL=cmake-runner.js.map - - /***/ }) /******/ }); \ No newline at end of file diff --git a/dist/lib.json b/dist/lib.json new file mode 100644 index 00000000..846ae324 --- /dev/null +++ b/dist/lib.json @@ -0,0 +1,36 @@ +{ + "messages": { + "LIB_UnhandledEx": "Unhandled: %s", + "LIB_FailOnCode": "Failure return code: %d", + "LIB_MkdirFailed": "Unable to create directory '%s'. %s", + "LIB_MkdirFailedFileExists": "Unable to create directory '%s'. Conflicting file exists: '%s'", + "LIB_MkdirFailedInvalidDriveRoot": "Unable to create directory '%s'. Root directory does not exist: '%s'", + "LIB_MkdirFailedInvalidShare": "Unable to create directory '%s'. Unable to verify the directory exists: '%s'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.", + "LIB_MultilineSecret": "Secrets cannot contain multiple lines", + "LIB_ProcessError": "There was an error when attempting to execute the process '%s'. This may indicate the process failed to start. Error: %s", + "LIB_ProcessExitCode": "The process '%s' failed with exit code %s", + "LIB_ProcessStderr": "The process '%s' failed because one or more lines were written to the STDERR stream", + "LIB_ReturnCode": "Return code: %d", + "LIB_ResourceFileNotExist": "Resource file doesn\\'t exist: %s", + "LIB_ResourceFileAlreadySet": "Resource file has already set to: %s", + "LIB_ResourceFileNotSet": "Resource file haven\\'t set, can\\'t find loc string for key: %s", + "LIB_StdioNotClosed": "The STDIO streams did not close within %s seconds of the exit event from process '%s'. This may indicate a child process inherited the STDIO streams and has not yet exited.", + "LIB_WhichNotFound_Linux": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.", + "LIB_WhichNotFound_Win": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.", + "LIB_LocStringNotFound": "Can\\'t find loc string for key: %s", + "LIB_ParameterIsRequired": "%s not supplied", + "LIB_InputRequired": "Input required: %s", + "LIB_InvalidPattern": "Invalid pattern: '%s'", + "LIB_EndpointNotExist": "Endpoint not present: %s", + "LIB_EndpointDataNotExist": "Endpoint data parameter %s not present: %s", + "LIB_EndpointAuthNotExist": "Endpoint auth data not present: %s", + "LIB_InvalidEndpointAuth": "Invalid endpoint auth: %s", + "LIB_InvalidSecureFilesInput": "Invalid secure file input: %s", + "LIB_PathNotFound": "Not found %s: %s", + "LIB_PathHasNullByte": "Path cannot contain null bytes", + "LIB_OperationFailed": "Failed %s: %s", + "LIB_UseFirstGlobMatch": "Multiple workspace matches. using first.", + "LIB_MergeTestResultNotSupported": "Merging test results from multiple files to one test run is not supported on this version of build agent for OSX/Linux, each test result file will be published as a separate test run in VSO/TFS.", + "LIB_PlatformNotSupported": "Platform not supported: %s" + } +} diff --git a/gulpfile.js b/gulpfile.js index 742b4390..79eb8c0f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,13 +24,6 @@ var build = function () { .pipe(gulp.dest(path.join('build'))) } -// Copy action's library to its deployment directory. -var copyLib = function () { - return gulp.src( - ['./build/libs/run-cmake-lib/src/**/*.js']) - .pipe(gulp.dest('./build/src/')) -} - var eslinter = function () { // lint only the files of the action, e.g. not of the /libs/ return gulp.src(['**/*.ts']) @@ -45,14 +38,6 @@ var eslinter = function () { .pipe(eslint.failAfterError()); } -// Copy shared library files to consumers. -var copyBaseLib = function () { - return gulp.src( - ['./build/libs/action-base-lib/src/*.js', - './build/libs/base-lib/src/*.js']) - .pipe(gulp.dest('./build/src/')); -} - // Copy matchers to consumers. var copyMatchersJson = function () { return gulp.src( @@ -71,10 +56,8 @@ var test = function () { gulp.task('test', test); gulp.task('eslint', eslinter); -gulp.task('copyLib', copyLib); -gulp.task('copyBaseLib', copyBaseLib); gulp.task('copyMatchersJson', copyMatchersJson); gulp.task('build', build); gulp.task('installPackages', installPackages); -gulp.task('default', gulp.series('installPackages', 'eslint', 'build', 'copyLib', 'copyBaseLib', 'copyMatchersJson')); +gulp.task('default', gulp.series('installPackages', 'eslint', 'build', 'copyMatchersJson')); diff --git a/libs b/libs deleted file mode 160000 index 687dc0fe..00000000 --- a/libs +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 687dc0fe33fe4b13e5cb7abd481d5b1b46800d13 diff --git a/package-lock.json b/package-lock.json index 398dbcc2..ae957ca9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -639,6 +639,105 @@ "@types/yargs": "^13.0.0" } }, + "@lukka/action-lib": { + "version": "0.14.1", + "resolved": "https://npm.pkg.github.com/download/@lukka/action-lib/0.14.1/4da0cf2f8cd0da9c204f30780962e8e39e4e4d1427c74eb7830a23f0b2764dae", + "integrity": "sha512-lRBE9Kl+UkNsonvpeEs8rsoQpUa1EhZ4n2ztAkHTgsdXN9FqmSiUEp3a+8rSWfewCnVM8FND1/fJwHz+11aD3A==", + "requires": { + "@actions/core": "^1.2.3", + "@actions/exec": "^1.0.3", + "@actions/github": "^2.1.1", + "@actions/io": "^1.0.2", + "@lukka/base-lib": "^0.14.1", + "@lukka/base-util-lib": "^0.14.1", + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@lukka/base-lib": { + "version": "0.14.1", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-lib/0.14.1/6e5e753bf6c9fd3855ffa1b66056c2a68b074ddf0f23a08e7a99ba18e6cce3dc", + "integrity": "sha512-4hDpxY4TCkzjoGv9ECr33ZEX55u9KgkiZh2KD0ZKADOIt2sAYFJ7A/drP1zsTscMO5iK8cUOcuq7k7aGncrWPg==", + "requires": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@lukka/base-util-lib": { + "version": "0.14.1", + "resolved": "https://npm.pkg.github.com/download/@lukka/base-util-lib/0.14.1/d90451867e45656ba06f83e8339169ecfcc8f3ef8d190fcb93086d63c31c2123", + "integrity": "sha512-/yU+WT8XGLRTM5yM35J021PSe0OBea48U1/W94yIn/Yp7/p6+YU3Atb/1sCjwxbL8kGvh2CoL5txGvP/y16Mfg==", + "requires": { + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "minimist": ">=1.2.2", + "using-statement": "^0.3.1" + } + }, + "@lukka/run-cmake-lib": { + "version": "0.14.1", + "resolved": "https://npm.pkg.github.com/download/@lukka/run-cmake-lib/0.14.1/ce85084f75f6a3a526b5f417f1c8421d2d90f06078707b7921a00327784a3682", + "integrity": "sha512-0ez1+tXfzSbbM78cH0xffM4nuKjsHOWnrsfUzmfnVXOVJp1HiTi+7FokZbh+F8MVuBtYtRyAXHmXwI2a9TefXw==", + "requires": { + "@lukka/action-lib": "^0.14.1", + "@lukka/base-lib": "^0.14.1", + "@lukka/base-util-lib": "^0.14.1", + "@types/adm-zip": "^0.4.32", + "@types/follow-redirects": "^1.8.0", + "@types/q": "^1.5.1", + "@types/shelljs": "^0.8.6", + "@typescript-eslint/eslint-plugin": "^2.10.0", + "@typescript-eslint/parser": "^2.10.0", + "adm-zip": "^0.4.13", + "del": "^5.1.0", + "eslint": "^6.7.2", + "follow-redirects": "^1.9.0", + "lodash": ">=4.17.19", + "minimist": ">=1.2.2", + "strip-json-comments": "^3.1.1", + "using-statement": "^0.3.1" + }, + "dependencies": { + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==" + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + } + } + }, "@nodelib/fs.scandir": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", @@ -843,8 +942,7 @@ "@types/eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", - "dev": true + "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==" }, "@types/events": { "version": "3.0.0", @@ -916,8 +1014,7 @@ "@types/json-schema": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz", - "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==", - "dev": true + "integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==" }, "@types/minimatch": { "version": "3.0.3", @@ -929,6 +1026,20 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-11.15.4.tgz", "integrity": "sha512-z7deEbNOPcS7pb7uyaZhbITh18ruGghYh86VmUL2zJPKeu9tEAqF0goQH0dhWamHoBJpkyWroNxPZjzNvbYVCw==" }, + "@types/q": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.4.tgz", + "integrity": "sha512-1HcDas8SEj4z1Wc696tH56G8OlRaH/sqZOynNNB+HF0WOeXPaxTtbYzJY2oEfiUxjSKjhCKr+MvR7dCHcEelug==" + }, + "@types/shelljs": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.8.tgz", + "integrity": "sha512-lD3LWdg6j8r0VRBFahJVaxoW0SIcswxKaFUrmKl33RJVeeoNYQAz4uqCJ5Z6v4oIBOsC5GozX+I5SorIKiTcQA==", + "requires": { + "@types/glob": "*", + "@types/node": "*" + } + }, "@types/stack-utils": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-1.0.1.tgz", @@ -951,7 +1062,6 @@ "version": "2.16.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.16.0.tgz", "integrity": "sha512-TKWbeFAKRPrvKiR9GNxErQ8sELKqg1ZvXi6uho07mcKShBnCnqNpDQWP01FEvWKf0bxM2g7uQEI5MNjSNqvUpQ==", - "dev": true, "requires": { "@typescript-eslint/experimental-utils": "2.16.0", "eslint-utils": "^1.4.3", @@ -964,7 +1074,6 @@ "version": "2.16.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.16.0.tgz", "integrity": "sha512-bXTmAztXpqxliDKZgvWkl+5dHeRN+jqXVZ16peKKFzSXVzT6mz8kgBpHiVzEKO2NZ8OCU7dG61K9sRS/SkUUFQ==", - "dev": true, "requires": { "@types/json-schema": "^7.0.3", "@typescript-eslint/typescript-estree": "2.16.0", @@ -975,7 +1084,6 @@ "version": "2.16.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.16.0.tgz", "integrity": "sha512-+w8dMaYETM9v6il1yYYkApMSiwgnqXWJbXrA94LAWN603vXHACsZTirJduyeBOJjA9wT6xuXe5zZ1iCUzoxCfw==", - "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", "@typescript-eslint/experimental-utils": "2.16.0", @@ -987,7 +1095,6 @@ "version": "2.16.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.16.0.tgz", "integrity": "sha512-hyrCYjFHISos68Bk5KjUAXw0pP/455qq9nxqB1KkT67Pxjcfw+r6Yhcmqnp8etFL45UexCHUMrADHH7dI/m2WQ==", - "dev": true, "requires": { "debug": "^4.1.1", "eslint-visitor-keys": "^1.1.0", @@ -1002,7 +1109,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -1010,8 +1116,7 @@ "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" } } }, @@ -1050,8 +1155,7 @@ "acorn-jsx": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.1.0.tgz", - "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==", - "dev": true + "integrity": "sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw==" }, "acorn-walk": { "version": "6.2.0", @@ -1261,7 +1365,6 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -1761,8 +1864,7 @@ "chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==" }, "chokidar": { "version": "2.1.8", @@ -1926,7 +2028,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, "requires": { "restore-cursor": "^3.1.0" } @@ -1934,8 +2035,7 @@ "cli-width": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=" }, "cliui": { "version": "5.0.0", @@ -2352,7 +2452,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", - "dev": true, "requires": { "esutils": "^2.0.2" } @@ -2562,7 +2661,6 @@ "version": "6.8.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", - "dev": true, "requires": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", @@ -2607,7 +2705,6 @@ "version": "6.0.5", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, "requires": { "nice-try": "^1.0.4", "path-key": "^2.0.1", @@ -2619,8 +2716,7 @@ "semver": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" } } }, @@ -2628,7 +2724,6 @@ "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, "requires": { "ms": "^2.1.1" } @@ -2637,7 +2732,6 @@ "version": "12.3.0", "resolved": "https://registry.npmjs.org/globals/-/globals-12.3.0.tgz", "integrity": "sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw==", - "dev": true, "requires": { "type-fest": "^0.8.1" } @@ -2645,26 +2739,22 @@ "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", - "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==" }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", - "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true + "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==" }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true, "requires": { "shebang-regex": "^1.0.0" } @@ -2672,8 +2762,7 @@ "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" } } }, @@ -2729,7 +2818,6 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", - "dev": true, "requires": { "esrecurse": "^4.1.0", "estraverse": "^4.1.1" @@ -2739,7 +2827,6 @@ "version": "1.4.3", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", - "dev": true, "requires": { "eslint-visitor-keys": "^1.1.0" } @@ -2747,14 +2834,12 @@ "eslint-visitor-keys": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz", - "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==", - "dev": true + "integrity": "sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A==" }, "espree": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/espree/-/espree-6.1.2.tgz", "integrity": "sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA==", - "dev": true, "requires": { "acorn": "^7.1.0", "acorn-jsx": "^5.1.0", @@ -2764,8 +2849,7 @@ "acorn": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", - "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", - "dev": true + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==" } } }, @@ -2778,7 +2862,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", - "dev": true, "requires": { "estraverse": "^4.0.0" } @@ -2787,7 +2870,6 @@ "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, "requires": { "estraverse": "^4.1.0" } @@ -2947,7 +3029,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, "requires": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", @@ -3077,7 +3158,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.1.0.tgz", "integrity": "sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg==", - "dev": true, "requires": { "escape-string-regexp": "^1.0.5" } @@ -3086,7 +3166,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", - "dev": true, "requires": { "flat-cache": "^2.0.1" } @@ -3276,7 +3355,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", - "dev": true, "requires": { "flatted": "^2.0.0", "rimraf": "2.6.3", @@ -3287,7 +3365,6 @@ "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, "requires": { "glob": "^7.1.3" } @@ -3297,8 +3374,7 @@ "flatted": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz", - "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==", - "dev": true + "integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==" }, "flush-write-stream": { "version": "1.1.1", @@ -3862,8 +3938,7 @@ "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", - "dev": true + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=" }, "gensync": { "version": "1.0.0-beta.1", @@ -4673,7 +4748,6 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", - "dev": true, "requires": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -4682,8 +4756,7 @@ "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" } } }, @@ -4730,7 +4803,6 @@ "version": "7.0.3", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.0.3.tgz", "integrity": "sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw==", - "dev": true, "requires": { "ansi-escapes": "^4.2.1", "chalk": "^2.4.2", @@ -4751,7 +4823,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.0.tgz", "integrity": "sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg==", - "dev": true, "requires": { "type-fest": "^0.8.1" } @@ -4759,26 +4830,22 @@ "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" }, "emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", - "dev": true, "requires": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -4789,7 +4856,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", - "dev": true, "requires": { "ansi-regex": "^5.0.0" } @@ -4978,8 +5044,7 @@ "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" }, "is-regex": { "version": "1.0.5", @@ -5947,7 +6012,6 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -6014,8 +6078,7 @@ "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", - "dev": true + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" }, "json-stringify-safe": { "version": "5.0.1", @@ -6586,8 +6649,7 @@ "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, "minimatch": { "version": "3.0.4", @@ -6672,8 +6734,7 @@ "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" }, "nan": { "version": "2.14.0", @@ -6945,7 +7006,6 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", - "dev": true, "requires": { "mimic-fn": "^2.1.0" } @@ -6993,8 +7053,7 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "p-each-series": { "version": "1.0.0", @@ -7053,7 +7112,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, "requires": { "callsites": "^3.0.0" } @@ -7245,8 +7303,7 @@ "progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==" }, "prompts": { "version": "2.3.0", @@ -7504,8 +7561,7 @@ "regexpp": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", - "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", - "dev": true + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==" }, "remove-bom-buffer": { "version": "3.0.0", @@ -7680,7 +7736,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, "requires": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -7713,7 +7768,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, "requires": { "is-promise": "^2.1.0" } @@ -7727,7 +7781,6 @@ "version": "6.5.4", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz", "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==", - "dev": true, "requires": { "tslib": "^1.9.0" } @@ -7991,7 +8044,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", - "dev": true, "requires": { "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", @@ -8194,8 +8246,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.16.1", @@ -8377,7 +8428,6 @@ "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", - "dev": true, "requires": { "ajv": "^6.10.2", "lodash": "^4.17.14", @@ -8399,8 +8449,7 @@ "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", - "dev": true + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=" }, "throat": { "version": "4.1.0", @@ -8410,8 +8459,7 @@ "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" }, "through2": { "version": "2.0.5", @@ -8453,7 +8501,6 @@ "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, "requires": { "os-tmpdir": "~1.0.2" } @@ -8592,14 +8639,12 @@ "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", - "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", - "dev": true + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "tsutils": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", - "dev": true, "requires": { "tslib": "^1.8.1" } @@ -8639,8 +8684,7 @@ "type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", - "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==" }, "typedarray": { "version": "0.0.6", @@ -8807,8 +8851,7 @@ "v8-compile-cache": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", - "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==", - "dev": true + "integrity": "sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g==" }, "v8flags": { "version": "3.1.3", @@ -9030,7 +9073,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", - "dev": true, "requires": { "mkdirp": "^0.5.1" } diff --git a/package.json b/package.json index e9e3ed73..71def97c 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,10 @@ "@actions/exec": "^1.0.3", "@actions/github": "^2.1.1", "@actions/io": "^1.0.2", + "@lukka/base-lib": "0.14.1", + "@lukka/base-util-lib": "0.14.1", + "@lukka/run-cmake-lib": "0.14.1", + "@lukka/action-lib": "0.14.1", "@types/adm-zip": "^0.4.32", "@types/follow-redirects": "^1.8.0", "@types/jest": "^24.9.0", diff --git a/src/cmake-action.ts b/src/cmake-action.ts index dc525edc..60047eed 100644 --- a/src/cmake-action.ts +++ b/src/cmake-action.ts @@ -2,22 +2,23 @@ // Released under the term specified in file LICENSE.txt // SPDX short identifier: MIT -import * as libaction from './action-lib'; +import * as libaction from '@lukka/action-lib'; +import * as runcmakelib from '@lukka/run-cmake-lib' import * as core from '@actions/core' -import * as cmakerunner from './cmake-runner'; -import * as utils from './utils'; async function main(): Promise { try { const actionLib: libaction.ActionLib = new libaction.ActionLib(); - utils.setBaseLib(actionLib); - const runner: cmakerunner.CMakeRunner = new cmakerunner.CMakeRunner(actionLib); + const runner: runcmakelib.CMakeRunner = new runcmakelib.CMakeRunner(actionLib); await runner.run(); core.info('run-cmake action execution succeeded'); process.exitCode = 0; } catch (err) { + const error: Error = err as Error; + if (error?.stack) { + core.info(error.stack); + } const errorAsString = (err ?? "undefined error").toString(); - core.debug('Error: ' + errorAsString); core.setFailed(`run-cmake action execution failed: '${errorAsString}'`); process.exitCode = -1000; } diff --git a/tsconfig.json b/tsconfig.json index 7b32f967..6a860415 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,6 @@ { "extends": "./tsconfig-base.json", "compilerOptions": { - "outDir": "build", - "rootDirs": [ - "src", - "libs/run-cmake-lib/src", - "libs/action-base-lib/src", - "libs/base-lib/src" - ] - }, - "exclude": [ - "libs/task-base-lib/**", - "libs/run-vcpkg-lib/**" - ] + "outDir": "build" + } } \ No newline at end of file