setup-cpp/dist/setup_cpp.js

3 lines
121 KiB
JavaScript
Raw Normal View History

2021-09-18 05:18:02 +08:00
function e(e){return e&&e.__esModule?e.default:e}function t(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}function r(e,t,o){if("function"==typeof t&&(o=t,t={}),!o){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise(((o,s)=>{r(e,t||{},((e,t)=>{e?s(e):o(t)}))}))}be(e,t||{},((e,r)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,r=!1),o(e,r)}))}function o(t,r,o){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof _e)return{binDir:_e};const s=e(xe).sync("brew",{nothrow:!0});return null!==s?(_e=ee.dirname(s),{binDir:_e}):(re.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),_e="/usr/local/bin/",{binDir:_e})}function s(e,t,r){return Ie(this,void 0,void 0,(function*(){const o=Ne.argStringToArray(e);if(0===o.length)throw Error("Parameter 'commandLine' cannot be null or empty.");const s=o[0];return t=o.slice(1).concat(t||[]),new Ne.ToolRunner(s,t,r).exec()}))}function n(e){return void 0!==Le||(Le=!!process.env.CI||0===(null===(t=process.getuid)||void 0===t?void 0:t.call(process))),Le?"sudo "+e:e;var t}async function i(e,t,r=!0){const o=n("apt-get");let s=0;if("string"==typeof r&&(s=await Re.exec(n("add-apt-repository"),["--update","-y",r])),De&&!0!==r||(s=await Re.exec(o,["update","-y"]),De=!0),void 0!==t&&""!==t)try{s=await Re.exec(o,["install","-y",`${e}=${t}`])}catch{s=await Re.exec(o,["install","-y",`${e}-${t}`])}else s=await Re.exec(o,["install","-y",e]);if(0!==s)throw Error(`Failed to install ${e} ${t}`);return{binDir:"/usr/bin/"}}function a(e,t){const r=e.options.env||process.env,o=process.cwd(),s=null!=e.options.cwd,n=s&&void 0!==process.chdir&&!process.chdir.disabled;if(n)try{process.chdir(e.options.cwd)}catch(e){}let i;try{i=xe.sync(e.command,{path:r[Me({env:r})],pathExt:t?ee.delimiter:void 0})}catch(e){}finally{n&&process.chdir(o)}return i&&(i=ee.resolve(s?e.options.cwd:"",i)),i}function l(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 c(e,t){return Ze&&1===e&&!t.file?l(t.original,"spawn"):null}function u(e,t,r){const o=Fe(e,t,r),s=re.spawn(o.command,o.args,o.options);return ze.hookChildProcess(s,o),s}function p(t,r){return We&&null!==e(xe).sync("brew",{nothrow:!0})||(o(0,0,process),We=!0),e(ke).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t],{stdio:"inherit"}),{binDir:"/usr/local/bin/"}}function d(t,r,o){if("win32"!==process.platform)return;if("string"==typeof Je)return{binDir:Je};const s=e(xe).sync("choco",{nothrow:!0});if(null!==s)return Je=ee.dirname(s),{binDir:Je};if(0!==e(ke).sync('@"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://community.chocolatey.org/install.ps1\'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin"',{stdio:"inherit"}).status)throw Error("Failed to install chocolatey");const n=e(xe).sync("choco",{nothrow:!0});return Je=null!==n?ee.dirname(n):"C:/ProgramData/Chocolatey/bin/",te.existsSync(Je)?{binDir:Je}:void 0}async function h(t,r,o=[]){let s;if(Ke&&null!==e(xe).sync("choco",{nothrow:!0})||(await d(0,0,process),Ke=!0),s=void 0!==r&&""!==r?e(ke).sync("choco",["install","-y",t,"--version="+r,...o],{stdio:"inherit"}).status:e(ke).sync("choco",["install","-y",t,...o],{stdio:"inherit"}).status,0!==s)throw Error(`Failed to install ${t} ${r}`);const n="C:/ProgramData/Chocolatey/bin/";return ye.addPath(n),{binDir:n}}function f(e,t){const r=[];t=t||ct.arch();const o=ut.join(w(),e);if(at.existsSync(o)){const e=at.readdirSync(o);for(const s of e)if(y(s)){const e=ut.join(o,s,t||"");at.existsSync(e)&&at.existsSync(e+".complete")&&r.push(s)}}return r}function m(e){return ot(this,void 0,void 0,(function*(){return e||(e=ut.join(E(),mt.default())),yield it.mkdirP(e),e}))}function v(e,t,r){return ot(
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map