mirror of https://github.com/aminya/setup-cpp
3 lines
636 KiB
JavaScript
3 lines
636 KiB
JavaScript
|
"use strict";function _interopNamespaceDefault(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}function getProxyUrl(e){let t,r,i="https:"===e.protocol;return checkBypass(e)||(r=i?process.env.https_proxy||process.env.HTTPS_PROXY:process.env.http_proxy||process.env.HTTP_PROXY,r&&(t=new URL(r))),t}function checkBypass(e){if(!e.hostname)return!1;let t,r=process.env.no_proxy||process.env.NO_PROXY||"";if(!r)return!1;e.port?t=+e.port:"http:"===e.protocol?t=80:"https:"===e.protocol&&(t=443);let i=[e.hostname.toUpperCase()];"number"==typeof t&&i.push(`${i[0]}:${t}`);for(let n of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e)))if(i.some((e=>e===n)))return!0;return!1}function downloadTool(e,t,r,i){return __awaiter$8(this,void 0,void 0,(function*(){t=t||path$8.join(_getTempDirectory(),v4_1.default()),yield io$2.mkdirP(path$8.dirname(t)),core$8.debug("Downloading "+e),core$8.debug("Destination "+t);const n=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MIN_SECONDS",10),a=_getGlobal("TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS",20),o=new retry_helper_1.RetryHelper(3,n,a);return yield o.execute((()=>__awaiter$8(this,void 0,void 0,(function*(){return yield downloadToolAttempt(e,t||"",r,i)}))),(e=>!(e instanceof HTTPError&&e.httpStatusCode&&500>e.httpStatusCode&&408!==e.httpStatusCode&&429!==e.httpStatusCode)))}))}function downloadToolAttempt(e,t,r,i){return __awaiter$8(this,void 0,void 0,(function*(){if(fs$4.existsSync(t))throw Error(`Destination file path ${t} already exists`);const n=new httpm.HttpClient(userAgent,[],{allowRetries:!1});r&&(core$8.debug("set auth"),void 0===i&&(i={}),i.authorization=r);const a=yield n.get(e,i);if(200!==a.message.statusCode){const t=new HTTPError(a.message.statusCode);throw core$8.debug(`Failed to download from "${e}". Code(${a.message.statusCode}) Message(${a.message.statusMessage})`),t}const o=util$6.promisify(stream$2.pipeline),s=_getGlobal("TEST_DOWNLOAD_TOOL_RESPONSE_MESSAGE_FACTORY",(()=>a.message))();let l=!1;try{return yield o(s,fs$4.createWriteStream(t)),core$8.debug("download complete"),l=!0,t}finally{if(!l){core$8.debug("download failed");try{yield io$2.rmRF(t)}catch(c){core$8.debug(`Failed to delete '${t}'. ${c.message}`)}}}}))}function extract7z(e,t,r){return __awaiter$8(this,void 0,void 0,(function*(){assert_1$4.ok(IS_WINDOWS$7,"extract7z() not supported on current OS"),assert_1$4.ok(e,'parameter "file" is required'),t=yield _createExtractFolder(t);const i=process.cwd();if(process.chdir(t),r)try{const t=["x",core$8.isDebug()?"-bb1":"-bb0","-bd","-sccUTF-8",e],i={silent:!0};yield exec_1$1.exec(`"${r}"`,t,i)}finally{process.chdir(i)}else{const r=["-NoLogo","-Sta","-NoProfile","-NonInteractive","-ExecutionPolicy","Unrestricted","-Command",`& '${path$8.join(__dirname,"..","scripts","Invoke-7zdec.ps1").replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Source '${e.replace(/'/g,"''").replace(/"|\n|\r/g,"")}' -Target '${t.replace(/'/g,"''").replace(/"|\n|\r/g,"")}'`],n={silent:!0};try{const e=yield io$2.which("powershell",!0);yield exec_1$1.exec(`"${e}"`,r,n)}finally{process.chdir(i)}}return t}))}function extractTar$1(e,t,r="xz"){return __awaiter$8(this,void 0,void 0,(function*(){if(!e)throw Error("parameter 'file' is required");t=yield _createExtractFolder(t),core$8.debug("Checking tar --version");let i="";yield exec_1$1.exec("tar --version",[],{ignoreReturnCode:!0,silent:!0,listeners:{stdout:e=>i+=""+e,stderr:e=>i+=""+e}}),core$8.debug(i.trim());const n=i.toUpperCase().includes("GNU TAR");let a;a=r instanceof Array?r:[r],core$8.isDebug()&&!r.includes("v")&&a.push("-v");let o=t,s=e;return IS_WINDOWS$7&&n&&(a.push("--force-local"),o=t.replace(/\\/g,"/"),s=e.replace(/\\/g,"/")),n&&(a.push("--warning=no-unknown-keyword"),a.push("--overwrite")),a.push("-C",o,"-f",s),yield exec_1$1.exec("tar",a),t}))}function extractXar(e,t,r=[]){return __awaiter$8(this,void 0,void 0,(function*(){let i;assert_1$4.ok(IS_MA
|
||
|
//# sourceMappingURL=actions_python-eAwSTumI.js.map
|