setup-cpp/dist/legacy/setup-cpp.js

45 lines
273 KiB
JavaScript
Raw Normal View History

2023-07-16 06:41:58 +08:00
#!/usr/bin/env node
let e,t,r,n,i,o,s,a;function l(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0});}function c(e){return e&&e.__esModule?e.default:e;}function u(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw TypeError("callback not provided");return new Promise(function(r,n){u(e,t||{},function(e,t){e?n(e):r(t);});});}rz(e,t||{},function(e,n){e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n);});}function p(e,t){let r;let n=e.options.env||process.env,i=process.cwd(),o=null!=e.options.cwd,s=o&&void 0!==process.chdir&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd);}catch(e){}try{r=rH.sync(e.command,{path:n[rV({env:n})],pathExt:t?iV.delimiter:void 0});}catch(e){}finally{s&&process.chdir(i);}return r&&(r=iV.resolve(o?e.options.cwd:"",r)),r;}function f(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 d(e,t){return i4&&1===e&&!t.file?f(t.original,"spawn"):null;}function h(e,t,r){let n=rG(e,t,r),i=rg.spawn(n.command,n.args,n.options);return rZ.hookChildProcess(i,n),i;}function m(e={}){let{env:t=process.env,platform:r=process.platform}=e;return"win32"!==r?"PATH":Object.keys(t).reverse().find(e=>"PATH"===e.toUpperCase())||"Path";}function v(e){return null!==e&&"object"==typeof e&&"function"==typeof e.pipe;}function g(e){return v(e)&&!1!==e.writable&&"function"==typeof e._write&&"object"==typeof e._writableState;}async function y(e,t){if(!e)throw Error("Expected a stream");let{maxBuffer:r}=t={maxBuffer:1/0,...t},n=r6(t);return await new Promise((t,i)=>{let o=e=>{e&&n.getBufferedLength()<=r3.MAX_LENGTH&&(e.bufferedData=n.getBufferedValue()),i(e);};(async()=>{try{await oJ(e,n),t();}catch(e){o(e);}})(),n.on("data",()=>{n.getBufferedLength()>r&&o(new oZ());});}),n.getBufferedValue();}function E(e,t,r){let n;let i=sv(e,t,r),o=si(e,t),s=so(e,t);sh(s,i.options),oV(i.options);try{n=c(rb).spawn(i.file,i.args,i.options);}catch(t){let e=new(c(rb).ChildProcess)();return se(e,Promise.reject(oE({error:t,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:i,timedOut:!1,isCanceled:!1,killed:!1}))),e;}let a=st(n),l=oz(n,i.options,a),u=oX(n,i.options,l),p={isCanceled:!1};n.kill=oF.bind(null,n.kill.bind(n)),n.cancel=oH.bind(null,n,p);let f=rQ(async()=>{let[{error:e,exitCode:t,signal:r,timedOut:a},l,c,f]=await o5(n,i.options,u),d=sg(i.options,l),h=sg(i.options,c),m=sg(i.options,f);if(e||0!==t||null!==r){let l=oE({error:e,exitCode:t,signal:r,stdout:d,stderr:h,all:m,command:o,escapedCommand:s,parsed:i,timedOut:a,isCanceled:p.isCanceled||!!i.options.signal&&i.options.signal.aborted,killed:n.killed});if(!i.options.reject)return l;throw l;}return{command:o,escapedCommand:s,exitCode:0,stdout:d,stderr:h,all:m,failed:!1,timedOut:!1,isCanceled:!1,killed:!1};});return o3(n,i.options),n.all=o4(n,i.options),oK(n),se(n,f),n;}function w(e,t,r){let n;let i=sv(e,t,r),o=si(e,t),s=so(e,t);sh(s,i.options);let a=o1(i.options);try{n=c(rb).spawnSync(i.file,i.args,{...i.options,input:a});}catch(e){throw oE({error:e,stdout:"",stderr:"",all:"",command:o,escapedCommand:s,parsed:i,timedOut:!1,isCanceled:!1,killed:!1});}let l=sg(i.options,n.stdout,n.error),u=sg(i.options,n.stderr,n.error);if(n.error||0!==n.status||null!==n.signal){let e=oE({stdout:l,stderr:u,error:n.error,signal:n.signal,exitCode:n.status,command:o,escapedCommand:s,parsed:i,timedOut:n.error&&"ETIMEDOUT"===n.error.code,isCanceled:!1,killed:null!==n.signal});if(!i.options.reject)return e;throw e;}return{command:o,escapedCommand:s,exitCode:0,stdout:l,stderr:u,failed:!1,timedOut:!1,isCanceled:!1,killed:!1};}function _(t,r=["-NoProfile","-NoLogo","-NonInteractive"],n={stdio:"inherit"}){return E(function(){if(void 0===e){let t=c(r7).sync("pwsh",{nothrow:!0});null!==t&&(e=t);let r=c(r7).sync("powershell",{nothrow:!0});null!==r&&(e=r);}if(void 0===e)throw Error("Could not find powershell");return e;}(),[...r,"-c",t],n);}function b(){var e,t;return((null===(e=(t=process).getuid)||void 0===e?void 0:e.call(t))===0||!!process.en
source "${e.rcPath}"
`:`
# ${e.guard}
if [[ "$SOURCE_${e.guard.toUpperCase()}RC" != 0 && -f "${e.rcPath}" ]]; then source "${e.rcPath}"; fi
`;try{await Promise.all([N(e),A(t,T("~/.bashrc")),A(t,T("~/.profile"))]);}catch(e){(0,rF.warning)(`Failed to add ${t} to .profile or .bashrc. You should add it manually: ${e}`);}}async function N(e){let t=void 0===e.guard?"\n# Automatically Generated by envosman\n":`
# Automatically Generated by envosman ${e.guard}
export SOURCE_${e.guard.toUpperCase()}RC=0
`;(await(0,nF.pathExists)(e.rcPath))&&!(await sG(e.rcPath,"utf8")).includes(t)&&(await sM(e.rcPath,`
${t}
`),(0,rF.info)(`Added ${t} to ${e.rcPath}`));}async function A(e,t){(await(0,nF.pathExists)(t))&&!(await sG(t,"utf-8")).includes(e)&&(await sM(t,e),(0,rF.info)(`${e} was added to ${t}`));}async function $(e){if(await(0,nF.pathExists)(e.rcPath)){let t=[...new Set((await sG(e.rcPath,"utf-8")).split("\n").reverse())].reverse();await sB(e.rcPath,t.join("\n")),await I(e.rcPath);}}async function C(e,t,r={}){let n={escapeSpace:!1,overwrite:!0,rcPath:sH,...r},i=function(e,t=!1){let r=t?c(nU)(e):e;return c(nM)(r,'"',"\\");}(null!=t?t:"",n.escapeSpace);try{if(rj.GITHUB_ACTIONS)try{if(!n.overwrite&&void 0!==process.env[e]){(0,rF.info)(`Environment variable ${e} is already defined. Skipping.`);return;}(0,rU.exportVariable)(e,i);}catch(t){(0,rF.error)(t),await L(e,i,n);}else await L(e,i,n);}catch(t){(0,rF.error)(`${t}
Failed to export environment variable ${e}=${i}. You should add it manually.`);}}async function L(e,t,r){let n=null!=t?t:"";switch(process.platform){case"win32":if(!r.overwrite&&void 0!==process.env[e]){(0,rF.info)(`Environment variable ${e} is already defined. Skipping.`);return;}await _(`[Environment]::SetEnvironmentVariable('${e}', '${n}', "User")`),(0,rF.info)(`${e}='${n}' was set in the environment.`);return;case"linux":case"darwin":await sq(r),r.overwrite?(await sW(r.rcPath,`
export ${e}="${n}"
`),(0,rF.info)(`${e}="${n}" was added to "${r.rcPath}`)):(await sW(r.rcPath,`
if [ -z "\${${e}}" ]; then export ${e}="${n}"; fi
`),(0,rF.info)(`if not defined ${e} then ${e}="${n}" was added to "${r.rcPath}`));return;}process.env[e]=n;}async function k(e,t={}){let r={rcPath:sH,...t};if(!function(e){if(sK.some(t=>t.test(e))){var t,r;return(null!==(r=null===(t=process.env.PATH)||void 0===t?void 0:t.split(iV.delimiter))&&void 0!==r?r:[]).includes(e);}return!1;}(e)){process.env.PATH=`${e}${iV.delimiter}${process.env.PATH}`;try{if(rj.GITHUB_ACTIONS)try{(0,rU.addPath)(e);}catch(t){(0,rF.error)(t),await D(e,r);}else await D(e,r);}catch(t){(0,rF.error)(`${t}
Failed to add ${e} to the percistent PATH. You should add it manually.`);}}}async function D(e,t){switch(process.platform){case"win32":await _(`$USER_PATH=([Environment]::GetEnvironmentVariable("PATH", "User")); [Environment]::SetEnvironmentVariable("PATH", "${e};$USER_PATH", "User")`),(0,rF.info)(`"${e}" was added to the PATH.`);return;case"linux":case"darwin":await sq(t),await sY(t.rcPath,`
export PATH="${e}:$PATH"
`),(0,rF.info)(`"${e}" was added to "${t.rcPath}"`);return;default:return;}}function j(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e));}catch(e){o(e);}}function a(e){try{l(n.throw(e));}catch(e){o(e);}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t);})).then(s,a);}l((n=n.apply(e,t||[])).next());});}function F(e,t){function r(r){return function(l){return function(r){if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,r[0]&&(a=0)),a;)try{if(n=1,i&&(o=2&r[0]?i.return:r[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,r[1])).done)return o;switch(i=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,i=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue;}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break;}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break;}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break;}o[2]&&a.ops.pop(),a.trys.pop();continue;}r=t.call(e,a);}catch(e){r=[6,e],i=0;}finally{n=o=0;}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0};}([r,l]);};}var n,i,o,s,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1];},trys:[],ops:[]};return s={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this;}),s;}async function U(){try{await c(nz)({pkg:c(n7)});}catch(e){(0,rF.warning)("Failed to check for updates: "+(e instanceof Error?e.message+e.stack:e));}}function M(e){return null==e?[]:Array.isArray(e)?e:[e];}function G(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;}function B(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e;}async function H(e,t,r=40){await S("update-alternatives",["--install","/usr/bin/"+e,e,t,r.toString()]);}async function q(e,t,r,n=40){rj.GITHUB_ACTIONS?await H(e,t,n):(await sq(r),await sJ(r.rcPath,`
if [ $UID -eq 0 ]; then update-alternatives --install /usr/bin/${e} ${e} ${t} ${n}; fi
`));}function z(e){let t={...process.env,DEBIAN_FRONTEND:"noninteractive"};return"nala"===e&&(void 0===t.LANG&&(t.LANG="C.UTF-8"),void 0===t.LC_ALL&&(t.LC_ALL="C.UTF-8")),t;}function V(){return null!==c(r7).sync("nala",{nothrow:!0});}function X(){let e;return V()?"nala":"apt-get";}async function W(e){try{let{stdout:t}=await E("dpkg",["-s",e],{env:z("apt-get"),stdio:"pipe"});if("string"!=typeof t)return!1;return t.split("\n").some(e=>e.startsWith("Status: install ok installed"));}catch{return!1;}}async function Y(e){try{let{stdout:t}=await E("dpkg",["-l",e],{env:z("apt-get"),stdio:"pipe"});if("string"!=typeof t)return!1;return t.split("\n").some(e=>e.startsWith("ii"));}catch{return!1;}}async function K(e,t){return(await Promise.all(t.map(t=>J(e,t)))).filter(e=>void 0!==e);}async function J(e,t){let r=await Q(e,t.name,t.version);return(await W(r))?void 0:r;}async function Z(e,t,r){if(void 0!==r&&""!==r){let{stdout:n}=await E("apt-cache",["search","--names-only",`^${(0,ic.default)(t)}-${(0,ic.default)(r)}$`],{env:z(e),stdio:"pipe"});if(""!==n.trim())return 0;try{let{stdout:n}=await E("apt-cache",["show",`${t}=${r}`],{env:z(e)});if(""===n.trim())return 1;}catch{}}try{let{stdout:r}=await E("apt-cache",["show",t],{env:z(e),stdio:"pipe"});if(""!==r.trim())return 2;}catch{}return sQ?3:(s0(e),Z(e,t,r));}async function Q(e,t,r){switch(await Z(e,t,r)){case 0:return`${t}-${r}`;case 1:return`${t}=${r}`;case 2:return void 0!==r&&""!==r&&(0,rF.warning)(`Could not find package ${t} with version ${r}. Installing the latest version.`),t;default:throw Error(`Could not find package ${t} ${null!=r?r:""}`);}}async function ee(e){s0(e);let t=await K(e,[{name:"ca-certificates"},{name:"gnupg"},{name:"apt-utils"}]);0!==t.length&&x(e,["install","-y","--fix-broken","-o",sZ,...t],{...sF,env:z(e)});}async function et(e,t=X()){await s1(t),await er(t),x("add-apt-repository",["-y","--no-update",e],{...sF,env:z(t)}),s0.clear(),s0(t);}async function er(e){(await W("software-properties-common"))||x(e,["install","-y","--fix-broken","-o",sZ,"software-properties-common"],{...sF,env:z(e)});}async function en(e,t=!1){let r=X();for(let{name:t,version:n}of e)(0,rF.info)(`Installing ${t} ${null!=n?n:""} via ${r}`);t&&s0(r),await ei(r,e);let n=await K(r,e);if(0===n.length)return(0,rF.info)("All packages are already installed"),{binDir:"/usr/bin/"};await s1(r);try{await eo(e),x(r,["install","--fix-broken","-y",...n],{...sF,env:z(r)});}catch(e){if("string"==typeof e.stderr)s2.some(t=>e.stderr.includes(t))&&((0,rF.warning)(`Failed to install packages ${n}. Retrying...`),x(r,["install","--fix-broken","-y","-o",sZ,...n],{...sF,env:z(r)}));else throw e;}return{binDir:"/usr/bin/"};}async function ei(e,t){let r=[...new Set(t.flatMap(e=>{var t;return null!==(t=e.repository)&&void 0!==t?t:[];}))];await Promise.all(r.map(t=>et(t,e)));}async function eo(e){await Promise.all(e.map(async e=>{var t;void 0!==e.key&&(await("keyUrl"in(t=e.key)?ea(t):es(t)));}));}async function es({key:e,keyServer:t=s4,fileName:r,keyStorePath:n=s4}){try{ec(r);let i=(0,iV.join)(n,r);return(await(0,nF.pathExists)(i))||(el(),await S("gpg",["--no-default-keyring","--keyring","gnupg-ring:"+i,"--keyserver",t,"--recv-keys",e]),await S("chmod",["644",i])),i;}catch(e){(0,rF.warning)(`Failed to add apt key via server ${t}: ${e}`);return;}}async function ea({keyUrl:e,fileName:t,keyStorePath:r=s3}){try{ec(t);let n=(0,iV.join)(r,t);if(!(await(0,nF.pathExists)(n))){el(),await en([{name:"ca-certificates"}]);let r=(0,iV.join)((0,iz.tmpdir)(),t),i=new ie.DownloaderHelper(e,(0,iz.tmpdir)(),{fileName:t});i.on("error",t=>{throw Error(`Failed to download ${e}: ${t}`);}),await i.start(),x("gpg",["--no-default-keyring","--keyring","gnupg-ring:"+n,"--import",r]),x("chmod",["644",n]);}return n;}catch(t){(0,rF.warning)(`Failed to add apt key via download ${e}: ${t}`);return;}}function el(){x("gpg",["-k"]);}function ec(e){if(!e.endsWith(".gpg"))throw Error("Key file name must end with .gpg: "+e);}async function eu(e={}){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof t)return{binDir:t};let r=await
apt-get update -o ${sZ} -y`),a=r,c=1===o?s.replace(/ -y \$PKG/g," -y clang-format-"+a):s,l=c=await tz(c),c=V()?l.replace(/apt-get/g,"nala"):l,await(0,nt.writeFile)(t,c),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function tz(e){let t=e.replace(/apt-get install -y/g,`apt-get install -o Dpkg::Options::="--force-overwrite" -o ${sZ} -y --fix-broken`);return await Promise.all(["libc++-$LLVM_VERSION-dev","libc++abi-$LLVM_VERSION-dev","libunwind-$LLVM_VERSION-dev"].map(async e=>{let r=e.replace("$LLVM_VERSION","*");(await Y(r))&&((0,rA.info)("Removing conflicting package "+r),t=t.replace(e,""));})),t;}function tV(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}function tX(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}async function tW(e){let t;if(a1.has(e))return null;let r="LLVM-",n=c(ih)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=c(ih)(e,"9.0.1"),o=!1;return i&&(t=tX(e,r,n),(await i$(t))||(o=!0)),(o||!i)&&(t=tV(e,r,n)),t;}function tY(e,t){switch(e){case"darwin":return function(e){if(a2.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return c(ih)(e,"9.0.1")?tX(e,r,n):tV(e,r,n);}(t);case"linux":return function(e){let t,r,n=e,i=a3.get(n);if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!a0.has(e))throw Error("Unsupported Ubuntu version: "+e);t=n.replace(e,""),n=eW(a0,e)[0];}else""!==n&&n in a4?t=a4[n]:(t=a4[a6],(0,rF.warning)(`Falling back to LLVM version ${a6} ${t} for the Ubuntu.`));let o="clang+llvm-";return(r="5.0.0"===n?`-linux-x86_64${t}.tar.xz`:t.includes("-rhel86")?`-x86_64-unknown-linux-gnu${t}.tar.xz`:`-x86_64-linux-gnu${t}.tar.xz`,c(ih)(n,"9.0.1"))?tX(n,o,r):tV(n,o,r);}(t);case"win32":return tW(t);default:return null;}}async function tK(e,t,r){let[n,i]=await eY(a0,t,e,tY);return(0,rF.info)("specific llvm version: "+n),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,ip.addExeExt)("clang"),extractFunction:"win32"===t?ej:(e,t)=>eU(e,t,1)};}async function tJ(e,t,r){var n;let i=await a8(e,t,r);return await t2(null!==(n=i.installDir)&&void 0!==n?n:t),i;}async function tZ(e,t,r){let[n,i]=await Promise.all([tQ(e,t,r),t3()]);return await a9(r),n;}async function tQ(e,t,r,n=iB.All){let i=Number.parseInt(function(e){if(null===c(iL)(e))try{let t=c(id)(e);if(null!==t)return(0,rF.info)(`Coerced version '${e}' to '${t}'`),t.version;}catch(e){}return e;}(e).split(".")[0],10);try{if(em())return await tH(i,n);}catch(e){(0,rF.info)("Failed to install llvm via system package manager "+e);}let o=await eG("llvm",e,tK,t,r);return await a5(i),o;}async function t0(e){em()&&(e<=10?await en([{name:"libtinfo5"}]):await en([{name:"libtinfo-dev"}]));}async function t1(e){"linux"===process.platform&&(await tR(tr("gcc",void 0,await aD()),"",e,40));}async function t2(e){var t,r;let n=null!==(t=process.env.LD_LIBRARY_PATH)&&void 0!==t?t:"",i=null!==(r=process.env.DYLD_LIBRARY_PATH)&&void 0!==r?r:"",o=[C("LLVM_PATH",e,ln),C("LD_LIBRARY_PATH",`${e}/lib${iV.delimiter}${n}`,ln),C("DYLD_LIBRARY_PATH",`${e}/lib${iV.delimiter}${i}`,ln),C("LDFLAGS",`-L"${e}/lib"`,ln),C("CPPFLAGS",`-I"${e}/include"`,ln),C("CC",(0,ip.addExeExt)(`${e}/bin/clang`),ln),C("CXX",(0,ip.addExeExt)(`${e}/bin/clang++`),ln),C("LIBRARY_PATH",`${e}/lib`,ln),tS()];em()&&o.push(q("cc",`${e}/bin/clang`,ln,60),q("cxx",`${e}/bin/clang++`,ln,60),q("clang",`${e}/bin/clang`,ln),q("clang++",`${e}/bin/clang++`,ln),q("lld",`${e}/bin/lld`,ln),q("ld.lld",`${e}/bin/ld.lld`,ln),q("llvm-ar",`${e}/bin/llvm-ar`,ln)),await Promise.all(o);}async function t3(){if(rj.GITHUB_ACTIONS){let e=(0,ip.join)(iH,"llvm_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,rF.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,rF.info)("::add-matcher::"+e);}}async function t4(e,t,r){switch(process.platform){case"win32":return eg("make",e);case"darwin":return await ef("make",e),await k("/usr/local/opt/make/libexec/gnubin",ln),{binDir:"/usr/l
2023-07-16 06:41:58 +08:00
setup-cpp [options]
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
Install all the tools required for building and testing C++/C projects.
--architecture the cpu architecture to install the tools for. By default it uses the current CPU architecture.
--timeout the timeout for the installation of each tool in minutes. By default it is 10 minutes.
2023-07-16 06:41:58 +08:00
--compiler the <compiler> to install.
You can specify the version instead of specifying just the name e.g: --compiler 'llvm-13.0.0'
--$tool_name pass "true" or pass the <version> you would like to install for this tool. e.g. --conan true or --conan "1.42.1"
All the available tools:
`),console.table({"compiler and analyzer":{tools:"--llvm, --gcc, --msvc, --vcvarsall, --cppcheck, --clangtidy, --clangformat"},"build system":{tools:"--cmake, --ninja, --meson, --make, --task, --bazel"},"package manager":{tools:"--vcpkg, --conan, --choco, --brew, --nala"},cache:{tools:"--ccache, --sccache"},documentation:{tools:"--doxygen, --graphviz"},coverage:{tools:"--gcovr, --opencppcoverage, --kcov"},other:{tools:"--python, --powershell, --sevenzip"}},["tools"]));let l=null!==(t=a.architecture)&&void 0!==t?t:process.arch,u=null!==(r=process.env.SETUP_CPP_DIR)&&void 0!==r?r:T("~"),p=[],f=[],d=nH.create({autoloadLocales:!0});nH.addLocale(c(nq)),nG.addLocale(c(nB));let h=await aD();if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!tn(e[t])),i=n.length>=1?e[n[0]]:"true";if(n.some(t=>e[t]!==i))return!1;for(let t of r)e[t]=i;return!0;}(a,["llvm","clangtidy","clangformat"]))return(0,rF.error)("The same version must be used for llvm, clangformat and clangtidy"),1;eh()&&"string"==typeof a.cppcheck&&"string"==typeof a.gcovr&&((0,rF.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await e_("python-pygments"));let m=!1,v=!1;for(let e of lt){if(rj.isCI&&0!==f.length){v=!0;break;}let t=a[e];void 0!==t&&(i=Date.now(),m=await tG(e,t,h,l,u,p,f,6e4*Number.parseFloat(null!==(n=a.timeout)&&void 0!==n?n:"20")),o=Date.now(),(0,rF.info)("took "+(d.format(i,o)||"0 seconds")));}if(!v){let e=a.compiler;if(void 0!==e){let t=Date.now();await ra(e,h,u,l,p,m,f);let r=Date.now();(0,rF.info)("took "+(d.format(t,r)||"0 seconds"));}}if(await $(ln),0===p.length&&0===f.length)return(0,rF.warning)("setup-cpp was called without any arguments. Nothing to do."),0;for(let e of p)(0,rF.success)(e);for(let e of f)(0,rF.error)(e);if((0,rF.info)("setup-cpp finished"),!rj.GITHUB_ACTIONS)switch(process.platform){case"win32":(0,rF.warning)("Run `RefreshEnv.cmd` or restart your shell to update the environment.");break;case"linux":case"darwin":(0,rF.warning)("Run `source ~/.cpprc` or restart your shell to update the environment.");}return await s,0===f.length?0:1;}var rc,ru,rp,rf,rd,rh,rm,rv,rg,ry,rE,rw,r_,rb,rx,rS,rO,rR,rI,rT,rP,rN,rA,r$,rC,rL,rk,rD,rj,rF,rU,rM,rG,rB,rH,rq,rz,rV,rX,rW,rY,rK,rJ,rZ,rQ,r0,r1,r2,r3,r4,r6,r8,r5,r9,r7,ne,nt,nr,nn,ni,no,ns,na,nl,nc,nu,np,nf,nd,nh,nm,nv,ng,ny,nE,nw,n_,nb,nx,nS,nO,nR,nI,nT,nP,nN,nA,n$,nC,nL,nk,nD,nj,nF,nU,nM,nG,nB,nH,nq,nz,nV,nX,nW,nY,nK,nJ,nZ,nQ,n0,n1,n2,n3,n4,n6,n8,n5,n9,n7,ie,it,ir,ii,io,is,ia,il,ic,iu,ip,id,ih,im,iv,ig,iy,iE,iw,i_,ib,ix,iS,iO,iR,iI,iT,iP,iN,iA,i$,iC,iL,ik,iD,ij,iF,iU,iM,iG,iB,iH,iq,iz=require("os"),iV=require("path"),iX=require("fs"),iW=require("crypto"),iY=require("http"),iK=require("https");require("net"),rf=require("tls"),rd=require("events"),rh=require("assert"),rm=require("util"),rv=require("fs"),rg=require("child_process"),ry=require("string_decoder"),rE=require("timers"),rw=require("buffer"),r_=require("path"),rb=require("child_process"),rx=require("process"),rS=require("url"),rO=require("os"),rR=require("buffer"),rI=require("stream"),rT=require("util"),rP=require("process"),rN=require("url"),rA=require("console"),rC={},rL={},null==(rk=(r$=globalThis).parcelRequire94c2)&&((rk=function(e){if(e in rC)return rC[e].exports;if(e in rL){var t=rL[e];delete rL[e];var r={id:e,exports:{}};return rC[e]=r,t.call(r.exports,r,r.exports),r.exports;}var n=Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n;}).register=function(e,t){rL[e]=t;},r$.parcelRequire94c2=rk),(rD=rk.register)("dKklS",function(e,t){var r;function n(e){return"string"==typeof e?!!i[e]:"env"in e?i[e.env]&&i[e.env].includes(e.includes):"any"in e?e.any.some(function(e){return!!i[e];}):Object.keys(e).every(function(t){return i[t]===e[t];});}r=rk("ksAXT");let i=process.env;Object.defineProperty(e.exports,"_vendors",{value:r.map(function(e){return e.constant;})}),e.exports.name=null,e.exports.isPR=null,r.forEach(function(t){let r=(Array.isArray(t.env)?t.env:[t.env]).every(function(e){return n(e);});if(e.exports[t.constant]=r,r)switch(e.exports.name=t.name,typeof t.pr){
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);},e.exports.setOutput=function(e,t){if(process.env.GITHUB_OUTPUT)return a.issueFileCommand("OUTPUT",a.prepareKeyValueMessage(e,t));process.stdout.write(y.EOL),s.issueCommand("set-output",{name:e},l.toCommandValue(t));},e.exports.setCommandEcho=function(e){s.issue("echo",e?"on":"off");},e.exports.setFailed=function(e){process.exitCode=u.Failure,m(e);},e.exports.isDebug=function(){return"1"===process.env.RUNNER_DEBUG;},e.exports.debug=function(e){s.issueCommand("debug",{},e);},e.exports.error=m,e.exports.warning=function(e,t={}){s.issueCommand("warning",l.toCommandProperties(t),e instanceof Error?e.toString():e);},e.exports.notice=function(e,t={}){s.issueCommand("notice",l.toCommandProperties(t),e instanceof Error?e.toString():e);},e.exports.info=function(e){process.stdout.write(e+y.EOL);},e.exports.startGroup=v,e.exports.endGroup=g,e.exports.group=function(e,t){return o(this,void 0,void 0,function*(){let r;v(e);try{r=yield t();}finally{g();}return r;});},e.exports.saveState=function(e,t){if(process.env.GITHUB_STATE)return a.issueFileCommand("STATE",a.prepareKeyValueMessage(e,t));s.issueCommand("save-state",{name:e},l.toCommandValue(t));},e.exports.getState=function(e){return process.env["STATE_"+e]||"";},e.exports.getIDToken=function(e){return o(this,void 0,void 0,function*(){return yield c.OidcClient.getIDToken(e);});},p=rk("1mzjm"),Object.defineProperty(e.exports,"summary",{enumerable:!0,get:function(){return p.summary;}}),p=rk("1mzjm"),Object.defineProperty(e.exports,"markdownSummary",{enumerable:!0,get:function(){return p.markdownSummary;}}),f=rk("31rWp"),Object.defineProperty(e.exports,"toPosixPath",{enumerable:!0,get:function(){return f.toPosixPath;}}),Object.defineProperty(e.exports,"toWin32Path",{enumerable:!0,get:function(){return f.toWin32Path;}}),Object.defineProperty(e.exports,"toPlatformPath",{enumerable:!0,get:function(){return f.toPlatformPath;}});}),rD("ekchs",function(e,t){var r,n,i,o;function s(e,t,r){let n=new l(e,t,r);process.stdout.write(n.toString()+a.EOL);}r=e.exports&&e.exports.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r];}});}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r];}),n=e.exports&&e.exports.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),i=e.exports&&e.exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t;},Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.issue=e.exports.issueCommand=void 0;let a=i(iz);o=rk("iYcPV"),e.exports.issueCommand=s,e.exports.issue=function(e,t=""){s(e,{},t);};class l{constructor(e,t,r){e||(e="missing.command"),this.command=e,this.properties=t,this.message=r;}toString(){var e;let t="::"+this.command;if(this.properties&&Object.keys(this.properties).length>0){t+=" ";let e=!0;for(let r in this.properties)if(this.properties.hasOwnProperty(r)){let n=this.properties[r];n&&(e?e=!1:t+=",",t+=`${r}=${o.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+("::"+(e=this.message,o.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")));}}}),rD("iYcPV",function(e,t){Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.toCommandProperties=e.exports.toCommandValue=void 0,e.exports.toCommandValue=function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},e.exports.toCommandProperties=function(e){return Object.keys(e).length?{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}:{};};}),rD("lyZGK",function(e,t){var r,n,i,o,s;r=e.exports&&e.exports.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r];}});}:function(e,
Error Code : ${e.statusCode}
Error Message: ${e.message}`);})).result)||void 0===t?void 0:t.value;if(!n)throw Error("Response json body do not have ID Token field");return n;});}static getIDToken(e){return r(this,void 0,void 0,function*(){try{let t=s.getIDTokenUrl();if(e){let r=encodeURIComponent(e);t=`${t}&audience=${r}`;}o.debug("ID token url is "+t);let r=yield s.getCall(t);return o.setSecret(r),r;}catch(e){throw Error("Error message: "+e.message);}});}}e.exports.OidcClient=s;}),rD("3gEyU",function(e,t){var r,n,i,o,s,a,l,c,u;r=e.exports&&e.exports.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r];}}),Object.defineProperty(e,n,i);}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r];}),n=e.exports&&e.exports.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t});}:function(e,t){e.default=t;}),i=e.exports&&e.exports.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&r(t,e,i);return n(t,e),t;},o=e.exports&&e.exports.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function s(e){try{l(n.next(e));}catch(e){o(e);}}function a(e){try{l(n.throw(e));}catch(e){o(e);}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t);})).then(s,a);}l((n=n.apply(e,t||[])).next());});},Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.HttpClient=e.exports.isHttps=e.exports.HttpClientResponse=e.exports.HttpClientError=e.exports.getProxyUrl=e.exports.MediaTypes=e.exports.Headers=e.exports.HttpCodes=void 0;let p=i(iY),f=i(iK),d=i(rk("dAfjw")),h=i(rk("bbp3j"));(c=s||(e.exports.HttpCodes=s={}))[c.OK=200]="OK",c[c.MultipleChoices=300]="MultipleChoices",c[c.MovedPermanently=301]="MovedPermanently",c[c.ResourceMoved=302]="ResourceMoved",c[c.SeeOther=303]="SeeOther",c[c.NotModified=304]="NotModified",c[c.UseProxy=305]="UseProxy",c[c.SwitchProxy=306]="SwitchProxy",c[c.TemporaryRedirect=307]="TemporaryRedirect",c[c.PermanentRedirect=308]="PermanentRedirect",c[c.BadRequest=400]="BadRequest",c[c.Unauthorized=401]="Unauthorized",c[c.PaymentRequired=402]="PaymentRequired",c[c.Forbidden=403]="Forbidden",c[c.NotFound=404]="NotFound",c[c.MethodNotAllowed=405]="MethodNotAllowed",c[c.NotAcceptable=406]="NotAcceptable",c[c.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",c[c.RequestTimeout=408]="RequestTimeout",c[c.Conflict=409]="Conflict",c[c.Gone=410]="Gone",c[c.TooManyRequests=429]="TooManyRequests",c[c.InternalServerError=500]="InternalServerError",c[c.NotImplemented=501]="NotImplemented",c[c.BadGateway=502]="BadGateway",c[c.ServiceUnavailable=503]="ServiceUnavailable",c[c.GatewayTimeout=504]="GatewayTimeout",(u=a||(e.exports.Headers=a={})).Accept="accept",u.ContentType="content-type",(l||(e.exports.MediaTypes=l={})).ApplicationJson="application/json",e.exports.getProxyUrl=function(e){let t=d.getProxyUrl(new URL(e));return t?t.href:"";};let m=[s.MovedPermanently,s.ResourceMoved,s.SeeOther,s.TemporaryRedirect,s.PermanentRedirect],v=[s.BadGateway,s.ServiceUnavailable,s.GatewayTimeout],g=["OPTIONS","GET","DELETE","HEAD"];class y extends Error{constructor(e,t){super(e),this.name="HttpClientError",this.statusCode=t,Object.setPrototypeOf(this,y.prototype);}}e.exports.HttpClientError=y;class E{constructor(e){this.message=e;}readBody(){return o(this,void 0,void 0,function*(){return new Promise(e=>o(this,void 0,void 0,function*(){let t=Buffer.alloc(0);this.message.on("data",e=>{t=Buffer.concat([t,e]);}),this.message.on("end",()=>{e(t.toString());});}));});}readBodyBuffer(){return o(this,void 0,void 0,function*(){return new Promise(e=>o(this,void 0,void 0,function*(){let t=[];this.message.on("data",e=>{t.push(e);}),this.message.on("end",()=>{e(Buffer.concat(t));});}));});}}e.exports.HttpClientResponse=E,e.exports.isHttps=function(e){return"https:"===new URL(e).protocol;},e.exports.HttpClient=class{const
${t}`,on=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),oi=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),oo=(e,t,r)=>{let n=""===r?"":`with ${r.trim()}() `,i=or.bind(null,n,t.toString());Object.defineProperty(i,"name",oi),Object.defineProperty(e,"toString",{...on,value:i});},os=new WeakMap(),oa=(e,t={})=>{let r;if("function"!=typeof e)throw TypeError("Expected a function");let n=0,i=e.displayName||e.name||"<anonymous>",o=function(...s){if(os.set(o,++n),1===n)r=e.apply(this,s),e=null;else if(!0===t.throw)throw Error(`Function \`${i}\` can only be called once`);return r;};return!function(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let n of Reflect.ownKeys(t))i7(e,t,n,r);ot(e,t),oo(e,t,n);}(o,e),os.set(o,n),o;};oa.callCount=e=>{if(!os.has(e))throw Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return os.get(e);},rQ=oa;const ol=()=>Array.from({length:op-ou+1},oc),oc=(e,t)=>({name:"SIGRT"+(t+1),number:ou+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),ou=34,op=64,of=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"t
${n.message}`:v,E=[y,t,e].filter(Boolean).join("\n");return g?(n.originalMessage=n.message,n.message=E):n=Error(E),n.shortMessage=y,n.command=s,n.escapedCommand=a,n.exitCode=o,n.signal=i,n.signalDescription=h,n.stdout=e,n.stderr=t,n.cwd=d,void 0!==r&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!l,n.isCanceled=u,n.killed=p&&!l,n;},ow=["stdin","stdout","stderr"],o_=e=>ow.some(t=>void 0!==e[t]),ob=e=>{if(!e)return;let{stdio:t}=e;if(void 0===t)return ow.map(t=>e[t]);if(o_(e))throw Error("It's not possible to provide `stdio` in combination with one of "+ow.map(e=>`\`${e}\``).join(", "));if("string"==typeof t)return t;if(!Array.isArray(t))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof t}\``);return Array.from({length:Math.max(t.length,ow.length)},(e,r)=>t[r]);};r0={};const ox=function(e){return e&&"object"==typeof e&&"function"==typeof e.removeListener&&"function"==typeof e.emit&&"function"==typeof e.reallyExit&&"function"==typeof e.listeners&&"function"==typeof e.kill&&"number"==typeof e.pid&&"function"==typeof e.on;};if(ox(r1=r$.process)){var oS,oO=rh,oR=rk("bJALw"),oI=/^win/i.test(r1.platform),oT=rd;"function"!=typeof oT&&(oT=oT.EventEmitter),r1.__signal_exit_emitter__?oS=r1.__signal_exit_emitter__:((oS=r1.__signal_exit_emitter__=new oT()).count=0,oS.emitted={}),oS.infinite||(oS.setMaxListeners(1/0),oS.infinite=!0);var oP=function(){o$&&ox(r$.process)&&(o$=!1,oR.forEach(function(e){try{r1.removeListener(e,oA[e]);}catch(e){}}),r1.emit=oD,r1.reallyExit=oL,oS.count-=1);};(r0=function(e,t){if(!ox(r$.process))return function(){};oO.equal(typeof e,"function","a callback must be provided for exit handler"),!1===o$&&oC();var r="exit";return t&&t.alwaysLast&&(r="afterexit"),oS.on(r,e),function(){oS.removeListener(r,e),0===oS.listeners("exit").length&&0===oS.listeners("afterexit").length&&oP();};}).unload=oP;var oN=function(e,t,r){oS.emitted[e]||(oS.emitted[e]=!0,oS.emit(e,t,r));},oA={};oR.forEach(function(e){oA[e]=function(){ox(r$.process)&&r1.listeners(e).length===oS.count&&(oP(),oN("exit",null,e),oN("afterexit",null,e),oI&&"SIGHUP"===e&&(e="SIGINT"),r1.kill(r1.pid,e));};}),r0.signals=function(){return oR;};var o$=!1,oC=function(){!o$&&ox(r$.process)&&(o$=!0,oS.count+=1,oR=oR.filter(function(e){try{return r1.on(e,oA[e]),!0;}catch(e){return!1;}}),r1.emit=oj,r1.reallyExit=ok);};r0.load=oC;var oL=r1.reallyExit,ok=function(e){ox(r$.process)&&(r1.exitCode=e||0,oN("exit",r1.exitCode,null),oN("afterexit",r1.exitCode,null),oL.call(r1,r1.exitCode));},oD=r1.emit,oj=function(e,t){if(!("exit"===e&&ox(r$.process)))return oD.apply(this,arguments);void 0!==t&&(r1.exitCode=t);var r=oD.apply(this,arguments);return oN("exit",r1.exitCode,null),oN("afterexit",r1.exitCode,null),r;};}else r0=function(){return function(){};};const oF=(e,t="SIGTERM",r={})=>{let n=e(t);return oU(e,t,r,n),n;},oU=(e,t,r,n)=>{if(!oM(t,r,n))return;let i=setTimeout(()=>{e("SIGKILL");},oB(r));i.unref&&i.unref();},oM=(e,{forceKillAfterTimeout:t},r)=>oG(e)&&!1!==t&&r,oG=e=>e===c(rO).constants.signals.SIGTERM||"string"==typeof e&&"SIGTERM"===e.toUpperCase(),oB=({forceKillAfterTimeout:e=!0})=>{if(!0===e)return 5e3;if(!Number.isFinite(e)||e<0)throw TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);return e;},oH=(e,t)=>{e.kill()&&(t.isCanceled=!0);},oq=(e,t,r)=>{e.kill(t),r(Object.assign(Error("Timed out"),{timedOut:!0,signal:t}));},oz=(e,{timeout:t,killSignal:r="SIGTERM"},n)=>{let i;return 0===t||void 0===t?n:Promise.race([new Promise((n,o)=>{i=setTimeout(()=>{oq(e,r,o);},t);}),n.finally(()=>{clearTimeout(i);})]);},oV=({timeout:e})=>{if(void 0!==e&&(!Number.isFinite(e)||e<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e}\` (${typeof e})`);},oX=async(e,{cleanup:t,detached:r},n)=>{if(!t||r)return n;let i=c(r0)(()=>{e.kill();});return n.finally(()=>{i();});},oW=e=>e instanceof rb.ChildProcess&&"function"==typeof e.then,oY=(e,t,r)=>{if("string"==typeof r)return e[t].pipe((0,rv.createWriteStream)(r)),e;if(g
`);},sm=({env:e,extendEnv:t,preferLocal:r,localDir:n,execPath:i})=>{let o=t?{...c(rx).env,...e}:e;return r?i9({env:o,cwd:n,execPath:i}):o;},sv=(e,t,r={})=>{let n=c(rM)._parse(e,t,r);return e=n.command,t=n.args,(r={maxBuffer:1e8,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:(r=n.options).cwd||c(rx).cwd(),execPath:c(rx).execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:sp,...r}).env=sm(r),r.stdio=ob(r),"win32"===c(rx).platform&&"cmd"===c(r_).basename(e,".exe")&&t.unshift("/q"),{file:e,args:t,options:r,parsed:n};},sg=(e,t,r)=>"string"==typeof t||(0,rw.Buffer).isBuffer(t)?e.stripFinalNewline?function(e){let t="string"==typeof e?"\n":"\n".charCodeAt(),r="string"==typeof e?"\r":"\r".charCodeAt();return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===r&&(e=e.slice(0,-1)),e;}(t):t:void 0===r?void 0:"",sy=({input:e,inputFile:t,stdio:r})=>void 0===e&&void 0===t&&void 0===r?{stdin:"inherit"}:{},sE=(e={})=>({preferLocal:!0,...sy(e),...e});!function e(t){function r(n,...i){if(!Array.isArray(n))return e({...t,...n});let[o,...s]=su(n,i);return E(o,s,sE(t));}return r.sync=(e,...r)=>{if(!Array.isArray(e))throw TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[n,...i]=su(e,r);return w(n,i,sE(t));},r;}(),r7={},l(ne={},"isexe",()=>sw),l(ne,"sync",()=>s_),nt=rk("6vN83");const sw=async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return sb(await(0,nt.stat)(e),t);}catch(e){if(r||"EACCES"===e.code)return!1;throw e;}},s_=(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return sb((0,iX.statSync)(e),t);}catch(e){if(r||"EACCES"===e.code)return!1;throw e;}},sb=(e,t)=>e.isFile()&&sx(e,t),sx=(e,t)=>{var r,n,i,o,s,a,l,c,u,p,f;let d=null!==(l=t.uid)&&void 0!==l?l:null===(r=(n=process).getuid)||void 0===r?void 0:r.call(n),h=null!==(u=null!==(c=t.groups)&&void 0!==c?c:null===(i=(o=process).getgroups)||void 0===i?void 0:i.call(o))&&void 0!==u?u:[],m=null!==(f=null!==(p=t.gid)&&void 0!==p?p:null===(s=(a=process).getgid)||void 0===s?void 0:s.call(a))&&void 0!==f?f:h[0];if(void 0===d||void 0===m)throw Error("cannot get uid or gid");let v=new Set([m,...h]),g=e.mode,y=e.uid,E=e.gid,w=parseInt("100",8),_=parseInt("010",8);return!!(g&parseInt("001",8)||g&_&&v.has(E)||g&w&&y===d||g&(w|_)&&0===d);};l(nr={},"isexe",()=>sS),l(nr,"sync",()=>sO),nt=rk("6vN83");const sS=async(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return sI(await(0,nt.stat)(e),e,t);}catch(e){if(r||"EACCES"===e.code)return!1;throw e;}},sO=(e,t={})=>{let{ignoreErrors:r=!1}=t;try{return sI((0,iX.statSync)(e),e,t);}catch(e){if(r||"EACCES"===e.code)return!1;throw e;}},sR=(e,t)=>{let{pathExt:r=process.env.PATHEXT||""}=t,n=r.split(";");if(-1!==n.indexOf(""))return!0;for(let t=0;t<n.length;t++){let r=n[t].toLowerCase(),i=e.substring(e.length-r.length).toLowerCase();if(r&&i===r)return!0;}return!1;},sI=(e,t,r)=>e.isFile()&&sR(t,r),sT="win32"===(process.env._ISEXE_TEST_PLATFORM_||process.platform)?nr:ne,sP=sT.isexe,sN=sT.sync;nn=iV.join,ni=iV.delimiter,no=iV.sep,ns=iV.posix;const sA="win32"===process.platform,s$=new RegExp(`[${ns.sep}${no===ns.sep?"":no}]`.replace(/(\\)/g,"\\$1")),sC=RegExp("^\\."+s$.source),sL=e=>Object.assign(Error("not found: "+e),{code:"ENOENT"}),sk=(e,{path:t=process.env.PATH,pathExt:r=process.env.PATHEXT,delimiter:n=ni})=>{let i=e.match(s$)?[""]:[...(sA?[process.cwd()]:[]),...(t||"").split(n)];if(sA){let t=r||[".EXE",".CMD",".BAT",".COM"].join(n),o=t.split(n).flatMap(e=>[e,e.toLowerCase()]);return e.includes(".")&&""!==o[0]&&o.unshift(""),{pathEnv:i,pathExt:o,pathExtExe:t};}return{pathEnv:i,pathExt:[""]};},sD=(e,t)=>{let r=/^".*"$/.test(e)?e.slice(1,-1):e;return(!r&&sC.test(t)?t.slice(0,2):"")+nn(r,t);},sj=async(e,t={})=>{let{pathEnv:r,pathExt:n,pathExtExe:i}=sk(e,t),o=[];for(let s of r){let r=sD(s,e);for(let e of n){let n=r+e;if(await sP(n,{pathExt:i,ignoreErrors:!0})){if(!t.all)return n;o.push(n);}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw sL(e);};r7=sj,sj.sync=(e,t={})=>{let{pathEnv:r,pathExt:n,pathExtExe:i}=sk(e,t),o=[];for(let s of r){let r=sD(s,e);for(let e of n){let n=r+e;if(sN(n,{pathExt:
2023-07-16 06:41:58 +08:00
//# sourceMappingURL=setup-cpp.js.map