setup-cpp/dist/setup_cpp.js

3 lines
151 KiB
JavaScript
Raw Normal View History

2022-03-01 13:54:49 +08:00
function e(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}function t(e){return e&&e.__esModule?e.default:e}function r(e,t,r){return ut(this,void 0,void 0,(function*(){const n=pt.argStringToArray(e);if(0===n.length)throw Error("Parameter 'commandLine' cannot be null or empty.");const o=n[0];return t=n.slice(1).concat(t||[]),new pt.ToolRunner(o,t,r).exec()}))}function n(e,t){const r=[];t=t||Qe.arch();const n=et.join(c(),e);if(Je.existsSync(n)){const e=Je.readdirSync(n);for(const o of e)if(a(o)){const e=et.join(n,o,t||"");Je.existsSync(e)&&Je.existsSync(e+".complete")&&r.push(o)}}return r}function o(e){return Xe(this,void 0,void 0,(function*(){return e||(e=et.join(u(),it.default())),yield Ye.mkdirP(e),e}))}function i(e,t,r){return Xe(this,void 0,void 0,(function*(){const n=et.join(c(),e,rt.clean(t)||t,r||"");Ke.debug("destination "+n);const o=n+".complete";return yield Ye.rmRF(n),yield Ye.rmRF(o),yield Ye.mkdirP(n),n}))}function s(e,t,r){const n=et.join(c(),e,rt.clean(t)||t,r||"");Je.writeFileSync(n+".complete",""),Ke.debug("finished caching tool")}function a(e){const t=rt.clean(e)||"";Ke.debug("isExplicit: "+t);const r=null!=rt.valid(t);return Ke.debug("explicit? "+r),r}function l(e,t){let r="";Ke.debug(`evaluating ${e.length} versions`);for(let n=(e=e.sort(((e,t)=>rt.gt(e,t)?1:-1))).length-1;n>=0;n--){const o=e[n];if(rt.satisfies(o,t)){r=o;break}}return Ke.debug(r?"matched: "+r:"match not found"),r}function c(){const e=process.env.RUNNER_TOOL_CACHE||"";return Ce.ok(e,"Expected RUNNER_TOOL_CACHE to be defined"),e}function u(){const e=process.env.RUNNER_TEMP||"";return Ce.ok(e,"Expected RUNNER_TEMP to be defined"),e}function p(e,t){const r=Me[e];return void 0!==r?r:t}function d(){return"true"===process.env.CI&&"true"===process.env.GITHUB_ACTIONS}function h(e){return d()?bt.error(e):console.log(`${e}`)}function f(e){return d()?bt.warning(e):console.log(`${e}`)}function m(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise(((r,n)=>{m(e,t||{},((e,t)=>{e?n(e):r(t)}))}))}Ot(e,t||{},((e,n)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n)}))}function v(e,r,n){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof Ct)return{binDir:Ct};const o=t(Et).sync("brew",{nothrow:!0});return null!==o?(Ct=Pe.dirname(o),{binDir:Ct}):(Ae.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),Ct="/usr/local/bin/",{binDir:Ct})}function g(e,t){const r=e.options.env||process.env,n=process.cwd(),o=null!=e.options.cwd,i=o&&void 0!==process.chdir&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch(e){}let s;try{s=Et.sync(e.command,{path:r[kt({env:r})],pathExt:t?Pe.delimiter:void 0})}catch(e){}finally{i&&process.chdir(n)}return s&&(s=Pe.resolve(o?e.options.cwd:"",s)),s}function y(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function x(e,t){return Bt&&1===e&&!t.file?y(t.original,"spawn"):null}function w(e,t,r){const n=Lt(e,t,r),o=Ae.spawn(n.command,n.args,n.options);return qt.hookChildProcess(o,n),o}async function b(e,t){if(!e)throw Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=Vr(t);return await new Promise(((t,o)=>{const i=e=>{e&&n.getBufferedLength()<=qr.MAX_LENGTH&&(e.bufferedData=n.getBufferedValue()),o(e)};(async()=>{try{await Wr(e,n),t()}catch(e){i(e)}})(),n.on("data",(()=>{n.getBufferedLength()>r&&i(new Xr)}))})),n.getBufferedValue()}function E(){var e;return void 0!==gn||(gn=(!!process.env.CI||0===(null===(e=process.getuid)||void 0===e?void 0:e.call(process)))&&null!==t(Et).sync("sudo",{nothrow:!0})),gn}function S(e,r,n){return E()?t(At).command("sudo "+[e,...r].map((e=>`'${e}'`)).join(" "),{shell:!0,cwd:n,stdio:"inherit"}):t(At)(e,r,{stdio:"inherit"})}async function P(e,t,r=!0){bt.info(`Installing ${e} ${null!=t?t:""} via apt`);const n="apt-get";
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map