@@ -59543,16 +59543,38 @@ var __webpack_exports__ = {};
5954359543// This entry need to be wrapped in an IIFE because it need to be in strict mode.
5954459544(() => {
5954559545"use strict";
59546+ // ESM COMPAT FLAG
5954659547__nccwpck_require__.r(__webpack_exports__);
59547- /* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
59548- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
59549- /* harmony export */ });
59550- /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2186);
59551- /* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(_actions_core__WEBPACK_IMPORTED_MODULE_0__);
59552- /* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(7799);
59553- /* harmony import */ var _actions_cache__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(_actions_cache__WEBPACK_IMPORTED_MODULE_1__);
59554- /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(1514);
59555- /* harmony import */ var _actions_exec__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__nccwpck_require__.n(_actions_exec__WEBPACK_IMPORTED_MODULE_2__);
59548+
59549+ // EXPORTS
59550+ __nccwpck_require__.d(__webpack_exports__, {
59551+ "default": () => (/* binding */ save)
59552+ });
59553+
59554+ // EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
59555+ var core = __nccwpck_require__(2186);
59556+ // EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
59557+ var cache = __nccwpck_require__(7799);
59558+ // EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
59559+ var exec = __nccwpck_require__(1514);
59560+ // EXTERNAL MODULE: external "path"
59561+ var external_path_ = __nccwpck_require__(1017);
59562+ var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
59563+ ;// CONCATENATED MODULE: ./src/common.ts
59564+
59565+ function cacheDir(ccacheVariant) {
59566+ const ghWorkSpace = process.env.GITHUB_WORKSPACE || "unreachable, make ncc happy";
59567+ if (ccacheVariant === "ccache") {
59568+ return process.env.CCACHE_DIR || external_path_default().join(ghWorkSpace, ".ccache");
59569+ }
59570+ else if (ccacheVariant === "sccache") {
59571+ return process.env.SCCACHE_DIR || external_path_default().join(ghWorkSpace, ".sccache");
59572+ }
59573+ throw Error("Unknown ccache variant: " + ccacheVariant);
59574+ }
59575+
59576+ ;// CONCATENATED MODULE: ./src/save.ts
59577+
5955659578
5955759579
5955859580
@@ -59578,51 +59600,51 @@ async function getVerbosity(verbositySetting) {
5957859600 case '2':
5957959601 return ' -vv';
5958059602 default:
59581- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .warning(`Invalid value "${verbositySetting}" of "verbose" option ignored.`);
59603+ core .warning(`Invalid value "${verbositySetting}" of "verbose" option ignored.`);
5958259604 return '';
5958359605 }
5958459606}
5958559607function getExecBashOutput(cmd) {
59586- return _actions_exec__WEBPACK_IMPORTED_MODULE_2__ .getExecOutput("bash", ["-xc", cmd], { silent: true });
59608+ return exec .getExecOutput("bash", ["-xc", cmd], { silent: true });
5958759609}
5958859610async function run(earlyExit) {
5958959611 try {
59590- const ccacheVariant = _actions_core__WEBPACK_IMPORTED_MODULE_0__ .getState("ccacheVariant");
59591- const primaryKey = _actions_core__WEBPACK_IMPORTED_MODULE_0__ .getState("primaryKey");
59612+ const ccacheVariant = core .getState("ccacheVariant");
59613+ const primaryKey = core .getState("primaryKey");
5959259614 if (!ccacheVariant || !primaryKey) {
59593- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .notice("ccache setup failed, skipping saving.");
59615+ core .notice("ccache setup failed, skipping saving.");
5959459616 return;
5959559617 }
5959659618 // Some versions of ccache do not support --verbose
5959759619 const ccacheKnowsVerbosityFlag = !!(await getExecBashOutput(`${ccacheVariant} --help`)).stdout.includes("--verbose");
59598- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .startGroup(`${ccacheVariant} stats`);
59599- const verbosity = ccacheKnowsVerbosityFlag ? await getVerbosity(_actions_core__WEBPACK_IMPORTED_MODULE_0__ .getInput("verbose")) : '';
59600- await _actions_exec__WEBPACK_IMPORTED_MODULE_2__ .exec(`${ccacheVariant} -s${verbosity}`);
59601- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .endGroup();
59602- if (_actions_core__WEBPACK_IMPORTED_MODULE_0__ .getState("shouldSave") !== "true") {
59603- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .info("Not saving cache because 'save' is set to 'false'.");
59620+ core .startGroup(`${ccacheVariant} stats`);
59621+ const verbosity = ccacheKnowsVerbosityFlag ? await getVerbosity(core .getInput("verbose")) : '';
59622+ await exec .exec(`${ccacheVariant} -s${verbosity}`);
59623+ core .endGroup();
59624+ if (core .getState("shouldSave") !== "true") {
59625+ core .info("Not saving cache because 'save' is set to 'false'.");
5960459626 return;
5960559627 }
5960659628 if (await ccacheIsEmpty(ccacheVariant, ccacheKnowsVerbosityFlag)) {
59607- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .info("Not saving cache because no objects are cached.");
59629+ core .info("Not saving cache because no objects are cached.");
5960859630 }
5960959631 else {
5961059632 let saveKey = primaryKey;
59611- if (_actions_core__WEBPACK_IMPORTED_MODULE_0__ .getState("appendTimestamp") == "true") {
59633+ if (core .getState("appendTimestamp") == "true") {
5961259634 saveKey += new Date().toISOString();
5961359635 }
5961459636 else {
59615- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .debug("Not appending timestamp because 'append-timestamp' is not set to 'true'.");
59637+ core .debug("Not appending timestamp because 'append-timestamp' is not set to 'true'.");
5961659638 }
59617- const paths = [`.${ ccacheVariant}` ];
59618- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .info(`Save cache using key "${saveKey}".`);
59619- await _actions_cache__WEBPACK_IMPORTED_MODULE_1__ .saveCache(paths, saveKey);
59639+ const paths = [cacheDir( ccacheVariant) ];
59640+ core .info(`Save cache using key "${saveKey}".`);
59641+ await cache .saveCache(paths, saveKey);
5962059642 }
5962159643 }
5962259644 catch (error) {
5962359645 // A failure to save cache shouldn't prevent the entire CI run from
5962459646 // failing, so do not call setFailed() here.
59625- _actions_core__WEBPACK_IMPORTED_MODULE_0__ .warning(`Saving cache failed: ${error}`);
59647+ core .warning(`Saving cache failed: ${error}`);
5962659648 }
5962759649 // Since we are not using http requests after this
5962859650 // we can safely exit early
@@ -59631,7 +59653,7 @@ async function run(earlyExit) {
5963159653 }
5963259654}
5963359655run(true);
59634- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (run);
59656+ /* harmony default export */ const save = (run);
5963559657
5963659658})();
5963759659
0 commit comments