setup-cpp/dist/setup_cpp.js

3 lines
122 KiB
JavaScript
Raw Normal View History

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)}))}))}Oe(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 Ce)return{binDir:Ce};const s=e(Ee).sync("brew",{nothrow:!0});return null!==s?(Ce=re.dirname(s),{binDir:Ce}):(se.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),Ce="/usr/local/bin/",{binDir:Ce})}function s(e,t,r){return Le(this,void 0,void 0,(function*(){const o=De.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 De.ToolRunner(s,t,r).exec()}))}function n(e){return void 0!==je||(je=!!process.env.CI||0===(null===(t=process.getuid)||void 0===t?void 0:t.call(process))),je?"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 Ae.exec(n("add-apt-repository"),["--update","-y",r])),ke&&!0!==r||(s=await Ae.exec(o,["update","-y"]),ke=!0),void 0!==t&&""!==t)try{s=await Ae.exec(o,["install","-y",`${e}=${t}`])}catch{s=await Ae.exec(o,["install","-y",`${e}-${t}`])}else s=await Ae.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=Ee.sync(e.command,{path:r[Ve({env:r})],pathExt:t?re.delimiter:void 0})}catch(e){}finally{n&&process.chdir(o)}return i&&(i=re.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 Je&&1===e&&!t.file?l(t.original,"spawn"):null}function u(e,t,r){const o=Ue(e,t,r),s=se.spawn(o.command,o.args,o.options);return Ze.hookChildProcess(s,o),s}function p(t,r){return Ke&&null!==e(Ee).sync("brew",{nothrow:!0})||(o(0,0,process),Ke=!0),e(Fe).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t],{stdio:"inherit"}),{binDir:"/usr/local/bin/"}}async function d(e){try{we.addPath(e)}catch(t){switch(we.error(t),process.platform){case"win32":await Ae.exec(`setx PATH=${e};%PATH%`);break;case"linux":case"darwin":await Ae.exec(`echo "export PATH=${e}:$PATH" >> ~/.profile`),await Ae.exec("source ~/.profile"),we.info(e+" was added to ~/.profile");break;default:we.error(`Failed to add ${e} to the percistent PATH. You should add it manually.`),process.env.PATH=`${e}${re.delimiter}${process.env.PATH}`}}}function h(t,r,o){if("win32"!==process.platform)return;if("string"==typeof Qe)return{binDir:Qe};const s=e(Ee).sync("choco",{nothrow:!0});if(null!==s)return Qe=re.dirname(s),{binDir:Qe};if(0!==e(Fe).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(Ee).sync("choco",{nothrow:!0});return Qe=null!==n?re.dirname(n):"C:/ProgramData/Chocolatey/bin/",oe.existsSync(Qe)?{binDir:Qe}:void 0}async function f(t,r,o=[]){let s;if(et&&null!==e(Ee).sync("choco",{nothrow:!0})||(await h(0,0,process),et=!0),s=void 0!==r&&""!==r?e(Fe).sync("choco",["install","-y",t,"--version="+r,...o],{stdio:"inherit"}).status:e(Fe).sync("choco",["install","-y",t,...o],{stdio:"inherit"}).status,0!==s)throw Error(`Failed to install ${t} ${r}
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map