setup-cpp/dist/setup_cpp.js

3 lines
121 KiB
JavaScript
Raw Normal View History

2021-09-18 20:30:16 +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)}))}))}Pe(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 Re)return{binDir:Re};const s=e(we).sync("brew",{nothrow:!0});return null!==s?(Re=te.dirname(s),{binDir:Re}):(oe.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),Re="/usr/local/bin/",{binDir:Re})}function s(e,t,r){return Ne(this,void 0,void 0,(function*(){const o=Le.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 Le.ToolRunner(s,t,r).exec()}))}function n(e){return void 0!==De||(De=!!process.env.CI||0===(null===(t=process.getuid)||void 0===t?void 0:t.call(process))),De?"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])),je&&!0!==r||(s=await Ae.exec(o,["update","-y"]),je=!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=we.sync(e.command,{path:r[Ue({env:r})],pathExt:t?te.delimiter:void 0})}catch(e){}finally{n&&process.chdir(o)}return i&&(i=te.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=oe.spawn(o.command,o.args,o.options);return We.hookChildProcess(s,o),s}function p(t,r){return Je&&null!==e(we).sync("brew",{nothrow:!0})||(o(0,0,process),Je=!0),e(Me).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t],{stdio:"inherit"}),{binDir:"/usr/local/bin/"}}async function d(e){try{xe.addPath(e)}catch(t){switch(xe.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"),xe.info(e+" was added to ~/.profile");break;default:xe.error(`Failed to add ${e} to the percistent PATH. You should add it manually.`),process.env.PATH=`${e}${te.delimiter}${process.env.PATH}`}}}function h(t,r,o){if("win32"!==process.platform)return;if("string"==typeof Ke)return{binDir:Ke};const s=e(we).sync("choco",{nothrow:!0});if(null!==s)return Ke=te.dirname(s),{binDir:Ke};if(0!==e(Me).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(we).sync("choco",{nothrow:!0});return Ke=null!==n?te.dirname(n):"C:/ProgramData/Chocolatey/bin/",re.existsSync(Ke)?{binDir:Ke}:void 0}async function f(t,r,o=[]){let s;if(Qe&&null!==e(we).sync("choco",{nothrow:!0})||(await h(0,0,process),Qe=!0),s=void 0!==r&&""!==r?e(Me).sync("choco",["install","-y",t,"--version="+r,...o],{stdio:"inherit"}).status:e(Me).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