mirror of https://github.com/aminya/setup-cpp
fix: use the system package manager instead of pip for standard modules
This commit is contained in:
parent
678aa3361f
commit
3fa4b5925a
|
@ -1221,7 +1221,7 @@ let e=await n(t,o);if(null!==e){// eslint-disable-next-line no-await-in-loop
|
|||
if(await oK(e))return[o,e];i.push(e);}}throw Error(`Unsupported target! (platform='${t}', version='${r}'). Try one of the following: ${JSON.stringify(e)}`);}const oZ=/v?(\d\S*)/;async function o0(e,t=oZ){try{let r=await(0,oo.getExecOutput)(e,["--version"]),n=r.stdout||r.stderr||"",i=n.trim().match(t)?.[1];return/*@__PURE__*/G(oO)(i)??void 0;}catch(e){console.error(e);return;}}async function o1(e,t,r=oZ){let n=await o0(e,r);return void 0!==n&&""!==t&&-1!==/*@__PURE__*/G(oY)(n,t);}// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
|
||||
// the directly downloaded tools require a given version ("" doesn't work).
|
||||
function o2(){switch(process.platform){case"win32":default:return"16.0.6";case"linux":// used for non-ubuntu (Fedora, Arch)
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iF()?"1.9.8-1":"1.9.8",gcc:iF()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nF=V("bOuKS");async function o5(e,t,r){let n=await o9(e,t,r);G(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o8(i),await o7(i),n;}async function o8(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"});}catch(e){(0,z.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,z.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iP.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iF()?"1.9.8-1":"1.9.8",gcc:iF()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nF=V("bOuKS");async function o5(e,t,r){let n=await o9(e,t,r);G(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o8(i),await o7(i),n;}async function o8(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"}),await sy(e,"venv",void 0,{upgrade:!1,usePipx:!1});}catch(e){(0,z.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,z.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iP.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
if(W.GITHUB_ACTIONS)try{(0,z.info)("Installing python in GitHub Actions");let{setupActionsPython:o}=await V("7wakU");await o(e,t,r),i=await st(t);let s=(0,iP.dirname)(i);n={bin:i,installDir:s,binDir:s};}catch(e){(0,z.warning)(e.toString());}void 0===n&&(n=await se(t,e));}return(void 0===i||void 0===n.bin)&&(i=await st(t),n.bin=i),n;}async function se(e,t){let r;switch(process.platform){case"win32":{e?await iM("python3",t,[`--params=/InstallDir:${e}`]):await iM("python3",t);// Adding the bin dir to the path
|
||||
let n=await st(e),i=(0,iP.dirname)(n);/** The directory which the tool is installed to */await nq(i),r={installDir:i,binDir:i,bin:n};break;}case"darwin":{r=await iD("python3",t);// add the python and pip binaries to the path
|
||||
let e=await nI("brew",["--prefix","python"],{stdio:"pipe"}),n=(0,iP.join)(e.stdout,"libexec","bin");await nq(n);break;}case"linux":if(iF())r=await iK("python",t);else if(iG())r=await iB([{name:"python3",version:t}]);else if(iq())r=await ix([{name:"python3",version:t},{name:"python-is-python3"}]);else throw Error("Unsupported linux distributions");break;default:throw Error("Unsupported platform");}return r;}async function st(e){for(let t of["python3","python"]){// eslint-disable-next-line no-await-in-loop
|
||||
|
@ -1233,7 +1233,7 @@ if(await o1(e,o3.python))return e;}catch{// fall through
|
|||
let t=await so(e);if(void 0!==t)return t;}}async function so(e){try{let t=(await/*@__PURE__*/G(nQ)(e,{nothrow:!0,all:!0}))??[];for(let e of t)// eslint-disable-next-line no-await-in-loop
|
||||
if(null!==e&&(await o1(e,o3.pip)))return e;}catch{// fall through
|
||||
}}async function ss(e){let t=await sa(e);t||(// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||
await sS("pip"),// upgrade pip
|
||||
await s$("pip"),// upgrade pip
|
||||
await sa(e));}async function sa(e){try{return await nI(e,["-m","ensurepip","-U","--upgrade"],{stdio:"inherit"}),!0;}catch(t){(0,z.info)(t?.toString?.());try{return(// ensure pip is disabled on Ubuntu
|
||||
await nI(e,["-m","pip","install","--upgrade","pip"],{stdio:"inherit"}),!0);}catch(e){(0,z.info)(e?.toString?.());// pip module not found
|
||||
}}// all methods failed
|
||||
|
@ -1244,12 +1244,12 @@ t.push((0,iP.join)(r,"Scripts"),(0,iP.join)(r,"Scripts","bin"),(0,iP.join)(r,"bi
|
|||
function(e,t){let r=e[0],n=Object.keys(t).map(e=>parseInt(e,10)).sort((e,t)=>t-e)// sort in descending order
|
||||
.find(e=>r>=e);return void 0===n?"":t[n];}(r,o6[e]):sd(t)&&e in o4?o4[e]:"true"===t?"":t??"";}function sd(e){return"true"===e||void 0===e;}var z=V("7Lz0k"),sp={};async function sf(){var e,t;if("linux"!==process.platform)return[];let r=await(e="lsb_release",t=["-a"],new Promise((r,n)=>{$.execFile(e,t,{encoding:"utf8",shell:!1},(i,o,s)=>{if(i){if("errno"in i&&"ENOENT"===i.code){r(null);// When lsb_release is not found
|
||||
return;}n(Error(`Could not execute \`${e} ${t.join(" ")}\`: ${i} (stderr=${s})`));return;}r(o);});}));if(null===r)return[];let n=/^Distributor ID:\s*(.+)$/,i=/^Description:\s*Ubuntu\s+(\d+)\.(\d+)(?:\.(\d+))?/,o=/^Release:\s*(\d+)\.(\d+)(?:\.(\d+))?$/,s=null,a=null,l=!1;for(let e of r.split("\n")){let t=e.match(n);if(null!==t){let e=t[1];if("Ubuntu"!==e)return[];l=!0;}let r=e.match(i);r&&(s=r);let c=e.match(o);if(c&&(a=c),l&&s&&a)break;}if(!l)return[];for(let e of[s,a])if(e){let t=[e[1],e[2]];return e[3]&&t.push(e[3]),t.map(e=>parseInt(e,10));}return[];}async function sh(){try{if(!iq())return null;{try{null===/*@__PURE__*/G(nQ).sync("lsb_release",{nothrow:!0})&&(await ix([{name:"lsb-release"}]));}catch{return sg();}let e=await(0,sp.getUbuntuVersion)();if(0===e.length)return sg();return e;}}catch(e){return(0,z.warning)(e.toString()),null;}}Object.defineProperty(sp,"__esModule",{value:!0}),sp.getUbuntuVersion=void 0,sp.getUbuntuVersion=sf;const sm=oV(sh);/** Detect Ubuntu version using os.version() for Ubuntu based distros */function sg(){// #46~22.04.1-Ubuntu SMP ...
|
||||
let e=G(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sv(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${r??""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[];nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await sS(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sb(u,t);return await nq(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o5(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oV(sx);async function sb(e,t){let r=await Promise.all(e.map(e=>(0,nF.pathExists)((0,iP.join)(e,(0,iP.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/G(nQ).sync((0,iP.addExeExt)(t),{nothrow:!0});return null!==i?(0,iP.dirname)(i):e[e.length-1];}function sS(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iF())return iK(`python-${e}`);if(iG())return iB([{name:`python3-${e}`}]);if(iq())return ix([{name:`python3-${e}`}]);}return null;}async function s$(e,t,r){switch(process.platform){case"win32":{await iM("cppcheck",e);let t=await sO();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iF())return iK("cppcheck",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sO(){let e="C:/Program Files/Cppcheck";return await nq(e),e;}var iP=V("eq4yW"),z=V("7Lz0k");async function s_(e,t,r){switch(process.platform){case"win32":return await iM("graphviz",e),sC();case"darwin":return iD("graphviz",e);case"linux":if(iF())return iK("graphviz",e);if(iG())return iB([{name:"graphviz",version:e}]);if(iq())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sC(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nq(e),{binDir:e};}throw Error("Unsupported platform");}var nF=V("bOuKS");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sI(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iJ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sT(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/G(o_)(()=>iM("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,z.info)(e)});let t=await sR();return await s_(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await s_(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iF()||iG()){if(iF())n=await iK("doxygen",e);else if(iG())return iB([{name:"doxygen",version:e}]);else if(iq())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iq())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sI,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,z.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await s_(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sR(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nF.pathExists)((0,iP.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nq(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sP=V("jsxzs"),oO=V("brvh5"),oo=V("8hZvX"),z=V("7Lz0k");async function sA(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nB("SDKROOT",t.trim()):(0,z.error)("SDKROOT not set");}catch(e){(0,z.error)(e);}}var iP=V("eq4yW"),z=V("7Lz0k"),W=V("2W4C2"),nF=V("bOuKS"),sN=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sk(e,t,r){if("win32"===t){let t=sL[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oA,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sD(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iM("gcc-arm-embedded",e));try{n=await oR("g++",e,sk,t,r);}catch(t){(0,z.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sj(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iF()?n=await iK("gcc",e):iG()?n=await iB([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iq()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,z.info)(`Install g++-multilib because gcc for ${r} was requested`),iF()?await iK("gcc-multilib",e):iq()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
let e=G(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sv(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${r??""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[],a=await sb(e,t);if(a)nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});else if((await s$(t))===null)throw Error(`Failed to install ${t}.`);}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await s$(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sS(u,t);return await nq(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o5(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oV(sx);async function sb(e,t){let r=await nI(e,["-m","pip","show",t],{stdio:"ignore",reject:!1});return 0===r.exitCode;}async function sS(e,t){let r=await Promise.all(e.map(e=>(0,nF.pathExists)((0,iP.join)(e,(0,iP.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/G(nQ).sync((0,iP.addExeExt)(t),{nothrow:!0});return null!==i?(0,iP.dirname)(i):e[e.length-1];}function s$(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iF())return iK(`python-${e}`);if(iG())return iB([{name:`python3-${e}`}]);if(iq())return ix([{name:`python3-${e}`}]);}return null;}async function sO(e,t,r){switch(process.platform){case"win32":{await iM("cppcheck",e);let t=await s_();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iF())return iK("cppcheck",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function s_(){let e="C:/Program Files/Cppcheck";return await nq(e),e;}var iP=V("eq4yW"),z=V("7Lz0k");async function sC(e,t,r){switch(process.platform){case"win32":return await iM("graphviz",e),sI();case"darwin":return iD("graphviz",e);case"linux":if(iF())return iK("graphviz",e);if(iG())return iB([{name:"graphviz",version:e}]);if(iq())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sI(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nq(e),{binDir:e};}throw Error("Unsupported platform");}var nF=V("bOuKS");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sT(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iJ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sR(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/G(o_)(()=>iM("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,z.info)(e)});let t=await sP();return await sC(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await sC(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iF()||iG()){if(iF())n=await iK("doxygen",e);else if(iG())return iB([{name:"doxygen",version:e}]);else if(iq())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iq())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sT,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,z.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await sC(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sP(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nF.pathExists)((0,iP.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nq(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sA=V("jsxzs"),oO=V("brvh5"),oo=V("8hZvX"),z=V("7Lz0k");async function sN(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nB("SDKROOT",t.trim()):(0,z.error)("SDKROOT not set");}catch(e){(0,z.error)(e);}}var iP=V("eq4yW"),z=V("7Lz0k"),W=V("2W4C2"),nF=V("bOuKS"),sL=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sk={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sD(e,t,r){if("win32"===t){let t=sk[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oA,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sU(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iM("gcc-arm-embedded",e));try{n=await oR("g++",e,sD,t,r);}catch(t){(0,z.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sM(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iF()?n=await iK("gcc",e):iG()?n=await iB([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iq()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,z.info)(`Install g++-multilib because gcc for ${r} was requested`),iF()?await iK("gcc-multilib",e):iq()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
// TODO support abi
|
||||
// case "none": {
|
||||
// if (arch === "arm" || arch === "arm64") {
|
||||
|
@ -1260,12 +1260,12 @@ const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-ming
|
|||
// throw new Error(`Unsupported platform for ${arch}`)
|
||||
// }
|
||||
// }
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sM(e,n.binDir),n;}async function sU(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sD(e,t,r);case"linux":iF()?n=await iK("mingw-w64-gcc",e):iG()?n=await iB([{name:"mingw64-gcc",version:e}]):iq()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sF(e,n.binDir),n;}async function sj(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sU(e,t,r);case"linux":iF()?n=await iK("mingw-w64-gcc",e):iG()?n=await iB([{name:"mingw64-gcc",version:e}]):iq()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/i686-w64-mingw32-g++-win32 to provide /usr/bin/i686-w64-mingw32-g++ (i686-w64-mingw32-g++) in auto mode
|
||||
//Setting up g++-mingw-w64-x86-64-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/x86_64-w64-mingw32-g++-win32 to provide /usr/bin/x86_64-w64-mingw32-g++ (x86_64-w64-mingw32-g++) in auto mode
|
||||
//await activateGcc(version, installationInfo.binDir)
|
||||
return n;}async function sj(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(0,nF.pathExists)("C:/tools/mingw64/bin"))?(r="C:/tools/mingw64/bin",await nq(r)):"ia32"===t&&(await(0,nF.pathExists)("C:/tools/mingw32/bin"))?(r="C:/tools/mingw32/bin",await nq(r)):(await(0,nF.pathExists)(`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(r=`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin`),void 0!==r)return{binDir:r};}async function sM(e,t){let r=[];// Setup gcc as the compiler
|
||||
return n;}async function sM(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(0,nF.pathExists)("C:/tools/mingw64/bin"))?(r="C:/tools/mingw64/bin",await nq(r)):"ia32"===t&&(await(0,nF.pathExists)("C:/tools/mingw32/bin"))?(r="C:/tools/mingw32/bin",await nq(r)):(await(0,nF.pathExists)(`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(r=`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin`),void 0!==r)return{binDir:r};}async function sF(e,t){let r=[];// Setup gcc as the compiler
|
||||
// TODO
|
||||
// const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||
// const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||
|
@ -1276,13 +1276,13 @@ return n;}async function sj(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(
|
|||
// addEnv("LDFLAGS", `-L${installDir}/lib`),
|
||||
// addEnv("CPPFLAGS", `-I${installDir}/include`)
|
||||
// )
|
||||
if("win32"===process.platform)r.push(nB("CC",(0,iP.addExeExt)(`${t}/gcc`)),nB("CXX",(0,iP.addExeExt)(`${t}/g++`)));else{let n=/*@__PURE__*/G(sP)(/*@__PURE__*/G(oO)(e)??e);n>=5?(r.push(nB("CC",`${t}/gcc-${n}`),nB("CXX",`${t}/g++-${n}`)),iq()&&r.push(iT("cc",`${t}/gcc-${n}`),iT("cxx",`${t}/g++-${n}`),iT("gcc",`${t}/gcc-${n}`),iT("g++",`${t}/g++-${n}`))):(r.push(nB("CC",`${t}/gcc-${e}`),nB("CXX",`${t}/g++-${e}`)),iq()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sA()),W.GITHUB_ACTIONS&&(await sF()),await Promise.all(r);}async function sF(){let e=(0,iP.join)(sN,"gcc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}var oX=V("bJWbp"),sP=V("jsxzs"),iP=V("eq4yW"),z=V("7Lz0k"),iP=V("eq4yW");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sG(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sB(e,t,r){return oR("ninja",e,sG,t,r);}var sH=h.resolve(__dirname,"../../src/kcov");function sq(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:oD};}function sV(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:sW};}async function sW(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sz();"linux"===process.platform&&(iF()?await Promise.all([iK("libdwarf"),iK("libcurl-openssl")]):iG()?await iB([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iq()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/G(nQ).sync("patch",{nothrow:!0})){let e=(0,iP.join)(sH,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,z.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
if("win32"===process.platform)r.push(nB("CC",(0,iP.addExeExt)(`${t}/gcc`)),nB("CXX",(0,iP.addExeExt)(`${t}/g++`)));else{let n=/*@__PURE__*/G(sA)(/*@__PURE__*/G(oO)(e)??e);n>=5?(r.push(nB("CC",`${t}/gcc-${n}`),nB("CXX",`${t}/g++-${n}`)),iq()&&r.push(iT("cc",`${t}/gcc-${n}`),iT("cxx",`${t}/g++-${n}`),iT("gcc",`${t}/gcc-${n}`),iT("g++",`${t}/g++-${n}`))):(r.push(nB("CC",`${t}/gcc-${e}`),nB("CXX",`${t}/g++-${e}`)),iq()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sN()),W.GITHUB_ACTIONS&&(await sG()),await Promise.all(r);}async function sG(){let e=(0,iP.join)(sL,"gcc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}var oX=V("bJWbp"),sA=V("jsxzs"),iP=V("eq4yW"),z=V("7Lz0k"),iP=V("eq4yW");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sB(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sH(e,t,r){return oR("ninja",e,sB,t,r);}var sq=h.resolve(__dirname,"../../src/kcov");function sV(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:oD};}function sW(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:sz};}async function sz(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sK();"linux"===process.platform&&(iF()?await Promise.all([iK("libdwarf"),iK("libcurl-openssl")]):iG()?await iB([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iq()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/G(nQ).sync("patch",{nothrow:!0})){let e=(0,iP.join)(sq,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,z.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
}let i=(0,iP.join)(r,"build");// execRootSync(cmake, ["--install", buildDir], out)
|
||||
// return "user/local/bin" // the cmake install prefix
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sz(){let e=/*@__PURE__*/G(nQ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iP.join)(t8(""),"cmake"),"");e=(0,iP.join)(t,"cmake");}let t=/*@__PURE__*/G(nQ).sync("ninja",{nothrow:!0});return null===t&&(await sB(su("ninja",void 0,await sm()),(0,iP.join)(t8(""),"ninja"),"")),e;}async function sK(e,t,r){var n;let i;if("linux"!==process.platform){(0,z.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sq,t,r),iF()?await iK("binutils"):iG()?await iB([{name:"binutils"}]):iq()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sV,t,r),i;}var W=V("2W4C2"),z=V("7Lz0k"),nF=V("bOuKS"),iP=V("eq4yW"),ry=V("i5trn"),z=V("7Lz0k"),iP=V("eq4yW"),sY={},sX=sY&&sY.__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());});},sJ=sY&&sY.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sY,"__esModule",{value:!0});var sQ={},sZ=sQ&&sQ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sQ,"__esModule",{value:!0});const s0=sZ(f);var s1={};/**
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sK(){let e=/*@__PURE__*/G(nQ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iP.join)(t8(""),"cmake"),"");e=(0,iP.join)(t,"cmake");}let t=/*@__PURE__*/G(nQ).sync("ninja",{nothrow:!0});return null===t&&(await sH(su("ninja",void 0,await sm()),(0,iP.join)(t8(""),"ninja"),"")),e;}async function sY(e,t,r){var n;let i;if("linux"!==process.platform){(0,z.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sV,t,r),iF()?await iK("binutils"):iG()?await iB([{name:"binutils"}]):iq()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sW,t,r),i;}var W=V("2W4C2"),z=V("7Lz0k"),nF=V("bOuKS"),iP=V("eq4yW"),ry=V("i5trn"),z=V("7Lz0k"),iP=V("eq4yW"),sX={},sJ=sX&&sX.__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());});},sQ=sX&&sX.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sX,"__esModule",{value:!0});var sZ={},s0=sZ&&sZ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sZ,"__esModule",{value:!0});const s1=s0(f);var s2={};/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
|
@ -1291,27 +1291,27 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/function s2(e,t,r){let n=new s4(e,t,r);process.stdout.write(n.toString()+s0.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s1,"__esModule",{value:!0}),s1.toCommandValue=/**
|
||||
*/function s4(e,t,r){let n=new s3(e,t,r);process.stdout.write(n.toString()+s1.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s2,"__esModule",{value:!0}),s2.toCommandValue=/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sQ.issueCommand=s2,sQ.issue=function(e,t=""){s2(e,{},t);};class s4{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}=${s1.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s1.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s3={},s6=s3&&s3.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s3,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s5=s6(m),s8=s6(f);s3.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s5.existsSync(r))throw Error(`Missing file at path: ${r}`);s5.appendFileSync(r,`${s1.toCommandValue(t)}${s8.EOL}`,{encoding:"utf8"});};const s7=sJ(f),s9=sJ(h);/**
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sZ.issueCommand=s4,sZ.issue=function(e,t=""){s4(e,{},t);};class s3{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}=${s2.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s2.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s6={},s5=s6&&s6.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s6,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s8=s5(m),s7=s5(f);s6.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s8.existsSync(r))throw Error(`Missing file at path: ${r}`);s8.appendFileSync(r,`${s2.toCommandValue(t)}${s7.EOL}`,{encoding:"utf8"});};const s9=sQ(f),ae=sQ(h);/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/function ae(e){sQ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
*/function at(e){sZ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/function at(e){sQ.issue("group",e);}/**
|
||||
*/function ar(e){sZ.issue("group",e);}/**
|
||||
* End an output group.
|
||||
*/function ar(){sQ.issue("endgroup");}/**
|
||||
*/function an(){sZ.issue("endgroup");}/**
|
||||
* A code indicating that the action was successful
|
||||
*/(c=p=sY.ExitCode||(sY.ExitCode={}))[c.Success=0]="Success",/**
|
||||
*/(c=p=sX.ExitCode||(sX.ExitCode={}))[c.Success=0]="Success",/**
|
||||
* A code indicating that the action was a failure
|
||||
*/c[c.Failure=1]="Failure",sY.exportVariable=//-----------------------------------------------------------------------
|
||||
*/c[c.Failure=1]="Failure",sX.exportVariable=//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1319,57 +1319,57 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){let r=s1.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s7.EOL}${r}${s7.EOL}${t}`;s3.issueCommand("ENV",n);}else sQ.issueCommand("set-env",{name:e},r);},sY.setSecret=/**
|
||||
function(e,t){let r=s2.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s9.EOL}${r}${s9.EOL}${t}`;s6.issueCommand("ENV",n);}else sZ.issueCommand("set-env",{name:e},r);},sX.setSecret=/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/function(e){sQ.issueCommand("add-mask",{},e);},sY.addPath=/**
|
||||
*/function(e){sZ.issueCommand("add-mask",{},e);},sX.addPath=/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s3.issueCommand("PATH",e):sQ.issueCommand("add-path",{},e),process.env.PATH=`${e}${s9.delimiter}${process.env.PATH}`;},sY.getInput=/**
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s6.issueCommand("PATH",e):sZ.issueCommand("add-path",{},e),process.env.PATH=`${e}${ae.delimiter}${process.env.PATH}`;},sX.getInput=/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sY.setOutput=/**
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sX.setOutput=/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sQ.issueCommand("set-output",{name:e},t);},sY.setCommandEcho=/**
|
||||
function(e,t){sZ.issueCommand("set-output",{name:e},t);},sX.setCommandEcho=/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/function(e){sQ.issue("echo",e?"on":"off");},sY.setFailed=//-----------------------------------------------------------------------
|
||||
*/function(e){sZ.issue("echo",e?"on":"off");},sX.setFailed=//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/function(e){process.exitCode=p.Failure,ae(e);},sY.isDebug=//-----------------------------------------------------------------------
|
||||
*/function(e){process.exitCode=p.Failure,at(e);},sX.isDebug=//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sY.debug=/**
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sX.debug=/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/function(e){sQ.issueCommand("debug",{},e);},sY.error=ae,sY.warning=/**
|
||||
*/function(e){sZ.issueCommand("debug",{},e);},sX.error=at,sX.warning=/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/function(e){sQ.issue("warning",e instanceof Error?e.toString():e);},sY.info=/**
|
||||
*/function(e){sZ.issue("warning",e instanceof Error?e.toString():e);},sX.info=/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/function(e){process.stdout.write(e+s7.EOL);},sY.startGroup=at,sY.endGroup=ar,sY.group=/**
|
||||
*/function(e){process.stdout.write(e+s9.EOL);},sX.startGroup=ar,sX.endGroup=an,sX.group=/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/function(e,t){return sX(this,void 0,void 0,function*(){let r;at(e);try{r=yield t();}finally{ar();}return r;});},sY.saveState=//-----------------------------------------------------------------------
|
||||
*/function(e,t){return sJ(this,void 0,void 0,function*(){let r;ar(e);try{r=yield t();}finally{an();}return r;});},sX.saveState=//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1378,62 +1378,62 @@ function(e,t){sQ.issueCommand("set-output",{name:e},t);},sY.setCommandEcho=/**
|
|||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sQ.issueCommand("save-state",{name:e},t);},sY.getState=/**
|
||||
function(e,t){sZ.issueCommand("save-state",{name:e},t);},sX.getState=/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const an=T.env["ProgramFiles(x86)"],ai=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],ao=["Enterprise","Professional","Community"],as=["2022","2019","2017"],aa={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function al(e){if(Object.values(aa).includes(e));else if(e in aa)return aa[e];return e;}const ac=`${an}\\Microsoft Visual Studio\\Installer`;function au(e){let t;let r=al(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sY.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sY.info(`Found with vswhere: ${n}`),n;sY.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const ai=T.env["ProgramFiles(x86)"],ao=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],as=["Enterprise","Professional","Community"],aa=["2022","2019","2017"],al={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function ac(e){if(Object.values(al).includes(e));else if(e in al)return al[e];return e;}const au=`${ai}\\Microsoft Visual Studio\\Installer`;function ad(e){let t;let r=ac(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sX.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sX.info(`Found with vswhere: ${n}`),n;sX.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
// starting with the latest and moving to the oldest.
|
||||
let i=e?[function(e){if(Object.keys(aa).includes(e));else for(let[t,r]of Object.entries(aa))if(r===e)return t;return e;}(e)]:as;for(let e of ai)for(let t of i)for(let r of ao)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sY.info(`Trying standard location: ${n}`),m.existsSync(n))return sY.info(`Found standard location: ${n}`),n;if(sY.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${an}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sY.info(`Found VS 2015: ${n}`),n;throw sY.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sY.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+ac;// There are all sorts of way the architectures are called. In addition to
|
||||
let i=e?[function(e){if(Object.keys(al).includes(e));else for(let[t,r]of Object.entries(al))if(r===e)return t;return e;}(e)]:aa;for(let e of ao)for(let t of i)for(let r of as)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sX.info(`Trying standard location: ${n}`),m.existsSync(n))return sX.info(`Found standard location: ${n}`),n;if(sX.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${ai}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sX.info(`Found VS 2015: ${n}`),n;throw sX.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sX.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+au;// There are all sorts of way the architectures are called. In addition to
|
||||
// values supported by Microsoft Visual C++, recognize some common aliases.
|
||||
let s={win32:"x86",win64:"x64",x86_64:"x64","x86-64":"x64"};e.toLowerCase()in s&&(e=s[e.toLowerCase()]);// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
|
||||
// Call the configuration batch file and then output *all* the environment variables.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${au(o)}" ${a.join(" ")}`;sY.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${ad(o)}" ${a.join(" ")}`;sX.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
let g={};for(let e of d){let[t,r]=e.split("=");g[t]=r;}for(let e of(// Now look at the new environment and export everything that changed.
|
||||
// These are the variables set by vsvars.bat. Also export everything
|
||||
// that was not there during the first sweep: those are new variables.
|
||||
sY.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
sX.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
// Skip lines that don't look like environment variables.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==g[t]&&(sY.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==g[t]&&(sX.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
// This keeps path shadowing working as intended.
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sY.exportVariable(t,r));}sY.endGroup(),sY.info("Configured Developer Command Prompt");};var z=V("7Lz0k"),nF=V("bOuKS");async function ad(e,t,r,n,i,o,s){void 0!==t&&(await(0,nF.pathExists)(t))&&((0,z.info)(`Adding ${t} to PATH`),await nB("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class ap extends Error{constructor(e){super(e),this.name="TimeoutError";}}class af extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sX.exportVariable(t,r));}sX.endGroup(),sX.info("Configured Developer Command Prompt");};var z=V("7Lz0k"),nF=V("bOuKS");async function ap(e,t,r,n,i,o,s){void 0!==t&&(await(0,nF.pathExists)(t))&&((0,z.info)(`Adding ${t} to PATH`),await nB("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class af extends Error{constructor(e){super(e),this.name="TimeoutError";}}class ah extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
TODO: Remove AbortError and just throw DOMException when targeting Node 18.
|
||||
*/const ah=e=>void 0===globalThis.DOMException?new af(e):new DOMException(e),am=e=>{let t=void 0===e.reason?ah("This operation was aborted."):e.reason;return t instanceof Error?t:ah(t);};async function ag(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(am(e)),e.addEventListener("abort",()=>{l(am(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new ap();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=o??`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(av(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,z.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function av(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ad(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a3[e];// eslint-disable-next-line no-param-reassign
|
||||
*/const am=e=>void 0===globalThis.DOMException?new ah(e):new DOMException(e),ag=e=>{let t=void 0===e.reason?am("This operation was aborted."):e.reason;return t instanceof Error?t:am(t);};async function av(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(ag(e)),e.addEventListener("abort",()=>{l(ag(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new af();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=o??`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(ay(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,z.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function ay(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ap(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a6[e];// eslint-disable-next-line no-param-reassign
|
||||
i=["llvm","clangformat","clangtidy"].includes(e);// the tool installation directory (for the functions that ue it)
|
||||
let l=(0,iP.join)(o,i?"llvm":e);// eslint-disable-next-line no-await-in-loop
|
||||
a=await s(su(e,t,r),l,n);}return(// preparing a report string
|
||||
s.push(a8(e,a)),i);}const{readFile:ay,writeFile:aw,chmod:ax}=m.promises;async function aE(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await ab("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await ax("/tmp/llvm-setup-cpp.sh","755"),await t5("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nq(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function ab(e,t){var r,n;let i=await ay(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await aS(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await aw(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function aS(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,M.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=V("ldLP8"),z=V("7Lz0k"),iP=V("eq4yW");const a$=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aO=new Set(["10.0.1","15.0.5","15.0.6"]),a_=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
s.push(a7(e,a)),i);}const{readFile:aw,writeFile:ax,chmod:aE}=m.promises;async function ab(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await aS("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await aE("/tmp/llvm-setup-cpp.sh","755"),await t5("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nq(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function aS(e,t){var r,n;let i=await aw(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await a$(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await ax(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function a$(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,M.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=V("ldLP8"),z=V("7Lz0k"),iP=V("eq4yW");const aO=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),a_=new Set(["10.0.1","15.0.5","15.0.6"]),aC=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
// TODO add arm64 support
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aC=new Map(),aI={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aT="16.0.4";//================================================
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aI=new Map(),aT={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aR="16.0.4";//================================================
|
||||
// URL
|
||||
//================================================
|
||||
/** Gets a LLVM download URL for GitHub. */function aR(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aP(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aA(e){let t;if(aO.has(e))return null;let r="LLVM-",n=/*@__PURE__*/G(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/G(o$)(e,"9.0.1"),o=!1;return i&&(t=aP(e,r,n),(await oK(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aR(e,r,n)),t;}function aN(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(a_.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/G(o$)(e,"9.0.1")?aP(e,r,n):aR(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aC.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!a$.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oJ(a$,e)[0];}else""!==n&&n in aI?t=aI[n]:(// default to the maximum version
|
||||
t=aI[aT],(0,z.warning)(`Falling back to LLVM version ${aT} ${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`,/*@__PURE__*/G(o$)(n,"9.0.1"))?aP(n,o,r):aR(n,o,r);}(t);case"win32":return aA(t);default:return null;}}async function aL(e,t,r){let[n,i]=await oQ(a$,t,e,aN);return(0,z.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iP.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var ak=h.resolve(__dirname,"../../src/llvm");async function aD(e,t,r){let n=await aj(e,t,r);return await aV(n.installDir??t),n;}async function aU(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aF(e,t,r),aq(r),aW()]);return n;}const aj=oV(aU,{isPromise:!0});function aM(e,t,r){return aF(e,t,r);}async function aF(e,t,r){let n=function(e){if(null===/*@__PURE__*/G(oX)(e))try{// find the semver version of an integer
|
||||
/** Gets a LLVM download URL for GitHub. */function aP(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aA(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aN(e){let t;if(a_.has(e))return null;let r="LLVM-",n=/*@__PURE__*/G(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/G(o$)(e,"9.0.1"),o=!1;return i&&(t=aA(e,r,n),(await oK(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aP(e,r,n)),t;}function aL(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(aC.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/G(o$)(e,"9.0.1")?aA(e,r,n):aP(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aI.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!aO.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oJ(aO,e)[0];}else""!==n&&n in aT?t=aT[n]:(// default to the maximum version
|
||||
t=aT[aR],(0,z.warning)(`Falling back to LLVM version ${aR} ${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`,/*@__PURE__*/G(o$)(n,"9.0.1"))?aA(n,o,r):aP(n,o,r);}(t);case"win32":return aN(t);default:return null;}}async function ak(e,t,r){let[n,i]=await oQ(aO,t,e,aL);return(0,z.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iP.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var aD=h.resolve(__dirname,"../../src/llvm");async function aU(e,t,r){let n=await aM(e,t,r);return await aW(n.installDir??t),n;}async function aj(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aG(e,t,r),aV(r),az()]);return n;}const aM=oV(aj,{isPromise:!0});function aF(e,t,r){return aG(e,t,r);}async function aG(e,t,r){let n=function(e){if(null===/*@__PURE__*/G(oX)(e))try{// find the semver version of an integer
|
||||
let t=/*@__PURE__*/G(oO)(e);if(null!==t)return(0,z.info)(`Coerced version '${e}' to '${t}'`),t.version;}catch(e){// handled below
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iq())return await aE(i);}catch(e){(0,z.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,aL,t,r);return await aB(i),o;}async function aG(e){iq()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aB=oV(aG,{isPromise:!0});async function aH(e){"linux"===process.platform&&(await sD(su("gcc",void 0,await sm()),"",e));}const aq=oV(aH,{isPromise:!0});async function aV(e){let t=process.env.LD_LIBRARY_PATH??"",r=process.env.DYLD_LIBRARY_PATH??"",n=[nB("LLVM_PATH",e),nB("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${t}`),nB("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${r}`),nB("LDFLAGS",`-L"${e}/lib"`),nB("CPPFLAGS",`-I"${e}/include"`),nB("CC",(0,iP.addExeExt)(`${e}/bin/clang`)),nB("CXX",(0,iP.addExeExt)(`${e}/bin/clang++`)),nB("LIBRARY_PATH",`${e}/lib`),sA()];iq()&&n.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(n);}async function aW(){if(W.GITHUB_ACTIONS){let e=(0,iP.join)(ak,"llvm_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}}async function az(e,t,r){switch(process.platform){case"win32":return iM("make",e);case"darwin":return await iD("make",e),await nq("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iF())return iK("make",e);if(iG())return iB([{name:"make",version:e}]);if(iq())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var W=V("2W4C2"),iP=V("eq4yW"),z=V("7Lz0k"),nF=V("bOuKS"),aK=h.resolve(__dirname,"../../src/msvc");async function aY(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=al(e);// check if the given version is already installed
|
||||
(0,z.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=au(l);c=!0,(0,z.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iq())return await ab(i);}catch(e){(0,z.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,ak,t,r);return await aH(i),o;}async function aB(e){iq()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aH=oV(aB,{isPromise:!0});async function aq(e){"linux"===process.platform&&(await sU(su("gcc",void 0,await sm()),"",e));}const aV=oV(aq,{isPromise:!0});async function aW(e){let t=process.env.LD_LIBRARY_PATH??"",r=process.env.DYLD_LIBRARY_PATH??"",n=[nB("LLVM_PATH",e),nB("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${t}`),nB("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${r}`),nB("LDFLAGS",`-L"${e}/lib"`),nB("CPPFLAGS",`-I"${e}/include"`),nB("CC",(0,iP.addExeExt)(`${e}/bin/clang`)),nB("CXX",(0,iP.addExeExt)(`${e}/bin/clang++`)),nB("LIBRARY_PATH",`${e}/lib`),sN()];iq()&&n.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(n);}async function az(){if(W.GITHUB_ACTIONS){let e=(0,iP.join)(aD,"llvm_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}}async function aK(e,t,r){switch(process.platform){case"win32":return iM("make",e);case"darwin":return await iD("make",e),await nq("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iF())return iK("make",e);if(iG())return iB([{name:"make",version:e}]);if(iq())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var W=V("2W4C2"),iP=V("eq4yW"),z=V("7Lz0k"),nF=V("bOuKS"),aY=h.resolve(__dirname,"../../src/msvc");async function aX(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=ac(e);// check if the given version is already installed
|
||||
(0,z.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=ad(l);c=!0,(0,z.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}// https://github.com/aminya/setup-cpp/issues/1
|
||||
if(!c)try{"14.0"===l?(s="14.0",await iM("visualcpp-build-tools","14.0.25420.1",["--ignore-dependencies"]),a="C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"):"15.0"===l?(s="14.16",await iM("visualstudio2017buildtools","15.9.41.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16"// TODO verify path
|
||||
):"16.0"===l?(s="14.29",await iM("visualstudio2019buildtools","16.11.7.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"):"17.0"===l?(s=void 0,await iM("visualstudio2022buildtools","117.0.5.0",[]),a=void 0):(0,z.error)(`The given MSVC versions ${e} is not supported yet.`);}catch(e){(0,z.error)(e);}// run vcvarsall.bat environment variables
|
||||
await ad(l,a,r,s,n,i,o),W.GITHUB_ACTIONS&&(await aX());}async function aX(){let e=(0,iP.join)(aK,"msvc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}async function aJ(e,t,r){if(!iq())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/G(nQ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iP.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
await ap(l,a,r,s,n,i,o),W.GITHUB_ACTIONS&&(await aJ());}async function aJ(){let e=(0,iP.join)(aY,"msvc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,z.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,z.info)(`::add-matcher::${e}`);}async function aQ(e,t,r){if(!iq())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/G(nQ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iP.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian/scar.key");t6("/bin/bash",["-c",`echo "deb [signed-by=${o}] http://deb.volian.org/volian/ scar main" | tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list`]);try{"legacy"!==e?await ix([{name:"nala"}],!0):await ix([{name:"nala-legacy"}],!0);}catch(e){await ix([{name:"nala-legacy"}],!0);}return{binDir:i="/usr/bin"// eslint-disable-line require-atomic-updates
|
||||
};}async function aQ(e,t,r){if("win32"!==process.platform)return;await iM("opencppcoverage",e);let n=await aZ();return{binDir:n};}async function aZ(){let e="C:/Program Files/OpenCppCoverage";return await nq(e),e;}async function a0(e,t,r){switch(process.platform){case"win32":{await iM("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nq(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iF())return iK("powershell-bin",e,"yay");if(iG())return iB([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iB([{name:"powershell",version:e}]);if(iq()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
};}async function aZ(e,t,r){if("win32"!==process.platform)return;await iM("opencppcoverage",e);let n=await a0();return{binDir:n};}async function a0(){let e="C:/Program Files/OpenCppCoverage";return await nq(e),e;}async function a1(e,t,r){switch(process.platform){case"win32":{await iM("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nq(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iF())return iK("powershell-bin",e,"yay");if(iG())return iB([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iB([{name:"powershell",version:e}]);if(iq()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
// const keyFileName = await addAptKeyViaDownload(
|
||||
// "microsoft.asc",
|
||||
// "https://packages.microsoft.com/keys/microsoft.asc"
|
||||
|
@ -1442,15 +1442,15 @@ let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian
|
|||
// "-c",
|
||||
// `echo "deb [arch=amd64 signed-by=${keyFileName}] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list`,
|
||||
// ])
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iP=(V("eq4yW"),V("eq4yW"));/** Get the platform data for task */function a1(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var z=V("7Lz0k"),nF=V("bOuKS"),iP=V("eq4yW");let a2=!1;async function a4(e,t,r){return a2&&null!==/*@__PURE__*/G(nQ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iP.dirname)(/*@__PURE__*/G(nQ).sync("vcpkg"))}:("linux"===process.platform&&(iF()?await Promise.all([iK("curl"),iK("zip"),iK("unzip"),iK("tar"),iK("git"),iK("pkg-config")]):iG()?await iB([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iq()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nF.pathExists)((0,iP.join)(t,(0,iP.addShExt)("bootstrap-vcpkg",".bat"))))?(0,z.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iP.dirname)(t),stdio:"inherit"}),nT((0,iP.addShExt)((0,iP.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nq(t),// eslint-disable-next-line require-atomic-updates
|
||||
a2=!0,{binDir:t});}const a3={nala:aJ,cmake:oj,ninja:sB,python:o5,vcpkg:a4,bazel:iV,conan:function(e,t,r){return sv("conan",e);},meson:function(e,t,r){return sv("meson",e);},gcovr:function(e,t,r){return sv("gcovr",e);},opencppcoverage:aQ,llvm:aD,gcc:sD,choco:iU,brew:iN,powershell:a0,ccache:function(e,t,r){switch(process.platform){case"win32":return iM("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iF())return iK("ccache",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iM("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sT,graphviz:s_,cppcheck:s$,clangtidy:aM,clangformat:aM,msvc:aY,vcvarsall:ad,kcov:sK,make:az,task:function(e,t,r){return oR("task",e,a1,t,r);},sevenzip:oP},a6=Object.keys(a3),a5=["compiler","architecture","timeout",...a6];function a8(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iP=(V("eq4yW"),V("eq4yW"));/** Get the platform data for task */function a2(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var z=V("7Lz0k"),nF=V("bOuKS"),iP=V("eq4yW");let a4=!1;async function a3(e,t,r){return a4&&null!==/*@__PURE__*/G(nQ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iP.dirname)(/*@__PURE__*/G(nQ).sync("vcpkg"))}:("linux"===process.platform&&(iF()?await Promise.all([iK("curl"),iK("zip"),iK("unzip"),iK("tar"),iK("git"),iK("pkg-config")]):iG()?await iB([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iq()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nF.pathExists)((0,iP.join)(t,(0,iP.addShExt)("bootstrap-vcpkg",".bat"))))?(0,z.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iP.dirname)(t),stdio:"inherit"}),nT((0,iP.addShExt)((0,iP.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nq(t),// eslint-disable-next-line require-atomic-updates
|
||||
a4=!0,{binDir:t});}const a6={nala:aQ,cmake:oj,ninja:sH,python:o5,vcpkg:a3,bazel:iV,conan:function(e,t,r){return sv("conan",e);},meson:function(e,t,r){return sv("meson",e);},gcovr:function(e,t,r){return sv("gcovr",e);},opencppcoverage:aZ,llvm:aU,gcc:sU,choco:iU,brew:iN,powershell:a1,ccache:function(e,t,r){switch(process.platform){case"win32":return iM("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iF())return iK("ccache",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iM("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sR,graphviz:sC,cppcheck:sO,clangtidy:aF,clangformat:aF,msvc:aX,vcvarsall:ap,kcov:sY,make:aK,task:function(e,t,r){return oR("task",e,a2,t,r);},sevenzip:oP},a5=Object.keys(a6),a8=["compiler","architecture","timeout",...a5];function a7(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
- The installation directory is ${t.installDir}`),""!==t.binDir&&(r+=`
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=V("i5trn"),z=V("7Lz0k"),oX=V("bJWbp");async function a7(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/G(oX)(e)||(0,z.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${l??""}`),a){case"llvm":case"clang":case"clang++":{let e=await aD(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nB("GCOV","llvm-cov gcov"),i.push(a8("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sU(e,(0,h.join)(r,"gcc"),n):await sD(e,(0,h.join)(r,"gcc"),n);o&&(await nB("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/G(oX)(e),r=null!==t?/*@__PURE__*/G(sP)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nB("GCOV",n);}(e),i.push(a8("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aY(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nB("CPPFLAGS","")),i.push(a8("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nB("CC","clang"),nB("CXX","clang++")]),i.push(a8("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,z.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=V("i5trn"),z=V("7Lz0k"),oX=V("bJWbp");async function a9(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/G(oX)(e)||(0,z.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${l??""}`),a){case"llvm":case"clang":case"clang++":{let e=await aU(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nB("GCOV","llvm-cov gcov"),i.push(a7("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sj(e,(0,h.join)(r,"gcc"),n):await sU(e,(0,h.join)(r,"gcc"),n);o&&(await nB("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/G(oX)(e),r=null!==t?/*@__PURE__*/G(sA)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nB("GCOV",n);}(e),i.push(a7("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aX(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nB("CPPFLAGS","")),i.push(a7("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nB("CC","clang"),nB("CXX","clang++")]),i.push(a7("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,z.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
/** The main entry function */(async function(e){let t,r,n=Promise.resolve();W.GITHUB_ACTIONS||(n=rv(),process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS="true");// parse options using mri or github actions
|
||||
let i=function(e,t){t=t||{};var r,n,i,o,s,a={_:[]},l=0,c=0,u=0,d=(e=e||[]).length;let p=void 0!==t.alias,f=void 0!==t.unknown,h=void 0!==t.default;if(t.alias=t.alias||{},t.string=rw(t.string),t.boolean=rw(t.boolean),p)for(r in t.alias)for(l=0,n=t.alias[r]=rw(t.alias[r]);l<n.length;l++)(t.alias[n[l]]=n.concat(r)).splice(l,1);for(l=t.boolean.length;l-->0;)for(c=(n=t.alias[t.boolean[l]]||[]).length;c-->0;)t.boolean.push(n[c]);for(l=t.string.length;l-->0;)for(c=(n=t.alias[t.string[l]]||[]).length;c-->0;)t.string.push(n[c]);if(h){for(r in t.default)if(o=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],void 0!==t[o])for(t[o].push(r),l=0;l<n.length;l++)t[o].push(n[l]);}let m=f?Object.keys(t.alias):[];for(l=0;l<d;l++){if("--"===(i=e[l])){a._=a._.concat(e.slice(++l));break;}for(c=0;c<i.length&&45===i.charCodeAt(c)// "-"
|
||||
;c++);if(0===c)a._.push(i);else if("no-"===i.substring(c,c+3)){if(o=i.substring(c+3),f&&!~m.indexOf(o))return t.unknown(i);a[o]=!1;}else{for(u=c+1;u<i.length&&61!==i.charCodeAt(u)// "="
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a5,"timeout"],default:Object.fromEntries(a5.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});i.help&&((0,z.info)(`
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a8,"timeout"],default:Object.fromEntries(a8.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});i.help&&((0,z.info)(`
|
||||
setup-cpp [options]
|
||||
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||
|
||||
|
@ -1466,12 +1466,12 @@ 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:"--cppcache, --sccache"},documentation:{tools:"--doxygen, --graphviz"},coverage:{tools:"--gcovr, --opencppcoverage, --kcov"},other:{tools:"--python, --powershell, --sevenzip"}},["tools"]));// cpu architecture
|
||||
let o=i.architecture??process.arch,s=process.env.SETUP_CPP_DIR??t8(""),a=[],l=[],c=X.create({autoloadLocales:!0});X.addLocale(/*@__PURE__*/G(J)),K.addLocale(/*@__PURE__*/G(Y));// installing the specified tools
|
||||
let u=await sm();// sync the version for the llvm tools
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(i,["llvm","clangtidy","clangformat"]))return(0,z.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iF()&&"string"==typeof i.cppcheck&&"string"==typeof i.gcovr&&((0,z.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iK("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let d=!1,p=!1;for(let e of a6){// fail fast inside CI when any tool fails
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(i,["llvm","clangtidy","clangformat"]))return(0,z.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iF()&&"string"==typeof i.cppcheck&&"string"==typeof i.gcovr&&((0,z.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iK("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let d=!1,p=!1;for(let e of a5){// fail fast inside CI when any tool fails
|
||||
if(W.isCI&&0!==l.length){p=!0;break;}// get the version or "true" or undefined for this tool from the options
|
||||
let n=i[e];void 0!==n&&(// running the setup function for this tool
|
||||
t=Date.now(),// eslint-disable-next-line no-await-in-loop
|
||||
d=await ag(e,n,u,o,s,a,l,6e4*parseFloat(i.timeout??"20")),r=Date.now(),(0,z.info)(`took ${c.format(t,r)||"0 seconds"}`));}if(!p){// installing the specified compiler
|
||||
let e=i.compiler;if(void 0!==e){let t=Date.now();await a7(e,u,s,o,a,d,l);let r=Date.now();(0,z.info)(`took ${c.format(t,r)||"0 seconds"}`);}}if(await nX(),0===a.length&&0===l.length)return(0,z.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
d=await av(e,n,u,o,s,a,l,6e4*parseFloat(i.timeout??"20")),r=Date.now(),(0,z.info)(`took ${c.format(t,r)||"0 seconds"}`));}if(!p){// installing the specified compiler
|
||||
let e=i.compiler;if(void 0!==e){let t=Date.now();await a9(e,u,s,o,a,d,l);let r=Date.now();(0,z.info)(`took ${c.format(t,r)||"0 seconds"}`);}}if(await nX(),0===a.length&&0===l.length)return(0,z.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
a.forEach(e=>(0,z.success)(e)),l.forEach(e=>(0,z.error)(e)),(0,z.info)("setup-cpp finished"),!W.GITHUB_ACTIONS)switch(process.platform){case"win32":(0,z.warning)("Run `RefreshEnv.cmd` or restart your shell to update the environment.");break;case"linux":case"darwin":(0,z.warning)("Run `source ~/.cpprc` or restart your shell to update the environment.");}return await n,0===l.length?0:1;// exit with non-zero if any error message
|
||||
})(process.argv).then(e=>{process.exitCode=e;}).catch(e=>{(0,z.error)("main() panicked!"),(0,z.error)(e),process.exitCode=1;});
|
||||
//# sourceMappingURL=setup-cpp.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1221,7 +1221,7 @@ let e=await n(t,o);if(null!==e){// eslint-disable-next-line no-await-in-loop
|
|||
if(await oX(e))return[o,e];i.push(e);}}throw Error(`Unsupported target! (platform='${t}', version='${r}'). Try one of the following: ${JSON.stringify(e)}`);}const oZ=/v?(\d\S*)/;async function o0(e,t=oZ){try{var r,n;let i=await(0,oo.getExecOutput)(e,["--version"]),o=i.stdout||i.stderr||"",s=null===(r=o.trim().match(t))||void 0===r?void 0:r[1];return null!==(n=/*@__PURE__*/G(oO)(s))&&void 0!==n?n:void 0;}catch(e){console.error(e);return;}}async function o1(e,t,r=oZ){let n=await o0(e,r);return void 0!==n&&""!==t&&-1!==/*@__PURE__*/G(oK)(n,t);}// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
|
||||
// the directly downloaded tools require a given version ("" doesn't work).
|
||||
function o2(){switch(process.platform){case"win32":default:return"16.0.6";case"linux":// used for non-ubuntu (Fedora, Arch)
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iM()?"1.9.8-1":"1.9.8",gcc:iM()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nM=V("3WkGD");async function o8(e,t,r){let n=await o9(e,t,r);G(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o5(i),await o7(i),n;}async function o5(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"});}catch(e){(0,W.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,W.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iA.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iM()?"1.9.8-1":"1.9.8",gcc:iM()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nM=V("3WkGD");async function o8(e,t,r){let n=await o9(e,t,r);G(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o5(i),await o7(i),n;}async function o5(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"}),await sy(e,"venv",void 0,{upgrade:!1,usePipx:!1});}catch(e){(0,W.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,W.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iA.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
if(z.GITHUB_ACTIONS)try{(0,W.info)("Installing python in GitHub Actions");let{setupActionsPython:o}=await V("dDAlR");await o(e,t,r),i=await st(t);let s=(0,iA.dirname)(i);n={bin:i,installDir:s,binDir:s};}catch(e){(0,W.warning)(e.toString());}void 0===n&&(n=await se(t,e));}return(void 0===i||void 0===n.bin)&&(i=await st(t),n.bin=i),n;}async function se(e,t){let r;switch(process.platform){case"win32":{e?await iF("python3",t,[`--params=/InstallDir:${e}`]):await iF("python3",t);// Adding the bin dir to the path
|
||||
let n=await st(e),i=(0,iA.dirname)(n);/** The directory which the tool is installed to */await nq(i),r={installDir:i,binDir:i,bin:n};break;}case"darwin":{r=await iD("python3",t);// add the python and pip binaries to the path
|
||||
let e=await nI("brew",["--prefix","python"],{stdio:"pipe"}),n=(0,iA.join)(e.stdout,"libexec","bin");await nq(n);break;}case"linux":if(iM())r=await iX("python",t);else if(iG())r=await iB([{name:"python3",version:t}]);else if(iq())r=await ix([{name:"python3",version:t},{name:"python-is-python3"}]);else throw Error("Unsupported linux distributions");break;default:throw Error("Unsupported platform");}return r;}async function st(e){for(let t of["python3","python"]){// eslint-disable-next-line no-await-in-loop
|
||||
|
@ -1233,7 +1233,7 @@ if(await o1(e,o3.python))return e;}catch{// fall through
|
|||
let t=await so(e);if(void 0!==t)return t;}}async function so(e){try{var t;let r=null!==(t=await/*@__PURE__*/G(nJ)(e,{nothrow:!0,all:!0}))&&void 0!==t?t:[];for(let e of r)// eslint-disable-next-line no-await-in-loop
|
||||
if(null!==e&&(await o1(e,o3.pip)))return e;}catch{// fall through
|
||||
}}async function ss(e){let t=await sa(e);t||(// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||
await sS("pip"),// upgrade pip
|
||||
await s$("pip"),// upgrade pip
|
||||
await sa(e));}async function sa(e){try{return await nI(e,["-m","ensurepip","-U","--upgrade"],{stdio:"inherit"}),!0;}catch(n){var t,r;(0,W.info)(null==n?void 0:null===(t=n.toString)||void 0===t?void 0:t.call(n));try{return(// ensure pip is disabled on Ubuntu
|
||||
await nI(e,["-m","pip","install","--upgrade","pip"],{stdio:"inherit"}),!0);}catch(e){(0,W.info)(null==e?void 0:null===(r=e.toString)||void 0===r?void 0:r.call(e));// pip module not found
|
||||
}}// all methods failed
|
||||
|
@ -1244,12 +1244,12 @@ t.push((0,iA.join)(r,"Scripts"),(0,iA.join)(r,"Scripts","bin"),(0,iA.join)(r,"bi
|
|||
function(e,t){let r=e[0],n=Object.keys(t).map(e=>parseInt(e,10)).sort((e,t)=>t-e)// sort in descending order
|
||||
.find(e=>r>=e);return void 0===n?"":t[n];}(r,o6[e]):sd(t)&&e in o4?o4[e]:"true"===t?"":null!=t?t:"";}function sd(e){return"true"===e||void 0===e;}var W=V("hHq4F"),sp={};async function sf(){var e,t;if("linux"!==process.platform)return[];let r=await(e="lsb_release",t=["-a"],new Promise((r,n)=>{$.execFile(e,t,{encoding:"utf8",shell:!1},(i,o,s)=>{if(i){if("errno"in i&&"ENOENT"===i.code){r(null);// When lsb_release is not found
|
||||
return;}n(Error(`Could not execute \`${e} ${t.join(" ")}\`: ${i} (stderr=${s})`));return;}r(o);});}));if(null===r)return[];let n=/^Distributor ID:\s*(.+)$/,i=/^Description:\s*Ubuntu\s+(\d+)\.(\d+)(?:\.(\d+))?/,o=/^Release:\s*(\d+)\.(\d+)(?:\.(\d+))?$/,s=null,a=null,l=!1;for(let e of r.split("\n")){let t=e.match(n);if(null!==t){let e=t[1];if("Ubuntu"!==e)return[];l=!0;}let r=e.match(i);r&&(s=r);let c=e.match(o);if(c&&(a=c),l&&s&&a)break;}if(!l)return[];for(let e of[s,a])if(e){let t=[e[1],e[2]];return e[3]&&t.push(e[3]),t.map(e=>parseInt(e,10));}return[];}async function sh(){try{if(!iq())return null;{try{null===/*@__PURE__*/G(nJ).sync("lsb_release",{nothrow:!0})&&(await ix([{name:"lsb-release"}]));}catch{return sv();}let e=await(0,sp.getUbuntuVersion)();if(0===e.length)return sv();return e;}}catch(e){return(0,W.warning)(e.toString()),null;}}Object.defineProperty(sp,"__esModule",{value:!0}),sp.getUbuntuVersion=void 0,sp.getUbuntuVersion=sf;const sm=oV(sh);/** Detect Ubuntu version using os.version() for Ubuntu based distros */function sv(){// #46~22.04.1-Ubuntu SMP ...
|
||||
let e=G(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sg(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${null!=r?r:""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[];nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await sS(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sb(u,t);return await nq(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o8(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oV(sx);async function sb(e,t){let r=await Promise.all(e.map(e=>(0,nM.pathExists)((0,iA.join)(e,(0,iA.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/G(nJ).sync((0,iA.addExeExt)(t),{nothrow:!0});return null!==i?(0,iA.dirname)(i):e[e.length-1];}function sS(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iM())return iX(`python-${e}`);if(iG())return iB([{name:`python3-${e}`}]);if(iq())return ix([{name:`python3-${e}`}]);}return null;}async function s$(e,t,r){switch(process.platform){case"win32":{await iF("cppcheck",e);let t=await sO();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iM())return iX("cppcheck",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sO(){let e="C:/Program Files/Cppcheck";return await nq(e),e;}var iA=V("A8hFE"),W=V("hHq4F");async function s_(e,t,r){switch(process.platform){case"win32":return await iF("graphviz",e),sC();case"darwin":return iD("graphviz",e);case"linux":if(iM())return iX("graphviz",e);if(iG())return iB([{name:"graphviz",version:e}]);if(iq())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sC(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nq(e),{binDir:e};}throw Error("Unsupported platform");}var nM=V("3WkGD");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sI(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iA.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iQ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sT(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/G(o_)(()=>iF("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,W.info)(e)});let t=await sR();return await s_(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await s_(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iM()||iG()){if(iM())n=await iX("doxygen",e);else if(iG())return iB([{name:"doxygen",version:e}]);else if(iq())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iq())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sI,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,W.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await s_(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sR(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nM.pathExists)((0,iA.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nq(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sA=V("7GceF"),oO=V("255mi"),oo=V("2mVwa"),W=V("hHq4F");async function sP(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nB("SDKROOT",t.trim()):(0,W.error)("SDKROOT not set");}catch(e){(0,W.error)(e);}}var iA=V("A8hFE"),W=V("hHq4F"),z=V("cLprm"),nM=V("3WkGD"),sN=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sk(e,t,r){if("win32"===t){let t=sL[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iA.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oP,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sD(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iF("gcc-arm-embedded",e));try{n=await oR("g++",e,sk,t,r);}catch(t){(0,W.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sj(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iM()?n=await iX("gcc",e):iG()?n=await iB([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iq()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,W.info)(`Install g++-multilib because gcc for ${r} was requested`),iM()?await iX("gcc-multilib",e):iq()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
let e=G(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sg(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${null!=r?r:""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[],a=await sb(e,t);if(a)nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});else if((await s$(t))===null)throw Error(`Failed to install ${t}.`);}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await s$(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sS(u,t);return await nq(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o8(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oV(sx);async function sb(e,t){let r=await nI(e,["-m","pip","show",t],{stdio:"ignore",reject:!1});return 0===r.exitCode;}async function sS(e,t){let r=await Promise.all(e.map(e=>(0,nM.pathExists)((0,iA.join)(e,(0,iA.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/G(nJ).sync((0,iA.addExeExt)(t),{nothrow:!0});return null!==i?(0,iA.dirname)(i):e[e.length-1];}function s$(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iM())return iX(`python-${e}`);if(iG())return iB([{name:`python3-${e}`}]);if(iq())return ix([{name:`python3-${e}`}]);}return null;}async function sO(e,t,r){switch(process.platform){case"win32":{await iF("cppcheck",e);let t=await s_();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iM())return iX("cppcheck",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function s_(){let e="C:/Program Files/Cppcheck";return await nq(e),e;}var iA=V("A8hFE"),W=V("hHq4F");async function sC(e,t,r){switch(process.platform){case"win32":return await iF("graphviz",e),sI();case"darwin":return iD("graphviz",e);case"linux":if(iM())return iX("graphviz",e);if(iG())return iB([{name:"graphviz",version:e}]);if(iq())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sI(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nq(e),{binDir:e};}throw Error("Unsupported platform");}var nM=V("3WkGD");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sT(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iA.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iQ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sR(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/G(o_)(()=>iF("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,W.info)(e)});let t=await sA();return await sC(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await sC(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iM()||iG()){if(iM())n=await iX("doxygen",e);else if(iG())return iB([{name:"doxygen",version:e}]);else if(iq())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iq())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sT,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,W.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await sC(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sA(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nM.pathExists)((0,iA.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nq(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sP=V("7GceF"),oO=V("255mi"),oo=V("2mVwa"),W=V("hHq4F");async function sN(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nB("SDKROOT",t.trim()):(0,W.error)("SDKROOT not set");}catch(e){(0,W.error)(e);}}var iA=V("A8hFE"),W=V("hHq4F"),z=V("cLprm"),nM=V("3WkGD"),sL=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sk={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sD(e,t,r){if("win32"===t){let t=sk[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iA.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oP,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sU(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iF("gcc-arm-embedded",e));try{n=await oR("g++",e,sD,t,r);}catch(t){(0,W.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sF(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iM()?n=await iX("gcc",e):iG()?n=await iB([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iq()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,W.info)(`Install g++-multilib because gcc for ${r} was requested`),iM()?await iX("gcc-multilib",e):iq()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
// TODO support abi
|
||||
// case "none": {
|
||||
// if (arch === "arm" || arch === "arm64") {
|
||||
|
@ -1260,12 +1260,12 @@ const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-ming
|
|||
// throw new Error(`Unsupported platform for ${arch}`)
|
||||
// }
|
||||
// }
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sF(e,n.binDir),n;}async function sU(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sD(e,t,r);case"linux":iM()?n=await iX("mingw-w64-gcc",e):iG()?n=await iB([{name:"mingw64-gcc",version:e}]):iq()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sM(e,n.binDir),n;}async function sj(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sU(e,t,r);case"linux":iM()?n=await iX("mingw-w64-gcc",e):iG()?n=await iB([{name:"mingw64-gcc",version:e}]):iq()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/i686-w64-mingw32-g++-win32 to provide /usr/bin/i686-w64-mingw32-g++ (i686-w64-mingw32-g++) in auto mode
|
||||
//Setting up g++-mingw-w64-x86-64-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/x86_64-w64-mingw32-g++-win32 to provide /usr/bin/x86_64-w64-mingw32-g++ (x86_64-w64-mingw32-g++) in auto mode
|
||||
//await activateGcc(version, installationInfo.binDir)
|
||||
return n;}async function sj(e,t){var r,n;let i;if(await iF("mingw",e),"x64"===t&&(await(0,nM.pathExists)("C:/tools/mingw64/bin"))?(i="C:/tools/mingw64/bin",await nq(i)):"ia32"===t&&(await(0,nM.pathExists)("C:/tools/mingw32/bin"))?(i="C:/tools/mingw32/bin",await nq(i)):(await(0,nM.pathExists)(`${null!==(r=process.env.ChocolateyInstall)&&void 0!==r?r:"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(i=`${null!==(n=process.env.ChocolateyInstall)&&void 0!==n?n:"C:/ProgramData/chocolatey"}/bin`),void 0!==i)return{binDir:i};}async function sF(e,t){let r=[];// Setup gcc as the compiler
|
||||
return n;}async function sF(e,t){var r,n;let i;if(await iF("mingw",e),"x64"===t&&(await(0,nM.pathExists)("C:/tools/mingw64/bin"))?(i="C:/tools/mingw64/bin",await nq(i)):"ia32"===t&&(await(0,nM.pathExists)("C:/tools/mingw32/bin"))?(i="C:/tools/mingw32/bin",await nq(i)):(await(0,nM.pathExists)(`${null!==(r=process.env.ChocolateyInstall)&&void 0!==r?r:"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(i=`${null!==(n=process.env.ChocolateyInstall)&&void 0!==n?n:"C:/ProgramData/chocolatey"}/bin`),void 0!==i)return{binDir:i};}async function sM(e,t){let r=[];// Setup gcc as the compiler
|
||||
// TODO
|
||||
// const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||
// const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||
|
@ -1276,13 +1276,13 @@ return n;}async function sj(e,t){var r,n;let i;if(await iF("mingw",e),"x64"===t&
|
|||
// addEnv("LDFLAGS", `-L${installDir}/lib`),
|
||||
// addEnv("CPPFLAGS", `-I${installDir}/include`)
|
||||
// )
|
||||
if("win32"===process.platform)r.push(nB("CC",(0,iA.addExeExt)(`${t}/gcc`)),nB("CXX",(0,iA.addExeExt)(`${t}/g++`)));else{var n;let i=/*@__PURE__*/G(sA)(null!==(n=/*@__PURE__*/G(oO)(e))&&void 0!==n?n:e);i>=5?(r.push(nB("CC",`${t}/gcc-${i}`),nB("CXX",`${t}/g++-${i}`)),iq()&&r.push(iT("cc",`${t}/gcc-${i}`),iT("cxx",`${t}/g++-${i}`),iT("gcc",`${t}/gcc-${i}`),iT("g++",`${t}/g++-${i}`))):(r.push(nB("CC",`${t}/gcc-${e}`),nB("CXX",`${t}/g++-${e}`)),iq()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sP()),z.GITHUB_ACTIONS&&(await sM()),await Promise.all(r);}async function sM(){let e=(0,iA.join)(sN,"gcc_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}var oY=V("eO4vc"),sA=V("7GceF"),iA=V("A8hFE"),W=V("hHq4F"),iA=V("A8hFE");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sG(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sB(e,t,r){return oR("ninja",e,sG,t,r);}var sH=h.resolve(__dirname,"../../src/kcov");function sq(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iA.addExeExt)("kcov"),extractFunction:oD};}function sV(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iA.addExeExt)("kcov"),extractFunction:sz};}async function sz(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sW();"linux"===process.platform&&(iM()?await Promise.all([iX("libdwarf"),iX("libcurl-openssl")]):iG()?await iB([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iq()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/G(nJ).sync("patch",{nothrow:!0})){let e=(0,iA.join)(sH,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,W.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
if("win32"===process.platform)r.push(nB("CC",(0,iA.addExeExt)(`${t}/gcc`)),nB("CXX",(0,iA.addExeExt)(`${t}/g++`)));else{var n;let i=/*@__PURE__*/G(sP)(null!==(n=/*@__PURE__*/G(oO)(e))&&void 0!==n?n:e);i>=5?(r.push(nB("CC",`${t}/gcc-${i}`),nB("CXX",`${t}/g++-${i}`)),iq()&&r.push(iT("cc",`${t}/gcc-${i}`),iT("cxx",`${t}/g++-${i}`),iT("gcc",`${t}/gcc-${i}`),iT("g++",`${t}/g++-${i}`))):(r.push(nB("CC",`${t}/gcc-${e}`),nB("CXX",`${t}/g++-${e}`)),iq()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sN()),z.GITHUB_ACTIONS&&(await sG()),await Promise.all(r);}async function sG(){let e=(0,iA.join)(sL,"gcc_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}var oY=V("eO4vc"),sP=V("7GceF"),iA=V("A8hFE"),W=V("hHq4F"),iA=V("A8hFE");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sB(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sH(e,t,r){return oR("ninja",e,sB,t,r);}var sq=h.resolve(__dirname,"../../src/kcov");function sV(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iA.addExeExt)("kcov"),extractFunction:oD};}function sz(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iA.addExeExt)("kcov"),extractFunction:sW};}async function sW(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sX();"linux"===process.platform&&(iM()?await Promise.all([iX("libdwarf"),iX("libcurl-openssl")]):iG()?await iB([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iq()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/G(nJ).sync("patch",{nothrow:!0})){let e=(0,iA.join)(sq,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,W.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
}let i=(0,iA.join)(r,"build");// execRootSync(cmake, ["--install", buildDir], out)
|
||||
// return "user/local/bin" // the cmake install prefix
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sW(){let e=/*@__PURE__*/G(nJ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iA.join)(t5(""),"cmake"),"");e=(0,iA.join)(t,"cmake");}let t=/*@__PURE__*/G(nJ).sync("ninja",{nothrow:!0});return null===t&&(await sB(su("ninja",void 0,await sm()),(0,iA.join)(t5(""),"ninja"),"")),e;}async function sX(e,t,r){var n;let i;if("linux"!==process.platform){(0,W.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sq,t,r),iM()?await iX("binutils"):iG()?await iB([{name:"binutils"}]):iq()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sV,t,r),i;}var z=V("cLprm"),W=V("hHq4F"),nM=V("3WkGD"),iA=V("A8hFE"),ry=V("2heqc"),W=V("hHq4F"),iA=V("A8hFE"),sK={},sY=sK&&sK.__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());});},sQ=sK&&sK.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sK,"__esModule",{value:!0});var sJ={},sZ=sJ&&sJ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sJ,"__esModule",{value:!0});const s0=sZ(f);var s1={};/**
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sX(){let e=/*@__PURE__*/G(nJ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iA.join)(t5(""),"cmake"),"");e=(0,iA.join)(t,"cmake");}let t=/*@__PURE__*/G(nJ).sync("ninja",{nothrow:!0});return null===t&&(await sH(su("ninja",void 0,await sm()),(0,iA.join)(t5(""),"ninja"),"")),e;}async function sK(e,t,r){var n;let i;if("linux"!==process.platform){(0,W.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sV,t,r),iM()?await iX("binutils"):iG()?await iB([{name:"binutils"}]):iq()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sz,t,r),i;}var z=V("cLprm"),W=V("hHq4F"),nM=V("3WkGD"),iA=V("A8hFE"),ry=V("2heqc"),W=V("hHq4F"),iA=V("A8hFE"),sY={},sQ=sY&&sY.__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());});},sJ=sY&&sY.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sY,"__esModule",{value:!0});var sZ={},s0=sZ&&sZ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sZ,"__esModule",{value:!0});const s1=s0(f);var s2={};/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
|
@ -1291,27 +1291,27 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/function s2(e,t,r){let n=new s4(e,t,r);process.stdout.write(n.toString()+s0.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s1,"__esModule",{value:!0}),s1.toCommandValue=/**
|
||||
*/function s4(e,t,r){let n=new s3(e,t,r);process.stdout.write(n.toString()+s1.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s2,"__esModule",{value:!0}),s2.toCommandValue=/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sJ.issueCommand=s2,sJ.issue=function(e,t=""){s2(e,{},t);};class s4{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}=${s1.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s1.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s3={},s6=s3&&s3.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s3,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s8=s6(m),s5=s6(f);s3.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s8.existsSync(r))throw Error(`Missing file at path: ${r}`);s8.appendFileSync(r,`${s1.toCommandValue(t)}${s5.EOL}`,{encoding:"utf8"});};const s7=sQ(f),s9=sQ(h);/**
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sZ.issueCommand=s4,sZ.issue=function(e,t=""){s4(e,{},t);};class s3{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}=${s2.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s2.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s6={},s8=s6&&s6.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s6,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s5=s8(m),s7=s8(f);s6.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s5.existsSync(r))throw Error(`Missing file at path: ${r}`);s5.appendFileSync(r,`${s2.toCommandValue(t)}${s7.EOL}`,{encoding:"utf8"});};const s9=sJ(f),ae=sJ(h);/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/function ae(e){sJ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
*/function at(e){sZ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/function at(e){sJ.issue("group",e);}/**
|
||||
*/function ar(e){sZ.issue("group",e);}/**
|
||||
* End an output group.
|
||||
*/function ar(){sJ.issue("endgroup");}/**
|
||||
*/function an(){sZ.issue("endgroup");}/**
|
||||
* A code indicating that the action was successful
|
||||
*/(c=p=sK.ExitCode||(sK.ExitCode={}))[c.Success=0]="Success",/**
|
||||
*/(c=p=sY.ExitCode||(sY.ExitCode={}))[c.Success=0]="Success",/**
|
||||
* A code indicating that the action was a failure
|
||||
*/c[c.Failure=1]="Failure",sK.exportVariable=//-----------------------------------------------------------------------
|
||||
*/c[c.Failure=1]="Failure",sY.exportVariable=//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1319,57 +1319,57 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){let r=s1.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s7.EOL}${r}${s7.EOL}${t}`;s3.issueCommand("ENV",n);}else sJ.issueCommand("set-env",{name:e},r);},sK.setSecret=/**
|
||||
function(e,t){let r=s2.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s9.EOL}${r}${s9.EOL}${t}`;s6.issueCommand("ENV",n);}else sZ.issueCommand("set-env",{name:e},r);},sY.setSecret=/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/function(e){sJ.issueCommand("add-mask",{},e);},sK.addPath=/**
|
||||
*/function(e){sZ.issueCommand("add-mask",{},e);},sY.addPath=/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s3.issueCommand("PATH",e):sJ.issueCommand("add-path",{},e),process.env.PATH=`${e}${s9.delimiter}${process.env.PATH}`;},sK.getInput=/**
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s6.issueCommand("PATH",e):sZ.issueCommand("add-path",{},e),process.env.PATH=`${e}${ae.delimiter}${process.env.PATH}`;},sY.getInput=/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sK.setOutput=/**
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sY.setOutput=/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sJ.issueCommand("set-output",{name:e},t);},sK.setCommandEcho=/**
|
||||
function(e,t){sZ.issueCommand("set-output",{name:e},t);},sY.setCommandEcho=/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/function(e){sJ.issue("echo",e?"on":"off");},sK.setFailed=//-----------------------------------------------------------------------
|
||||
*/function(e){sZ.issue("echo",e?"on":"off");},sY.setFailed=//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/function(e){process.exitCode=p.Failure,ae(e);},sK.isDebug=//-----------------------------------------------------------------------
|
||||
*/function(e){process.exitCode=p.Failure,at(e);},sY.isDebug=//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sK.debug=/**
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sY.debug=/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/function(e){sJ.issueCommand("debug",{},e);},sK.error=ae,sK.warning=/**
|
||||
*/function(e){sZ.issueCommand("debug",{},e);},sY.error=at,sY.warning=/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/function(e){sJ.issue("warning",e instanceof Error?e.toString():e);},sK.info=/**
|
||||
*/function(e){sZ.issue("warning",e instanceof Error?e.toString():e);},sY.info=/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/function(e){process.stdout.write(e+s7.EOL);},sK.startGroup=at,sK.endGroup=ar,sK.group=/**
|
||||
*/function(e){process.stdout.write(e+s9.EOL);},sY.startGroup=ar,sY.endGroup=an,sY.group=/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/function(e,t){return sY(this,void 0,void 0,function*(){let r;at(e);try{r=yield t();}finally{ar();}return r;});},sK.saveState=//-----------------------------------------------------------------------
|
||||
*/function(e,t){return sQ(this,void 0,void 0,function*(){let r;ar(e);try{r=yield t();}finally{an();}return r;});},sY.saveState=//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1378,62 +1378,62 @@ function(e,t){sJ.issueCommand("set-output",{name:e},t);},sK.setCommandEcho=/**
|
|||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sJ.issueCommand("save-state",{name:e},t);},sK.getState=/**
|
||||
function(e,t){sZ.issueCommand("save-state",{name:e},t);},sY.getState=/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const an=T.env["ProgramFiles(x86)"],ai=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],ao=["Enterprise","Professional","Community"],as=["2022","2019","2017"],aa={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function al(e){if(Object.values(aa).includes(e));else if(e in aa)return aa[e];return e;}const ac=`${an}\\Microsoft Visual Studio\\Installer`;function au(e){let t;let r=al(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sK.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sK.info(`Found with vswhere: ${n}`),n;sK.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const ai=T.env["ProgramFiles(x86)"],ao=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],as=["Enterprise","Professional","Community"],aa=["2022","2019","2017"],al={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function ac(e){if(Object.values(al).includes(e));else if(e in al)return al[e];return e;}const au=`${ai}\\Microsoft Visual Studio\\Installer`;function ad(e){let t;let r=ac(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sY.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sY.info(`Found with vswhere: ${n}`),n;sY.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
// starting with the latest and moving to the oldest.
|
||||
let i=e?[function(e){if(Object.keys(aa).includes(e));else for(let[t,r]of Object.entries(aa))if(r===e)return t;return e;}(e)]:as;for(let e of ai)for(let t of i)for(let r of ao)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sK.info(`Trying standard location: ${n}`),m.existsSync(n))return sK.info(`Found standard location: ${n}`),n;if(sK.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${an}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sK.info(`Found VS 2015: ${n}`),n;throw sK.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sK.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+ac;// There are all sorts of way the architectures are called. In addition to
|
||||
let i=e?[function(e){if(Object.keys(al).includes(e));else for(let[t,r]of Object.entries(al))if(r===e)return t;return e;}(e)]:aa;for(let e of ao)for(let t of i)for(let r of as)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sY.info(`Trying standard location: ${n}`),m.existsSync(n))return sY.info(`Found standard location: ${n}`),n;if(sY.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${ai}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sY.info(`Found VS 2015: ${n}`),n;throw sY.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sY.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+au;// There are all sorts of way the architectures are called. In addition to
|
||||
// values supported by Microsoft Visual C++, recognize some common aliases.
|
||||
let s={win32:"x86",win64:"x64",x86_64:"x64","x86-64":"x64"};e.toLowerCase()in s&&(e=s[e.toLowerCase()]);// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
|
||||
// Call the configuration batch file and then output *all* the environment variables.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${au(o)}" ${a.join(" ")}`;sK.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${ad(o)}" ${a.join(" ")}`;sY.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
let v={};for(let e of d){let[t,r]=e.split("=");v[t]=r;}for(let e of(// Now look at the new environment and export everything that changed.
|
||||
// These are the variables set by vsvars.bat. Also export everything
|
||||
// that was not there during the first sweep: those are new variables.
|
||||
sK.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
sY.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
// Skip lines that don't look like environment variables.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==v[t]&&(sK.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==v[t]&&(sY.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
// This keeps path shadowing working as intended.
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sK.exportVariable(t,r));}sK.endGroup(),sK.info("Configured Developer Command Prompt");};var W=V("hHq4F"),nM=V("3WkGD");async function ad(e,t,r,n,i,o,s){void 0!==t&&(await(0,nM.pathExists)(t))&&((0,W.info)(`Adding ${t} to PATH`),await nB("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class ap extends Error{constructor(e){super(e),this.name="TimeoutError";}}class af extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sY.exportVariable(t,r));}sY.endGroup(),sY.info("Configured Developer Command Prompt");};var W=V("hHq4F"),nM=V("3WkGD");async function ap(e,t,r,n,i,o,s){void 0!==t&&(await(0,nM.pathExists)(t))&&((0,W.info)(`Adding ${t} to PATH`),await nB("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class af extends Error{constructor(e){super(e),this.name="TimeoutError";}}class ah extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
TODO: Remove AbortError and just throw DOMException when targeting Node 18.
|
||||
*/const ah=e=>void 0===globalThis.DOMException?new af(e):new DOMException(e),am=e=>{let t=void 0===e.reason?ah("This operation was aborted."):e.reason;return t instanceof Error?t:ah(t);};async function av(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(am(e)),e.addEventListener("abort",()=>{l(am(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new ap();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=null!=o?o:`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(ag(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,W.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function ag(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ad(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a3[e];// eslint-disable-next-line no-param-reassign
|
||||
*/const am=e=>void 0===globalThis.DOMException?new ah(e):new DOMException(e),av=e=>{let t=void 0===e.reason?am("This operation was aborted."):e.reason;return t instanceof Error?t:am(t);};async function ag(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(av(e)),e.addEventListener("abort",()=>{l(av(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new af();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=null!=o?o:`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(ay(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,W.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function ay(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ap(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a6[e];// eslint-disable-next-line no-param-reassign
|
||||
i=["llvm","clangformat","clangtidy"].includes(e);// the tool installation directory (for the functions that ue it)
|
||||
let l=(0,iA.join)(o,i?"llvm":e);// eslint-disable-next-line no-await-in-loop
|
||||
a=await s(su(e,t,r),l,n);}return(// preparing a report string
|
||||
s.push(a5(e,a)),i);}const{readFile:ay,writeFile:aw,chmod:ax}=m.promises;async function aE(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await ab("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await ax("/tmp/llvm-setup-cpp.sh","755"),await t8("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nq(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function ab(e,t){var r,n;let i=await ay(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await aS(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await aw(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function aS(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,F.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=V("fAXcL"),W=V("hHq4F"),iA=V("A8hFE");const a$=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aO=new Set(["10.0.1","15.0.5","15.0.6"]),a_=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
s.push(a7(e,a)),i);}const{readFile:aw,writeFile:ax,chmod:aE}=m.promises;async function ab(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await aS("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await aE("/tmp/llvm-setup-cpp.sh","755"),await t8("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nq(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function aS(e,t){var r,n;let i=await aw(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await a$(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await ax(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function a$(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,F.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=V("fAXcL"),W=V("hHq4F"),iA=V("A8hFE");const aO=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),a_=new Set(["10.0.1","15.0.5","15.0.6"]),aC=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
// TODO add arm64 support
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aC=new Map(),aI={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aT="16.0.4";//================================================
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aI=new Map(),aT={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aR="16.0.4";//================================================
|
||||
// URL
|
||||
//================================================
|
||||
/** Gets a LLVM download URL for GitHub. */function aR(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aA(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aP(e){let t;if(aO.has(e))return null;let r="LLVM-",n=/*@__PURE__*/G(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/G(o$)(e,"9.0.1"),o=!1;return i&&(t=aA(e,r,n),(await oX(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aR(e,r,n)),t;}function aN(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(a_.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/G(o$)(e,"9.0.1")?aA(e,r,n):aR(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aC.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!a$.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oQ(a$,e)[0];}else""!==n&&n in aI?t=aI[n]:(// default to the maximum version
|
||||
t=aI[aT],(0,W.warning)(`Falling back to LLVM version ${aT} ${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`,/*@__PURE__*/G(o$)(n,"9.0.1"))?aA(n,o,r):aR(n,o,r);}(t);case"win32":return aP(t);default:return null;}}async function aL(e,t,r){let[n,i]=await oJ(a$,t,e,aN);return(0,W.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iA.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var ak=h.resolve(__dirname,"../../src/llvm");async function aD(e,t,r){var n;let i=await aj(e,t,r);return await aV(null!==(n=i.installDir)&&void 0!==n?n:t),i;}async function aU(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aM(e,t,r),aq(r),az()]);return n;}const aj=oV(aU,{isPromise:!0});function aF(e,t,r){return aM(e,t,r);}async function aM(e,t,r){let n=function(e){if(null===/*@__PURE__*/G(oY)(e))try{// find the semver version of an integer
|
||||
/** Gets a LLVM download URL for GitHub. */function aA(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aP(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aN(e){let t;if(a_.has(e))return null;let r="LLVM-",n=/*@__PURE__*/G(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/G(o$)(e,"9.0.1"),o=!1;return i&&(t=aP(e,r,n),(await oX(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aA(e,r,n)),t;}function aL(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(aC.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/G(o$)(e,"9.0.1")?aP(e,r,n):aA(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aI.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!aO.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oQ(aO,e)[0];}else""!==n&&n in aT?t=aT[n]:(// default to the maximum version
|
||||
t=aT[aR],(0,W.warning)(`Falling back to LLVM version ${aR} ${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`,/*@__PURE__*/G(o$)(n,"9.0.1"))?aP(n,o,r):aA(n,o,r);}(t);case"win32":return aN(t);default:return null;}}async function ak(e,t,r){let[n,i]=await oJ(aO,t,e,aL);return(0,W.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iA.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var aD=h.resolve(__dirname,"../../src/llvm");async function aU(e,t,r){var n;let i=await aF(e,t,r);return await az(null!==(n=i.installDir)&&void 0!==n?n:t),i;}async function aj(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aG(e,t,r),aV(r),aW()]);return n;}const aF=oV(aj,{isPromise:!0});function aM(e,t,r){return aG(e,t,r);}async function aG(e,t,r){let n=function(e){if(null===/*@__PURE__*/G(oY)(e))try{// find the semver version of an integer
|
||||
let t=/*@__PURE__*/G(oO)(e);if(null!==t)return(0,W.info)(`Coerced version '${e}' to '${t}'`),t.version;}catch(e){// handled below
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iq())return await aE(i);}catch(e){(0,W.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,aL,t,r);return await aB(i),o;}async function aG(e){iq()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aB=oV(aG,{isPromise:!0});async function aH(e){"linux"===process.platform&&(await sD(su("gcc",void 0,await sm()),"",e));}const aq=oV(aH,{isPromise:!0});async function aV(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=[nB("LLVM_PATH",e),nB("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${n}`),nB("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${i}`),nB("LDFLAGS",`-L"${e}/lib"`),nB("CPPFLAGS",`-I"${e}/include"`),nB("CC",(0,iA.addExeExt)(`${e}/bin/clang`)),nB("CXX",(0,iA.addExeExt)(`${e}/bin/clang++`)),nB("LIBRARY_PATH",`${e}/lib`),sP()];iq()&&o.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(o);}async function az(){if(z.GITHUB_ACTIONS){let e=(0,iA.join)(ak,"llvm_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}}async function aW(e,t,r){switch(process.platform){case"win32":return iF("make",e);case"darwin":return await iD("make",e),await nq("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iM())return iX("make",e);if(iG())return iB([{name:"make",version:e}]);if(iq())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var z=V("cLprm"),iA=V("A8hFE"),W=V("hHq4F"),nM=V("3WkGD"),aX=h.resolve(__dirname,"../../src/msvc");async function aK(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=al(e);// check if the given version is already installed
|
||||
(0,W.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=au(l);c=!0,(0,W.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iq())return await ab(i);}catch(e){(0,W.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,ak,t,r);return await aH(i),o;}async function aB(e){iq()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aH=oV(aB,{isPromise:!0});async function aq(e){"linux"===process.platform&&(await sU(su("gcc",void 0,await sm()),"",e));}const aV=oV(aq,{isPromise:!0});async function az(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=[nB("LLVM_PATH",e),nB("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${n}`),nB("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${i}`),nB("LDFLAGS",`-L"${e}/lib"`),nB("CPPFLAGS",`-I"${e}/include"`),nB("CC",(0,iA.addExeExt)(`${e}/bin/clang`)),nB("CXX",(0,iA.addExeExt)(`${e}/bin/clang++`)),nB("LIBRARY_PATH",`${e}/lib`),sN()];iq()&&o.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(o);}async function aW(){if(z.GITHUB_ACTIONS){let e=(0,iA.join)(aD,"llvm_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}}async function aX(e,t,r){switch(process.platform){case"win32":return iF("make",e);case"darwin":return await iD("make",e),await nq("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iM())return iX("make",e);if(iG())return iB([{name:"make",version:e}]);if(iq())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var z=V("cLprm"),iA=V("A8hFE"),W=V("hHq4F"),nM=V("3WkGD"),aK=h.resolve(__dirname,"../../src/msvc");async function aY(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=ac(e);// check if the given version is already installed
|
||||
(0,W.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=ad(l);c=!0,(0,W.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}// https://github.com/aminya/setup-cpp/issues/1
|
||||
if(!c)try{"14.0"===l?(s="14.0",await iF("visualcpp-build-tools","14.0.25420.1",["--ignore-dependencies"]),a="C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"):"15.0"===l?(s="14.16",await iF("visualstudio2017buildtools","15.9.41.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16"// TODO verify path
|
||||
):"16.0"===l?(s="14.29",await iF("visualstudio2019buildtools","16.11.7.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"):"17.0"===l?(s=void 0,await iF("visualstudio2022buildtools","117.0.5.0",[]),a=void 0):(0,W.error)(`The given MSVC versions ${e} is not supported yet.`);}catch(e){(0,W.error)(e);}// run vcvarsall.bat environment variables
|
||||
await ad(l,a,r,s,n,i,o),z.GITHUB_ACTIONS&&(await aY());}async function aY(){let e=(0,iA.join)(aX,"msvc_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}async function aQ(e,t,r){if(!iq())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/G(nJ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iA.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
await ap(l,a,r,s,n,i,o),z.GITHUB_ACTIONS&&(await aQ());}async function aQ(){let e=(0,iA.join)(aK,"msvc_matcher.json");if(!(await(0,nM.pathExists)(e)))return(0,W.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,W.info)(`::add-matcher::${e}`);}async function aJ(e,t,r){if(!iq())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/G(nJ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iA.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian/scar.key");t6("/bin/bash",["-c",`echo "deb [signed-by=${o}] http://deb.volian.org/volian/ scar main" | tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list`]);try{"legacy"!==e?await ix([{name:"nala"}],!0):await ix([{name:"nala-legacy"}],!0);}catch(e){await ix([{name:"nala-legacy"}],!0);}return{binDir:i="/usr/bin"// eslint-disable-line require-atomic-updates
|
||||
};}async function aJ(e,t,r){if("win32"!==process.platform)return;await iF("opencppcoverage",e);let n=await aZ();return{binDir:n};}async function aZ(){let e="C:/Program Files/OpenCppCoverage";return await nq(e),e;}async function a0(e,t,r){switch(process.platform){case"win32":{await iF("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nq(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iM())return iX("powershell-bin",e,"yay");if(iG())return iB([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iB([{name:"powershell",version:e}]);if(iq()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
};}async function aZ(e,t,r){if("win32"!==process.platform)return;await iF("opencppcoverage",e);let n=await a0();return{binDir:n};}async function a0(){let e="C:/Program Files/OpenCppCoverage";return await nq(e),e;}async function a1(e,t,r){switch(process.platform){case"win32":{await iF("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nq(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iM())return iX("powershell-bin",e,"yay");if(iG())return iB([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iB([{name:"powershell",version:e}]);if(iq()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
// const keyFileName = await addAptKeyViaDownload(
|
||||
// "microsoft.asc",
|
||||
// "https://packages.microsoft.com/keys/microsoft.asc"
|
||||
|
@ -1442,15 +1442,15 @@ let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian
|
|||
// "-c",
|
||||
// `echo "deb [arch=amd64 signed-by=${keyFileName}] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list`,
|
||||
// ])
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iA=(V("A8hFE"),V("A8hFE"));/** Get the platform data for task */function a1(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var W=V("hHq4F"),nM=V("3WkGD"),iA=V("A8hFE");let a2=!1;async function a4(e,t,r){return a2&&null!==/*@__PURE__*/G(nJ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iA.dirname)(/*@__PURE__*/G(nJ).sync("vcpkg"))}:("linux"===process.platform&&(iM()?await Promise.all([iX("curl"),iX("zip"),iX("unzip"),iX("tar"),iX("git"),iX("pkg-config")]):iG()?await iB([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iq()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nM.pathExists)((0,iA.join)(t,(0,iA.addShExt)("bootstrap-vcpkg",".bat"))))?(0,W.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iA.dirname)(t),stdio:"inherit"}),nT((0,iA.addShExt)((0,iA.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nq(t),// eslint-disable-next-line require-atomic-updates
|
||||
a2=!0,{binDir:t});}const a3={nala:aQ,cmake:oj,ninja:sB,python:o8,vcpkg:a4,bazel:iV,conan:function(e,t,r){return sg("conan",e);},meson:function(e,t,r){return sg("meson",e);},gcovr:function(e,t,r){return sg("gcovr",e);},opencppcoverage:aJ,llvm:aD,gcc:sD,choco:iU,brew:iN,powershell:a0,ccache:function(e,t,r){switch(process.platform){case"win32":return iF("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iM())return iX("ccache",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iF("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sT,graphviz:s_,cppcheck:s$,clangtidy:aF,clangformat:aF,msvc:aK,vcvarsall:ad,kcov:sX,make:aW,task:function(e,t,r){return oR("task",e,a1,t,r);},sevenzip:oA},a6=Object.keys(a3),a8=["compiler","architecture","timeout",...a6];function a5(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iA=(V("A8hFE"),V("A8hFE"));/** Get the platform data for task */function a2(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iA.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var W=V("hHq4F"),nM=V("3WkGD"),iA=V("A8hFE");let a4=!1;async function a3(e,t,r){return a4&&null!==/*@__PURE__*/G(nJ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iA.dirname)(/*@__PURE__*/G(nJ).sync("vcpkg"))}:("linux"===process.platform&&(iM()?await Promise.all([iX("curl"),iX("zip"),iX("unzip"),iX("tar"),iX("git"),iX("pkg-config")]):iG()?await iB([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iq()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nM.pathExists)((0,iA.join)(t,(0,iA.addShExt)("bootstrap-vcpkg",".bat"))))?(0,W.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iA.dirname)(t),stdio:"inherit"}),nT((0,iA.addShExt)((0,iA.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nq(t),// eslint-disable-next-line require-atomic-updates
|
||||
a4=!0,{binDir:t});}const a6={nala:aJ,cmake:oj,ninja:sH,python:o8,vcpkg:a3,bazel:iV,conan:function(e,t,r){return sg("conan",e);},meson:function(e,t,r){return sg("meson",e);},gcovr:function(e,t,r){return sg("gcovr",e);},opencppcoverage:aZ,llvm:aU,gcc:sU,choco:iU,brew:iN,powershell:a1,ccache:function(e,t,r){switch(process.platform){case"win32":return iF("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iM())return iX("ccache",e);if(iG())return iB([{name:"ccache",version:e}]);if(iq())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iF("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sR,graphviz:sC,cppcheck:sO,clangtidy:aM,clangformat:aM,msvc:aY,vcvarsall:ap,kcov:sK,make:aX,task:function(e,t,r){return oR("task",e,a2,t,r);},sevenzip:oA},a8=Object.keys(a6),a5=["compiler","architecture","timeout",...a8];function a7(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
- The installation directory is ${t.installDir}`),""!==t.binDir&&(r+=`
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=V("2heqc"),W=V("hHq4F"),oY=V("eO4vc");async function a7(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/G(oY)(e)||(0,W.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${null!=l?l:""}`),a){case"llvm":case"clang":case"clang++":{let e=await aD(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nB("GCOV","llvm-cov gcov"),i.push(a5("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sU(e,(0,h.join)(r,"gcc"),n):await sD(e,(0,h.join)(r,"gcc"),n);o&&(await nB("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/G(oY)(e),r=null!==t?/*@__PURE__*/G(sA)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nB("GCOV",n);}(e),i.push(a5("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aK(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nB("CPPFLAGS","")),i.push(a5("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nB("CC","clang"),nB("CXX","clang++")]),i.push(a5("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,W.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=V("2heqc"),W=V("hHq4F"),oY=V("eO4vc");async function a9(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/G(oY)(e)||(0,W.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${null!=l?l:""}`),a){case"llvm":case"clang":case"clang++":{let e=await aU(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nB("GCOV","llvm-cov gcov"),i.push(a7("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sj(e,(0,h.join)(r,"gcc"),n):await sU(e,(0,h.join)(r,"gcc"),n);o&&(await nB("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/G(oY)(e),r=null!==t?/*@__PURE__*/G(sP)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nB("GCOV",n);}(e),i.push(a7("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aY(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nB("CPPFLAGS","")),i.push(a7("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nB("CC","clang"),nB("CXX","clang++")]),i.push(a7("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,W.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
/** The main entry function */(async function(e){var t,r,n;let i,o,s=Promise.resolve();z.GITHUB_ACTIONS||(s=rg(),process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS="true");// parse options using mri or github actions
|
||||
let a=function(e,t){t=t||{};var r,n,i,o,s,a={_:[]},l=0,c=0,u=0,d=(e=e||[]).length;let p=void 0!==t.alias,f=void 0!==t.unknown,h=void 0!==t.default;if(t.alias=t.alias||{},t.string=rw(t.string),t.boolean=rw(t.boolean),p)for(r in t.alias)for(l=0,n=t.alias[r]=rw(t.alias[r]);l<n.length;l++)(t.alias[n[l]]=n.concat(r)).splice(l,1);for(l=t.boolean.length;l-->0;)for(c=(n=t.alias[t.boolean[l]]||[]).length;c-->0;)t.boolean.push(n[c]);for(l=t.string.length;l-->0;)for(c=(n=t.alias[t.string[l]]||[]).length;c-->0;)t.string.push(n[c]);if(h){for(r in t.default)if(o=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],void 0!==t[o])for(t[o].push(r),l=0;l<n.length;l++)t[o].push(n[l]);}let m=f?Object.keys(t.alias):[];for(l=0;l<d;l++){if("--"===(i=e[l])){a._=a._.concat(e.slice(++l));break;}for(c=0;c<i.length&&45===i.charCodeAt(c)// "-"
|
||||
;c++);if(0===c)a._.push(i);else if("no-"===i.substring(c,c+3)){if(o=i.substring(c+3),f&&!~m.indexOf(o))return t.unknown(i);a[o]=!1;}else{for(u=c+1;u<i.length&&61!==i.charCodeAt(u)// "="
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a8,"timeout"],default:Object.fromEntries(a8.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});a.help&&((0,W.info)(`
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a5,"timeout"],default:Object.fromEntries(a5.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});a.help&&((0,W.info)(`
|
||||
setup-cpp [options]
|
||||
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||
|
||||
|
@ -1466,12 +1466,12 @@ 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:"--cppcache, --sccache"},documentation:{tools:"--doxygen, --graphviz"},coverage:{tools:"--gcovr, --opencppcoverage, --kcov"},other:{tools:"--python, --powershell, --sevenzip"}},["tools"]));// cpu architecture
|
||||
let l=null!==(t=a.architecture)&&void 0!==t?t:process.arch,c=null!==(r=process.env.SETUP_CPP_DIR)&&void 0!==r?r:t5(""),u=[],d=[],p=Y.create({autoloadLocales:!0});Y.addLocale(/*@__PURE__*/G(Q)),X.addLocale(/*@__PURE__*/G(K));// installing the specified tools
|
||||
let f=await sm();// sync the version for the llvm tools
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(a,["llvm","clangtidy","clangformat"]))return(0,W.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iM()&&"string"==typeof a.cppcheck&&"string"==typeof a.gcovr&&((0,W.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iX("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let h=!1,m=!1;for(let e of a6){// fail fast inside CI when any tool fails
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(a,["llvm","clangtidy","clangformat"]))return(0,W.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iM()&&"string"==typeof a.cppcheck&&"string"==typeof a.gcovr&&((0,W.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iX("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let h=!1,m=!1;for(let e of a8){// fail fast inside CI when any tool fails
|
||||
if(z.isCI&&0!==d.length){m=!0;break;}// get the version or "true" or undefined for this tool from the options
|
||||
let t=a[e];void 0!==t&&(// running the setup function for this tool
|
||||
i=Date.now(),// eslint-disable-next-line no-await-in-loop
|
||||
h=await av(e,t,f,l,c,u,d,6e4*parseFloat(null!==(n=a.timeout)&&void 0!==n?n:"20")),o=Date.now(),(0,W.info)(`took ${p.format(i,o)||"0 seconds"}`));}if(!m){// installing the specified compiler
|
||||
let e=a.compiler;if(void 0!==e){let t=Date.now();await a7(e,f,c,l,u,h,d);let r=Date.now();(0,W.info)(`took ${p.format(t,r)||"0 seconds"}`);}}if(await nY(),0===u.length&&0===d.length)return(0,W.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
h=await ag(e,t,f,l,c,u,d,6e4*parseFloat(null!==(n=a.timeout)&&void 0!==n?n:"20")),o=Date.now(),(0,W.info)(`took ${p.format(i,o)||"0 seconds"}`));}if(!m){// installing the specified compiler
|
||||
let e=a.compiler;if(void 0!==e){let t=Date.now();await a9(e,f,c,l,u,h,d);let r=Date.now();(0,W.info)(`took ${p.format(t,r)||"0 seconds"}`);}}if(await nY(),0===u.length&&0===d.length)return(0,W.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
u.forEach(e=>(0,W.success)(e)),d.forEach(e=>(0,W.error)(e)),(0,W.info)("setup-cpp finished"),!z.GITHUB_ACTIONS)switch(process.platform){case"win32":(0,W.warning)("Run `RefreshEnv.cmd` or restart your shell to update the environment.");break;case"linux":case"darwin":(0,W.warning)("Run `source ~/.cpprc` or restart your shell to update the environment.");}return await s,0===d.length?0:1;// exit with non-zero if any error message
|
||||
})(process.argv).then(e=>{process.exitCode=e;}).catch(e=>{(0,W.error)("main() panicked!"),(0,W.error)(e),process.exitCode=1;});
|
||||
//# sourceMappingURL=setup-cpp.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1221,7 +1221,7 @@ let e=await n(t,o);if(null!==e){// eslint-disable-next-line no-await-in-loop
|
|||
if(await oz(e))return[o,e];i.push(e);}}throw Error(`Unsupported target! (platform='${t}', version='${r}'). Try one of the following: ${JSON.stringify(e)}`);}const oZ=/v?(\d\S*)/;async function o0(e,t=oZ){try{let r=await(0,oo.getExecOutput)(e,["--version"]),n=r.stdout||r.stderr||"",i=n.trim().match(t)?.[1];return/*@__PURE__*/B(o_)(i)??void 0;}catch(e){console.error(e);return;}}async function o1(e,t,r=oZ){let n=await o0(e,r);return void 0!==n&&""!==t&&-1!==/*@__PURE__*/B(oW)(n,t);}// passing "" to a tool installed by a package manager (apt, brew, choco) will result in the default version of that package manager.
|
||||
// the directly downloaded tools require a given version ("" doesn't work).
|
||||
function o2(){switch(process.platform){case"win32":default:return"16.0.6";case"linux":// used for non-ubuntu (Fedora, Arch)
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iF()?"1.9.8-1":"1.9.8",gcc:iF()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nF=q("dOmbL");async function o5(e,t,r){let n=await o9(e,t,r);B(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o8(i),await o7(i),n;}async function o8(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"});}catch(e){(0,K.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,K.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iP.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
return"16.0.4-ubuntu-22.04";case"darwin":return"15.0.3";}}const o4={llvm:o2(),clangtidy:o2(),clangformat:o2(),ninja:"1.11.1",cmake:"3.27.4",gcovr:"6.0",conan:"1.60.2",meson:"1.2.1",kcov:"42",task:"3.29.1",doxygen:iF()?"1.9.8-1":"1.9.8",gcc:iF()?"13.2.1-3":"13"},o3={pip:"22.2.0",python:"3.7.9"},o6={gcc:{22:"13",20:"11",18:"11",16:"11",14:"11"},mingw:{22:"8.0.0-1",20:"7.0.0-2"},llvm:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangtidy:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},clangformat:{22:"16.0.4-ubuntu-22.04",20:"16.0.4-ubuntu-22.04",18:"15.0.6-ubuntu-18.04",16:"15.0.6-ubuntu-18.04",14:"13.0.0-ubuntu-16.04"},gcovr:{22:"6.0",20:"6.0",18:"5.0"},meson:{20:"1.0.0",18:"0.61.4"},nala:{22:"",21:"legacy",20:"legacy",18:"legacy",16:"legacy",14:"legacy"},kcov:{22:"42-binary",20:"40-binary",18:"40",16:"40",14:"40"}};var nF=q("dOmbL");async function o5(e,t,r){let n=await o9(e,t,r);B(E)(void 0!==n.bin);let i=n.bin,o=await sn(i);if(void 0===o)throw Error("pip was not installed correctly");return await o8(i),await o7(i),n;}async function o8(e){try{(await sw(e))||(await sy(e,"pipx",void 0,{upgrade:!0,usePipx:!1})),await nI(e,["-m","pipx","ensurepath"],{stdio:"inherit"}),await sy(e,"venv",void 0,{upgrade:!1,usePipx:!1});}catch(e){(0,K.warning)(`Failed to install pipx: ${e.toString()}. Ignoring...`);}}/** Setup wheel and setuptools */async function o7(e){try{await sy(e,"setuptools",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1}),await sy(e,"wheel",void 0,{upgrade:!0,isLibrary:!0,usePipx:!1});}catch(e){(0,K.warning)(`Failed to install setuptools or wheel: ${e.toString()}. Ignoring...`);}}async function o9(e,t,r){let n;let i=await st(t);if(void 0!==i){let e=(0,iP.dirname)(i);n={bin:i,installDir:e,binDir:e};}else{// if python is not found, try to install it
|
||||
if(X.GITHUB_ACTIONS)try{(0,K.info)("Installing python in GitHub Actions");let{setupActionsPython:o}=await q("5fF9z");await o(e,t,r),i=await st(t);let s=(0,iP.dirname)(i);n={bin:i,installDir:s,binDir:s};}catch(e){(0,K.warning)(e.toString());}void 0===n&&(n=await se(t,e));}return(void 0===i||void 0===n.bin)&&(i=await st(t),n.bin=i),n;}async function se(e,t){let r;switch(process.platform){case"win32":{e?await iM("python3",t,[`--params=/InstallDir:${e}`]):await iM("python3",t);// Adding the bin dir to the path
|
||||
let n=await st(e),i=(0,iP.dirname)(n);/** The directory which the tool is installed to */await nV(i),r={installDir:i,binDir:i,bin:n};break;}case"darwin":{r=await iD("python3",t);// add the python and pip binaries to the path
|
||||
let e=await nI("brew",["--prefix","python"],{stdio:"pipe"}),n=(0,iP.join)(e.stdout,"libexec","bin");await nV(n);break;}case"linux":if(iF())r=await iz("python",t);else if(iB())r=await iG([{name:"python3",version:t}]);else if(iV())r=await ix([{name:"python3",version:t},{name:"python-is-python3"}]);else throw Error("Unsupported linux distributions");break;default:throw Error("Unsupported platform");}return r;}async function st(e){for(let t of["python3","python"]){// eslint-disable-next-line no-await-in-loop
|
||||
|
@ -1233,7 +1233,7 @@ if(await o1(e,o3.python))return e;}catch{// fall through
|
|||
let t=await so(e);if(void 0!==t)return t;}}async function so(e){try{let t=(await/*@__PURE__*/B(nQ)(e,{nothrow:!0,all:!0}))??[];for(let e of t)// eslint-disable-next-line no-await-in-loop
|
||||
if(null!==e&&(await o1(e,o3.pip)))return e;}catch{// fall through
|
||||
}}async function ss(e){let t=await sa(e);t||(// ensure that pip is installed on Linux (happens when python is found but pip not installed)
|
||||
await sS("pip"),// upgrade pip
|
||||
await s$("pip"),// upgrade pip
|
||||
await sa(e));}async function sa(e){try{return await nI(e,["-m","ensurepip","-U","--upgrade"],{stdio:"inherit"}),!0;}catch(t){(0,K.info)(t?.toString?.());try{return(// ensure pip is disabled on Ubuntu
|
||||
await nI(e,["-m","pip","install","--upgrade","pip"],{stdio:"inherit"}),!0);}catch(e){(0,K.info)(e?.toString?.());// pip module not found
|
||||
}}// all methods failed
|
||||
|
@ -1244,12 +1244,12 @@ t.push((0,iP.join)(r,"Scripts"),(0,iP.join)(r,"Scripts","bin"),(0,iP.join)(r,"bi
|
|||
function(e,t){let r=e[0],n=Object.keys(t).map(e=>parseInt(e,10)).sort((e,t)=>t-e)// sort in descending order
|
||||
.find(e=>r>=e);return void 0===n?"":t[n];}(r,o6[e]):sd(t)&&e in o4?o4[e]:"true"===t?"":t??"";}function sd(e){return"true"===e||void 0===e;}var K=q("ER74K"),sp={};async function sf(){var e,t;if("linux"!==process.platform)return[];let r=await(e="lsb_release",t=["-a"],new Promise((r,n)=>{$.execFile(e,t,{encoding:"utf8",shell:!1},(i,o,s)=>{if(i){if("errno"in i&&"ENOENT"===i.code){r(null);// When lsb_release is not found
|
||||
return;}n(Error(`Could not execute \`${e} ${t.join(" ")}\`: ${i} (stderr=${s})`));return;}r(o);});}));if(null===r)return[];let n=/^Distributor ID:\s*(.+)$/,i=/^Description:\s*Ubuntu\s+(\d+)\.(\d+)(?:\.(\d+))?/,o=/^Release:\s*(\d+)\.(\d+)(?:\.(\d+))?$/,s=null,a=null,l=!1;for(let e of r.split("\n")){let t=e.match(n);if(null!==t){let e=t[1];if("Ubuntu"!==e)return[];l=!0;}let r=e.match(i);r&&(s=r);let c=e.match(o);if(c&&(a=c),l&&s&&a)break;}if(!l)return[];for(let e of[s,a])if(e){let t=[e[1],e[2]];return e[3]&&t.push(e[3]),t.map(e=>parseInt(e,10));}return[];}async function sh(){try{if(!iV())return null;{try{null===/*@__PURE__*/B(nQ).sync("lsb_release",{nothrow:!0})&&(await ix([{name:"lsb-release"}]));}catch{return sg();}let e=await(0,sp.getUbuntuVersion)();if(0===e.length)return sg();return e;}}catch(e){return(0,K.warning)(e.toString()),null;}}Object.defineProperty(sp,"__esModule",{value:!0}),sp.getUbuntuVersion=void 0,sp.getUbuntuVersion=sf;const sm=oq(sh);/** Detect Ubuntu version using os.version() for Ubuntu based distros */function sg(){// #46~22.04.1-Ubuntu SMP ...
|
||||
let e=B(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sv(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${r??""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[];nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await sS(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sb(u,t);return await nV(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o5(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oq(sx);async function sb(e,t){let r=await Promise.all(e.map(e=>(0,nF.pathExists)((0,iP.join)(e,(0,iP.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/B(nQ).sync((0,iP.addExeExt)(t),{nothrow:!0});return null!==i?(0,iP.dirname)(i):e[e.length-1];}function sS(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iF())return iz(`python-${e}`);if(iB())return iG([{name:`python3-${e}`}]);if(iV())return ix([{name:`python3-${e}`}]);}return null;}async function s$(e,t,r){switch(process.platform){case"win32":{await iM("cppcheck",e);let t=await s_();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iF())return iz("cppcheck",e);if(iB())return iG([{name:"ccache",version:e}]);if(iV())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function s_(){let e="C:/Program Files/Cppcheck";return await nV(e),e;}var iP=q("ceI0e"),K=q("ER74K");async function sO(e,t,r){switch(process.platform){case"win32":return await iM("graphviz",e),sC();case"darwin":return iD("graphviz",e);case"linux":if(iF())return iz("graphviz",e);if(iB())return iG([{name:"graphviz",version:e}]);if(iV())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sC(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nV(e),{binDir:e};}throw Error("Unsupported platform");}var nF=q("dOmbL");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sI(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iJ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sT(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/B(oO)(()=>iM("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,K.info)(e)});let t=await sR();return await sO(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await sO(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iF()||iB()){if(iF())n=await iz("doxygen",e);else if(iB())return iG([{name:"doxygen",version:e}]);else if(iV())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iV())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sI,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,K.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await sO(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sR(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nF.pathExists)((0,iP.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nV(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sP=q("bX9Em"),o_=q("9hSY8"),oo=q("jlr6Q"),K=q("ER74K");async function sA(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nG("SDKROOT",t.trim()):(0,K.error)("SDKROOT not set");}catch(e){(0,K.error)(e);}}var iP=q("ceI0e"),K=q("ER74K"),X=q("dTX7a"),nF=q("dOmbL"),sN=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sk(e,t,r){if("win32"===t){let t=sL[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oA,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sD(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iM("gcc-arm-embedded",e));try{n=await oR("g++",e,sk,t,r);}catch(t){(0,K.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sj(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iF()?n=await iz("gcc",e):iB()?n=await iG([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iV()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,K.info)(`Install g++-multilib because gcc for ${r} was requested`),iF()?await iz("gcc-multilib",e):iV()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
let e=B(f).version(),t=e.split("."),r=parseInt(t[0].replace("#",""),10),n=parseInt(t[1].replace("~",""),10),i=parseInt(t[2].split("-")[0],10);return[r,n,i];}async function sv(e,t,r={}){return sy(await sE(),e,t,r);}async function sy(e,t,r,n={}){let{usePipx:i=!0,user:o=!0,upgrade:s=!1,isLibrary:a=!1}=n,l=i&&!a&&(await sw(e)),c=l?"pipx":"pip";(0,ry.info)(`Installing ${t} ${r??""} via ${c}`);try{let n=void 0!==r&&""!==r?`${t}==${r}`:t,i=!l&&o?["--user"]:[],a=await sb(e,t);if(a)nT(e,["-m",c,...(s?l?["upgrade"]:["install","--upgrade"]:["install"]),...i,n],{stdio:"inherit"});else if((await s$(t))===null)throw Error(`Failed to install ${t}.`);}catch(e){if((0,ry.info)(`Failed to install ${t} via ${c}: ${e}.`),(await s$(t))===null)throw Error(`Failed to install ${t} via ${c}: ${e}.`);}let u=await sc(e),d=await sS(u,t);return await nV(d),{binDir:d};}async function sw(e){return 0===(await nI(e,["-m","pipx","--help"],{stdio:"ignore",reject:!1})).exitCode;}async function sx(){let e=(await o5(su("python",void 0,await sm()),"",process.arch)).bin;if(void 0===e)throw Error("Python binary was not found");return e;}const sE=oq(sx);async function sb(e,t){let r=await nI(e,["-m","pip","show",t],{stdio:"ignore",reject:!1});return 0===r.exitCode;}async function sS(e,t){let r=await Promise.all(e.map(e=>(0,nF.pathExists)((0,iP.join)(e,(0,iP.addExeExt)(t))))),n=r.findIndex(e=>e);if(-1!==n){let t=e[n];return t;}let i=/*@__PURE__*/B(nQ).sync((0,iP.addExeExt)(t),{nothrow:!0});return null!==i?(0,iP.dirname)(i):e[e.length-1];}function s$(e){if("linux"===process.platform){if((0,ry.info)(`Installing ${e} via the system package manager`),iF())return iz(`python-${e}`);if(iB())return iG([{name:`python3-${e}`}]);if(iV())return ix([{name:`python3-${e}`}]);}return null;}async function s_(e,t,r){switch(process.platform){case"win32":{await iM("cppcheck",e);let t=await sO();return{binDir:t};}case"darwin":return iD("cppcheck",e);case"linux":if(iF())return iz("cppcheck",e);if(iB())return iG([{name:"ccache",version:e}]);if(iV())return ix([{name:"cppcheck",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sO(){let e="C:/Program Files/Cppcheck";return await nV(e),e;}var iP=q("ceI0e"),K=q("ER74K");async function sC(e,t,r){switch(process.platform){case"win32":return await iM("graphviz",e),sI();case"darwin":return iD("graphviz",e);case"linux":if(iF())return iz("graphviz",e);if(iB())return iG([{name:"graphviz",version:e}]);if(iV())return ix([{name:"graphviz",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}async function sI(){if("win32"===process.platform){let e="C:/Program Files/Graphviz/bin";return await nV(e),{binDir:e};}throw Error("Unsupported platform");}var nF=q("dOmbL");/** Get the platform data for cmake */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sT(e,t,r){switch(t){case"linux":{let t=`doxygen-${e}`;return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:iJ.extractTar,url:`https://www.doxygen.nl/files/${t}.linux.bin.tar.gz`};}case"win32":{let t=`doxygen-${e}`;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("doxygen"),extractedFolderName:t,extractFunction:ok,url:`https://www.doxygen.nl/files/${t}.windows.x64.bin.zip`};}default:throw Error(`Unsupported platform '${t}'`);}}async function sR(e,t,r){switch(process.platform){case"win32":{// try to download the package 4 times with 2 seconds delay
|
||||
await/*@__PURE__*/B(oO)(()=>iM("doxygen.install",e),{name:"doxygen.install",max:4,backoffBase:2e3,report:e=>(0,K.info)(e)});let t=await sP();return await sC(su("graphviz",void 0),"",r),{binDir:t};}case"darwin":{let e=await iD("doxygen",void 0);return await sC(su("graphviz",void 0),"",r),e;}case"linux":{let n;if(""===e||iF()||iB()){if(iF())n=await iz("doxygen",e);else if(iB())return iG([{name:"doxygen",version:e}]);else if(iV())n=await ix([{name:"doxygen",version:e}]);else throw Error("Unsupported linux distributions");}else if(iV())try{// doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
|
||||
n=await oR("doxygen",e,sT,t,r),await ix([{name:"libclang-cpp9"}]);}catch(e){(0,K.notice)(`Failed to download doxygen binary. ${e}. Falling back to apt-get.`),n=await ix([{name:"doxygen"}]);}else throw Error("Unsupported linux distributions");return await sC(su("graphviz",void 0,await sm()),"",r),n;}default:throw Error("Unsupported platform");}}async function sP(){if("win32"===process.platform){for(let e of["C:/ProgramData/chocolatey/bin","C:/Program Files/doxygen/bin","C:/Program Files (x86)/doxygen"])if(await(0,nF.pathExists)((0,iP.join)(e,"doxygen.exe")))return(// eslint-disable-next-line no-await-in-loop
|
||||
await nV(e),e);throw Error("Failed to find doxygen binary");}throw Error("Unsupported platform");}var sA=q("bX9Em"),o_=q("9hSY8"),oo=q("jlr6Q"),K=q("ER74K");async function sN(){if("darwin"===process.platform)try{let e=await(0,oo.getExecOutput)("xcrun --sdk macosx --show-sdk-path"),t=e.stdout||e.stderr;t?await nG("SDKROOT",t.trim()):(0,K.error)("SDKROOT not set");}catch(e){(0,K.error)(e);}}var iP=q("ceI0e"),K=q("ER74K"),X=q("dTX7a"),nF=q("dOmbL"),sL=h.resolve(__dirname,"../../src/gcc");// https://github.com/brechtsanders/winlibs_mingw/releases
|
||||
const sk={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt":{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.0-r1"},"13.2-ucrt-mcf":{releaseName:"13.2.0mcf-16.0.6-11.0.1-ucrt-r2",fileSuffix:"13.2.0-mingw-w64ucrt-11.0.1-r2"},"13.2-msvcrt":{releaseName:"13.2.0-16.0.6-11.0.1-msvcrt-r1",fileSuffix:"13.2.0-mingw-w64msvcrt-11.0.1-r1"},"13.1-ucrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-ucrt-r1",fileSuffix:"13.1.0-mingw-w64ucrt-11.0.0-r1"},"13.1-msvcrt":{releaseName:"13.1.0posix-16.0.3-11.0.0-msvcrt-r1",fileSuffix:"13.1.0-mingw-w64msvcrt-11.0.0-r1"},12:{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-ucrt":{releaseName:"12.3.0-16.0.4-11.0.0-ucrt-r1",fileSuffix:"12.3.0-mingw-w64ucrt-11.0.0-r1"},"12.3.0-msvcrt":{releaseName:"12.3.0-16.0.4-11.0.0-msvcrt-r1",fileSuffix:"12.3.0-mingw-w64msvcrt-11.0.0-r1"},"12.2.0-ucrt":{releaseName:"12.2.0-14.0.6-10.0.0-ucrt-r2",fileSuffix:"12.2.0-mingw-w64ucrt-10.0.0-r2"},"12.2.0-msvcrt":{releaseName:"12.2.0-14.0.6-10.0.0-msvcrt-r2",fileSuffix:"12.2.0-mingw-w64msvcrt-10.0.0-r2"},"12.1.0-ucrt":{releaseName:"12.1.0-14.0.4-10.0.0-ucrt-r2",fileSuffix:"12.1.0-mingw-w64ucrt-10.0.0-r2"},"12.1.0-msvcrt":{releaseName:"12.1.0-14.0.6-10.0.0-msvcrt-r3",fileSuffix:"12.1.0-llvm-14.0.6-mingw-w64msvcrt-10.0.0-r3"},11:{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-ucrt":{releaseName:"11.3.0-14.0.3-10.0.0-ucrt-r3",fileSuffix:"11.3.0-mingw-w64ucrt-10.0.0-r3"},"11.3.0-msvcrt":{releaseName:"11.3.0-14.0.3-10.0.0-msvcrt-r3",fileSuffix:"11.3.0-mingw-w64msvcrt-10.0.0-r3"},"11.2.0-ucrt":{releaseName:"11.2.0-9.0.0-ucrt-r5",fileSuffix:"11.2.0-mingw-w64ucrt-9.0.0-r5"},"11.2.0-msvcrt":{releaseName:"11.2.0-9.0.0-msvcrt-r5",fileSuffix:"11.2.0-mingw-w64msvcrt-9.0.0-r5"},10:{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.5.0-msvcrt":{releaseName:"10.5.0-11.0.1-msvcrt-r1",fileSuffix:"10.5.0-mingw-w64msvcrt-11.0.1-r1"},"10.3.0":{releaseName:"10.3.0-12.0.0-9.0.0-r2",fileSuffix:"10.3.0-llvm-12.0.0-mingw-w64-9.0.0-r2"},"10.2.0":{releaseName:"10.2.0-7.0.0-r4",fileSuffix:"10.2.0-llvm-10.0.1-mingw-w64-7.0.0-r4"},9:{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"},"9.4.0":{releaseName:"9.4.0-9.0.0-r1",fileSuffix:"9.4.0-mingw-w64-9.0.0-r1"}};function sD(e,t,r){if("win32"===t){let t=sk[e];if(void 0===t)throw Error(`mingw version ${e} is not supported`);return{binRelativeDir:"bin/",binFileName:(0,iP.addExeExt)("g++"),extractedFolderName:"mingw64",extractFunction:oA,url:`https://github.com/brechtsanders/winlibs_mingw/releases/download/${t.releaseName}/winlibs-${"ia32"===r?"i686":"x86_64"}-posix-seh-gcc-${t.fileSuffix}.7z`};}throw Error(`Unsupported platform '${t}'`);}async function sU(e,t,r){let n;switch(process.platform){case"win32":("arm"===r||"arm64"===r)&&(await iM("gcc-arm-embedded",e));try{n=await oR("g++",e,sD,t,r);}catch(t){(0,K.info)(`Failed to download g++ binary. ${t}. Falling back to chocolatey.`),n=await sM(e,r);}break;case"darwin":n=await iD("gcc",e);break;case"linux":"x64"===r?iF()?n=await iz("gcc",e):iB()?n=await iG([{name:"gcc",version:e},{name:"gcc-c++",version:e},{name:"libstdc++-devel"}]):iV()&&(n=await ix([{name:"gcc",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]},{name:"g++",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])):((0,K.info)(`Install g++-multilib because gcc for ${r} was requested`),iF()?await iz("gcc-multilib",e):iV()&&(await ix([{name:"gcc-multilib",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}])));break;// TODO support bare-metal (need to support passing it as the input)
|
||||
// TODO support abi
|
||||
// case "none": {
|
||||
// if (arch === "arm" || arch === "arm64") {
|
||||
|
@ -1260,12 +1260,12 @@ const sL={13:{releaseName:"13.2.0-16.0.6-11.0.0-ucrt-r1",fileSuffix:"13.2.0-ming
|
|||
// throw new Error(`Unsupported platform for ${arch}`)
|
||||
// }
|
||||
// }
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sM(e,n.binDir),n;}async function sU(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sD(e,t,r);case"linux":iF()?n=await iz("mingw-w64-gcc",e):iB()?n=await iG([{name:"mingw64-gcc",version:e}]):iV()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)return await sF(e,n.binDir),n;}async function sj(e,t,r){let n;switch(process.platform){case"win32":case"darwin":return sU(e,t,r);case"linux":iF()?n=await iz("mingw-w64-gcc",e):iB()?n=await iG([{name:"mingw64-gcc",version:e}]):iV()&&(n=await ix([{name:"mingw-w64",version:e,repositories:["ppa:ubuntu-toolchain-r/test"]}]));break;default:throw Error(`Unsupported platform for ${r}`);}if(void 0!==n)//Setting up g++-mingw-w64-i686-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/i686-w64-mingw32-g++-win32 to provide /usr/bin/i686-w64-mingw32-g++ (i686-w64-mingw32-g++) in auto mode
|
||||
//Setting up g++-mingw-w64-x86-64-win32 (10.3.0-14ubuntu1+24.3) ...
|
||||
// update-alternatives: using /usr/bin/x86_64-w64-mingw32-g++-win32 to provide /usr/bin/x86_64-w64-mingw32-g++ (x86_64-w64-mingw32-g++) in auto mode
|
||||
//await activateGcc(version, installationInfo.binDir)
|
||||
return n;}async function sj(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(0,nF.pathExists)("C:/tools/mingw64/bin"))?(r="C:/tools/mingw64/bin",await nV(r)):"ia32"===t&&(await(0,nF.pathExists)("C:/tools/mingw32/bin"))?(r="C:/tools/mingw32/bin",await nV(r)):(await(0,nF.pathExists)(`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(r=`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin`),void 0!==r)return{binDir:r};}async function sM(e,t){let r=[];// Setup gcc as the compiler
|
||||
return n;}async function sM(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(0,nF.pathExists)("C:/tools/mingw64/bin"))?(r="C:/tools/mingw64/bin",await nV(r)):"ia32"===t&&(await(0,nF.pathExists)("C:/tools/mingw32/bin"))?(r="C:/tools/mingw32/bin",await nV(r)):(await(0,nF.pathExists)(`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin/g++.exe`))&&(r=`${process.env.ChocolateyInstall??"C:/ProgramData/chocolatey"}/bin`),void 0!==r)return{binDir:r};}async function sF(e,t){let r=[];// Setup gcc as the compiler
|
||||
// TODO
|
||||
// const ld = process.env.LD_LIBRARY_PATH ?? ""
|
||||
// const dyld = process.env.DYLD_LIBRARY_PATH ?? ""
|
||||
|
@ -1276,13 +1276,13 @@ return n;}async function sj(e,t){let r;if(await iM("mingw",e),"x64"===t&&(await(
|
|||
// addEnv("LDFLAGS", `-L${installDir}/lib`),
|
||||
// addEnv("CPPFLAGS", `-I${installDir}/include`)
|
||||
// )
|
||||
if("win32"===process.platform)r.push(nG("CC",(0,iP.addExeExt)(`${t}/gcc`)),nG("CXX",(0,iP.addExeExt)(`${t}/g++`)));else{let n=/*@__PURE__*/B(sP)(/*@__PURE__*/B(o_)(e)??e);n>=5?(r.push(nG("CC",`${t}/gcc-${n}`),nG("CXX",`${t}/g++-${n}`)),iV()&&r.push(iT("cc",`${t}/gcc-${n}`),iT("cxx",`${t}/g++-${n}`),iT("gcc",`${t}/gcc-${n}`),iT("g++",`${t}/g++-${n}`))):(r.push(nG("CC",`${t}/gcc-${e}`),nG("CXX",`${t}/g++-${e}`)),iV()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sA()),X.GITHUB_ACTIONS&&(await sF()),await Promise.all(r);}async function sF(){let e=(0,iP.join)(sN,"gcc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}var oY=q("eJTZB"),sP=q("bX9Em"),iP=q("ceI0e"),K=q("ER74K"),iP=q("ceI0e");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sB(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sG(e,t,r){return oR("ninja",e,sB,t,r);}var sH=h.resolve(__dirname,"../../src/kcov");function sV(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:oD};}function sq(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:sX};}async function sX(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sK();"linux"===process.platform&&(iF()?await Promise.all([iz("libdwarf"),iz("libcurl-openssl")]):iB()?await iG([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iV()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/B(nQ).sync("patch",{nothrow:!0})){let e=(0,iP.join)(sH,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,K.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
if("win32"===process.platform)r.push(nG("CC",(0,iP.addExeExt)(`${t}/gcc`)),nG("CXX",(0,iP.addExeExt)(`${t}/g++`)));else{let n=/*@__PURE__*/B(sA)(/*@__PURE__*/B(o_)(e)??e);n>=5?(r.push(nG("CC",`${t}/gcc-${n}`),nG("CXX",`${t}/g++-${n}`)),iV()&&r.push(iT("cc",`${t}/gcc-${n}`),iT("cxx",`${t}/g++-${n}`),iT("gcc",`${t}/gcc-${n}`),iT("g++",`${t}/g++-${n}`))):(r.push(nG("CC",`${t}/gcc-${e}`),nG("CXX",`${t}/g++-${e}`)),iV()&&r.push(iT("cc",`${t}/gcc-${e}`),iT("cxx",`${t}/g++-${e}`),iT("gcc",`${t}/gcc-${e}`),iT("g++",`${t}/g++-${e}`)));}r.push(sN()),X.GITHUB_ACTIONS&&(await sB()),await Promise.all(r);}async function sB(){let e=(0,iP.join)(sL,"gcc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the gcc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}var oY=q("eJTZB"),sA=q("bX9Em"),iP=q("ceI0e"),K=q("ER74K"),iP=q("ceI0e");/** Get the platform data for ninja */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
function sG(e,t,r){let n=/** Get the platform name Ninja uses in their download links */function(e){switch(e){case"win32":return"win";case"darwin":return"mac";case"linux":return"linux";default:throw Error(`Unsupported platform '${e}'`);}}(t);return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("ninja"),extractedFolderName:"",extractFunction:ok,url:`https://github.com/ninja-build/ninja/releases/download/v${e}/ninja-${n}.zip`};}function sH(e,t,r){return oR("ninja",e,sG,t,r);}var sV=h.resolve(__dirname,"../../src/kcov");function sq(e){return{url:`https://github.com/SimonKagstrom/kcov/releases/download/${e}/kcov-amd64.tar.gz`,extractedFolderName:"",binRelativeDir:"usr/local/bin",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:oD};}function sX(e){return{url:`https://github.com/SimonKagstrom/kcov/archive/refs/tags/${e}.tar.gz`,extractedFolderName:"",binRelativeDir:"build/src",binFileName:(0,iP.addExeExt)("kcov"),extractFunction:sK};}async function sK(e,t){let r=await oD(e,t,["--strip-components=1"]),n=await sz();"linux"===process.platform&&(iF()?await Promise.all([iz("libdwarf"),iz("libcurl-openssl")]):iB()?await iG([{name:"libdwarf-devel"},{name:"libcurl-devel"}]):iV()&&(await ix([{name:"libdw-dev"},{name:"libcurl4-openssl-dev"}])));// apply gcc13.patch
|
||||
try{if(null!==/*@__PURE__*/B(nQ).sync("patch",{nothrow:!0})){let e=(0,iP.join)(sV,"gcc13.patch");await nI("patch",["-N","-p1","-i",e],{cwd:r,stdio:"inherit"});}else(0,K.info)("`patch` not found, skipping gcc13.patch, kcov may not build on gcc 13");}catch{// ignore
|
||||
}let i=(0,iP.join)(r,"build");// execRootSync(cmake, ["--install", buildDir], out)
|
||||
// return "user/local/bin" // the cmake install prefix
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sK(){let e=/*@__PURE__*/B(nQ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iP.join)(t8(""),"cmake"),"");e=(0,iP.join)(t,"cmake");}let t=/*@__PURE__*/B(nQ).sync("ninja",{nothrow:!0});return null===t&&(await sG(su("ninja",void 0,await sm()),(0,iP.join)(t8(""),"ninja"),"")),e;}async function sz(e,t,r){var n;let i;if("linux"!==process.platform){(0,K.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sV,t,r),iF()?await iz("binutils"):iB()?await iG([{name:"binutils"}]):iV()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sq,t,r),i;}var X=q("dTX7a"),K=q("ER74K"),nF=q("dOmbL"),iP=q("ceI0e"),ry=q("lcRzN"),K=q("ER74K"),iP=q("ceI0e"),sW={},sY=sW&&sW.__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());});},sJ=sW&&sW.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sW,"__esModule",{value:!0});var sQ={},sZ=sQ&&sQ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sQ,"__esModule",{value:!0});const s0=sZ(f);var s1={};/**
|
||||
return await nI(n,["-S",r,"-B",i,"-DCMAKE_BUILD_TYPE=Release","-G","Ninja"],{cwd:r,stdio:"inherit"}),await nI(n,["--build",i,"--config","Release"],{cwd:r,stdio:"inherit"}),r;}async function sz(){let e=/*@__PURE__*/B(nQ).sync("cmake",{nothrow:!0});if(null===e){let{binDir:t}=await oj(su("cmake",void 0,await sm()),(0,iP.join)(t8(""),"cmake"),"");e=(0,iP.join)(t,"cmake");}let t=/*@__PURE__*/B(nQ).sync("ninja",{nothrow:!0});return null===t&&(await sH(su("ninja",void 0,await sm()),(0,iP.join)(t8(""),"ninja"),"")),e;}async function sW(e,t,r){var n;let i;if("linux"!==process.platform){(0,K.info)("Kcov is not supported on non-linux");return;}// parse version
|
||||
let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(/^v/,""),10);return 38===l&&(s="v38"),"binary"===a&&l>=39?(i=await oR("kcov",s,sq,t,r),iF()?await iz("binutils"):iB()?await iG([{name:"binutils"}]):iV()&&(await ix([{name:"libbinutils"}]))):i=await oR("kcov",s,sX,t,r),i;}var X=q("dTX7a"),K=q("ER74K"),nF=q("dOmbL"),iP=q("ceI0e"),ry=q("lcRzN"),K=q("ER74K"),iP=q("ceI0e"),sY={},sJ=sY&&sY.__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());});},sQ=sY&&sY.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sY,"__esModule",{value:!0});var sZ={},s0=sZ&&sZ.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(sZ,"__esModule",{value:!0});const s1=s0(f);var s2={};/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
|
@ -1291,27 +1291,27 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/function s2(e,t,r){let n=new s4(e,t,r);process.stdout.write(n.toString()+s0.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s1,"__esModule",{value:!0}),s1.toCommandValue=/**
|
||||
*/function s4(e,t,r){let n=new s3(e,t,r);process.stdout.write(n.toString()+s1.EOL);}// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */Object.defineProperty(s2,"__esModule",{value:!0}),s2.toCommandValue=/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sQ.issueCommand=s2,sQ.issue=function(e,t=""){s2(e,{},t);};class s4{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}=${s1.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s1.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s3={},s6=s3&&s3.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s3,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s5=s6(m),s8=s6(f);s3.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s5.existsSync(r))throw Error(`Missing file at path: ${r}`);s5.appendFileSync(r,`${s1.toCommandValue(t)}${s8.EOL}`,{encoding:"utf8"});};const s7=sJ(f),s9=sJ(h);/**
|
||||
*/function(e){return null==e?"":"string"==typeof e||e instanceof String?e:JSON.stringify(e);},sZ.issueCommand=s4,sZ.issue=function(e,t=""){s4(e,{},t);};class s3{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}=${s2.toCommandValue(n).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}`);}}return t+`::${(e=this.message,s2.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A"))}`;}}var s6={},s5=s6&&s6.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t;};Object.defineProperty(s6,"__esModule",{value:!0});// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */const s8=s5(m),s7=s5(f);s6.issueCommand=function(e,t){let r=process.env[`GITHUB_${e}`];if(!r)throw Error(`Unable to find environment variable for file command ${e}`);if(!s8.existsSync(r))throw Error(`Missing file at path: ${r}`);s8.appendFileSync(r,`${s2.toCommandValue(t)}${s7.EOL}`,{encoding:"utf8"});};const s9=sQ(f),ae=sQ(h);/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/function ae(e){sQ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
*/function at(e){sZ.issue("error",e instanceof Error?e.toString():e);}/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/function at(e){sQ.issue("group",e);}/**
|
||||
*/function ar(e){sZ.issue("group",e);}/**
|
||||
* End an output group.
|
||||
*/function ar(){sQ.issue("endgroup");}/**
|
||||
*/function an(){sZ.issue("endgroup");}/**
|
||||
* A code indicating that the action was successful
|
||||
*/(c=p=sW.ExitCode||(sW.ExitCode={}))[c.Success=0]="Success",/**
|
||||
*/(c=p=sY.ExitCode||(sY.ExitCode={}))[c.Success=0]="Success",/**
|
||||
* A code indicating that the action was a failure
|
||||
*/c[c.Failure=1]="Failure",sW.exportVariable=//-----------------------------------------------------------------------
|
||||
*/c[c.Failure=1]="Failure",sY.exportVariable=//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1319,57 +1319,57 @@ let o=e.split("-"),s=(n=o[0]).match(/^v/)?n:`v${n}`,a=o[1],l=parseInt(s.replace(
|
|||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){let r=s1.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s7.EOL}${r}${s7.EOL}${t}`;s3.issueCommand("ENV",n);}else sQ.issueCommand("set-env",{name:e},r);},sW.setSecret=/**
|
||||
function(e,t){let r=s2.toCommandValue(t);process.env[e]=r;let n=process.env.GITHUB_ENV||"";if(n){let t="_GitHubActionsFileCommandDelimeter_",n=`${e}<<${t}${s9.EOL}${r}${s9.EOL}${t}`;s6.issueCommand("ENV",n);}else sZ.issueCommand("set-env",{name:e},r);},sY.setSecret=/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/function(e){sQ.issueCommand("add-mask",{},e);},sW.addPath=/**
|
||||
*/function(e){sZ.issueCommand("add-mask",{},e);},sY.addPath=/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s3.issueCommand("PATH",e):sQ.issueCommand("add-path",{},e),process.env.PATH=`${e}${s9.delimiter}${process.env.PATH}`;},sW.getInput=/**
|
||||
*/function(e){let t=process.env.GITHUB_PATH||"";t?s6.issueCommand("PATH",e):sZ.issueCommand("add-path",{},e),process.env.PATH=`${e}${ae.delimiter}${process.env.PATH}`;},sY.getInput=/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sW.setOutput=/**
|
||||
*/function(e,t){let r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r)throw Error(`Input required and not supplied: ${e}`);return r.trim();},sY.setOutput=/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sQ.issueCommand("set-output",{name:e},t);},sW.setCommandEcho=/**
|
||||
function(e,t){sZ.issueCommand("set-output",{name:e},t);},sY.setCommandEcho=/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/function(e){sQ.issue("echo",e?"on":"off");},sW.setFailed=//-----------------------------------------------------------------------
|
||||
*/function(e){sZ.issue("echo",e?"on":"off");},sY.setFailed=//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/function(e){process.exitCode=p.Failure,ae(e);},sW.isDebug=//-----------------------------------------------------------------------
|
||||
*/function(e){process.exitCode=p.Failure,at(e);},sY.isDebug=//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sW.debug=/**
|
||||
*/function(){return"1"===process.env.RUNNER_DEBUG;},sY.debug=/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/function(e){sQ.issueCommand("debug",{},e);},sW.error=ae,sW.warning=/**
|
||||
*/function(e){sZ.issueCommand("debug",{},e);},sY.error=at,sY.warning=/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/function(e){sQ.issue("warning",e instanceof Error?e.toString():e);},sW.info=/**
|
||||
*/function(e){sZ.issue("warning",e instanceof Error?e.toString():e);},sY.info=/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/function(e){process.stdout.write(e+s7.EOL);},sW.startGroup=at,sW.endGroup=ar,sW.group=/**
|
||||
*/function(e){process.stdout.write(e+s9.EOL);},sY.startGroup=ar,sY.endGroup=an,sY.group=/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/function(e,t){return sY(this,void 0,void 0,function*(){let r;at(e);try{r=yield t();}finally{ar();}return r;});},sW.saveState=//-----------------------------------------------------------------------
|
||||
*/function(e,t){return sJ(this,void 0,void 0,function*(){let r;ar(e);try{r=yield t();}finally{an();}return r;});},sY.saveState=//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
|
@ -1378,62 +1378,62 @@ function(e,t){sQ.issueCommand("set-output",{name:e},t);},sW.setCommandEcho=/**
|
|||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function(e,t){sQ.issueCommand("save-state",{name:e},t);},sW.getState=/**
|
||||
function(e,t){sZ.issueCommand("save-state",{name:e},t);},sY.getState=/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const an=T.env["ProgramFiles(x86)"],ai=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],ao=["Enterprise","Professional","Community"],as=["2022","2019","2017"],aa={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function al(e){if(Object.values(aa).includes(e));else if(e in aa)return aa[e];return e;}const ac=`${an}\\Microsoft Visual Studio\\Installer`;function au(e){let t;let r=al(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sW.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sW.info(`Found with vswhere: ${n}`),n;sW.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
*/function(e){return process.env[`STATE_${e}`]||"";};const ai=T.env["ProgramFiles(x86)"],ao=[T.env["ProgramFiles(x86)"],T.env.ProgramFiles],as=["Enterprise","Professional","Community"],aa=["2022","2019","2017"],al={2022:"17.0",2019:"16.0",2017:"15.0",2015:"14.0",2013:"12.0"};function ac(e){if(Object.values(al).includes(e));else if(e in al)return al[e];return e;}const au=`${ai}\\Microsoft Visual Studio\\Installer`;function ad(e){let t;let r=ac(e);if(r){let e=r.split(".")[0]+".9";t=`-version "${r},${e}"`;}else t="-latest";// If vswhere is available, ask it about the location of the latest Visual Studio.
|
||||
let n=function(e,t){try{return $.execSync(`vswhere -products * ${t} -prerelease -property installationPath`).toString().trim()+"\\"+e;}catch(e){sY.warning(`vswhere failed: ${e}`);}return null;}("VC\\Auxiliary\\Build\\vcvarsall.bat",t);if(n&&m.existsSync(n))return sY.info(`Found with vswhere: ${n}`),n;sY.info("Not found with vswhere");// If that does not work, try the standard installation locations,
|
||||
// starting with the latest and moving to the oldest.
|
||||
let i=e?[function(e){if(Object.keys(aa).includes(e));else for(let[t,r]of Object.entries(aa))if(r===e)return t;return e;}(e)]:as;for(let e of ai)for(let t of i)for(let r of ao)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sW.info(`Trying standard location: ${n}`),m.existsSync(n))return sW.info(`Found standard location: ${n}`),n;if(sW.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${an}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sW.info(`Found VS 2015: ${n}`),n;throw sW.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sW.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+ac;// There are all sorts of way the architectures are called. In addition to
|
||||
let i=e?[function(e){if(Object.keys(al).includes(e));else for(let[t,r]of Object.entries(al))if(r===e)return t;return e;}(e)]:aa;for(let e of ao)for(let t of i)for(let r of as)if(n=`${e}\\Microsoft Visual Studio\\${t}\\${r}\\VC\\Auxiliary\\Build\\vcvarsall.bat`,sY.info(`Trying standard location: ${n}`),m.existsSync(n))return sY.info(`Found standard location: ${n}`),n;if(sY.info("Not found in standard locations"),// Special case for Visual Studio 2015 (and maybe earlier), try it out too.
|
||||
n=`${ai}\\Microsoft Visual C++ Build Tools\\vcbuildtools.bat`,m.existsSync(n))return sY.info(`Found VS 2015: ${n}`),n;throw sY.info(`Not found in VS 2015 location: ${n}`),Error("Microsoft Visual Studio not found");}d=/** See https://github.com/ilammy/msvc-dev-cmd#inputs */function(e,t,r,n,i,o){if("win32"!=T.platform){sY.info("This is not a Windows virtual environment, bye!");return;}// Add standard location of "vswhere" to PATH, in case it's not there.
|
||||
T.env.PATH+=h.delimiter+au;// There are all sorts of way the architectures are called. In addition to
|
||||
// values supported by Microsoft Visual C++, recognize some common aliases.
|
||||
let s={win32:"x86",win64:"x64",x86_64:"x64","x86-64":"x64"};e.toLowerCase()in s&&(e=s[e.toLowerCase()]);// Due to the way Microsoft Visual C++ is configured, we have to resort to the following hack:
|
||||
// Call the configuration batch file and then output *all* the environment variables.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${au(o)}" ${a.join(" ")}`;sW.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
var a=[e];"true"==n&&a.push("uwp"),t&&a.push(t),r&&a.push(`-vcvars_ver=${r}`),"true"==i&&a.push("-vcvars_spectre_libs=spectre");let l=`"${ad(o)}" ${a.join(" ")}`;sY.debug(`vcvars command-line: ${l}`);let c=$.execSync(`set && cls && ${l} && cls && set`,{shell:"cmd"}).toString(),u=c.split("\f"),d=u[0].split("\r\n"),p=u[1].split("\r\n"),f=u[2].split("\r\n"),m=p.filter(e=>!!e.match(/^\[ERROR.*\]/)&&!e.match(/Error in script usage. The correct usage is:$/));if(m.length>0)throw Error("invalid parameters\r\n"+m.join("\r\n"));// Convert old environment lines into a dictionary for easier lookup.
|
||||
let g={};for(let e of d){let[t,r]=e.split("=");g[t]=r;}for(let e of(// Now look at the new environment and export everything that changed.
|
||||
// These are the variables set by vsvars.bat. Also export everything
|
||||
// that was not there during the first sweep: those are new variables.
|
||||
sW.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
sY.startGroup("Environment variables"),f)){// vsvars.bat likes to print some fluff at the beginning.
|
||||
// Skip lines that don't look like environment variables.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==g[t]&&(sW.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
if(!e.includes("="))continue;let[t,r]=e.split("=");r!==g[t]&&(sY.info(`Setting ${t}`),-1!=["PATH","INCLUDE","LIB","LIBPATH"].indexOf(t.toUpperCase())&&(r=r.split(";").filter(// Remove duplicates by keeping the first occurance and preserving order.
|
||||
// This keeps path shadowing working as intended.
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sW.exportVariable(t,r));}sW.endGroup(),sW.info("Configured Developer Command Prompt");};var K=q("ER74K"),nF=q("dOmbL");async function ad(e,t,r,n,i,o,s){void 0!==t&&(await(0,nF.pathExists)(t))&&((0,K.info)(`Adding ${t} to PATH`),await nG("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class ap extends Error{constructor(e){super(e),this.name="TimeoutError";}}class af extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
function(e,t,r){return r.indexOf(e)===t;}).join(";")),sY.exportVariable(t,r));}sY.endGroup(),sY.info("Configured Developer Command Prompt");};var K=q("ER74K"),nF=q("dOmbL");async function ap(e,t,r,n,i,o,s){void 0!==t&&(await(0,nF.pathExists)(t))&&((0,K.info)(`Adding ${t} to PATH`),await nG("VCTargetsPath",t)),d(function(e){switch(e){case"x32":case"32":case"ia32":return"x86";case"64":return"x64";default:return e;}}(r),i,n,o,s,e);}class af extends Error{constructor(e){super(e),this.name="TimeoutError";}}class ah extends Error{constructor(e){super(),this.name="AbortError",this.message=e;}}/**
|
||||
TODO: Remove AbortError and just throw DOMException when targeting Node 18.
|
||||
*/const ah=e=>void 0===globalThis.DOMException?new af(e):new DOMException(e),am=e=>{let t=void 0===e.reason?ah("This operation was aborted."):e.reason;return t instanceof Error?t:ah(t);};async function ag(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(am(e)),e.addEventListener("abort",()=>{l(am(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new ap();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=o??`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(av(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,K.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function av(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ad(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a3[e];// eslint-disable-next-line no-param-reassign
|
||||
*/const am=e=>void 0===globalThis.DOMException?new ah(e):new DOMException(e),ag=e=>{let t=void 0===e.reason?am("This operation was aborted."):e.reason;return t instanceof Error?t:am(t);};async function av(e,t,r,n,i,o,s,a=12e5// 20 minutes
|
||||
){(0,ry.startGroup)(`Installing ${e} ${t}`);let l=!1;try{l=await function(e,t){let r;let{milliseconds:n,fallback:i,message:o,customTimers:s={setTimeout:setTimeout,clearTimeout:clearTimeout}}=t,a=new Promise((a,l)=>{if("number"!=typeof n||1!==Math.sign(n))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${n}\``);if(t.signal){let{signal:e}=t;e.aborted&&l(ag(e)),e.addEventListener("abort",()=>{l(ag(e));});}if(n===Number.POSITIVE_INFINITY){e.then(a,l);return;}// We create the error outside of `setTimeout` to preserve the stack trace.
|
||||
let c=new af();r=s.setTimeout.call(void 0,()=>{if(i){try{a(i());}catch(e){l(e);}return;}"function"==typeof e.cancel&&e.cancel(),!1===o?a():o instanceof Error?l(o):(c.message=o??`Promise timed out after ${n} milliseconds`,l(c));},n),(async()=>{try{a(await e);}catch(e){l(e);}})();}),l=a.finally(()=>{l.clear();});return l.clear=()=>{s.clearTimeout.call(void 0,r),r=void 0;},l;}(ay(e,t,r,n,l,i,o),{milliseconds:a,message:`Timeout while installing ${e} ${t}. You can increase the timeout from options`});}catch(t){// push error message to the logger
|
||||
(0,K.error)(t),s.push(`${e} failed to install`);}return(0,ry.endGroup)(),l;}async function ay(e,t,r,n,i,o,s){let a;if("vcvarsall"===e)await ap(su(e,t,r),void 0,n,void 0,void 0,!1,!1);else{// get the setup function
|
||||
let s=a6[e];// eslint-disable-next-line no-param-reassign
|
||||
i=["llvm","clangformat","clangtidy"].includes(e);// the tool installation directory (for the functions that ue it)
|
||||
let l=(0,iP.join)(o,i?"llvm":e);// eslint-disable-next-line no-await-in-loop
|
||||
a=await s(su(e,t,r),l,n);}return(// preparing a report string
|
||||
s.push(a8(e,a)),i);}const{readFile:ay,writeFile:aw,chmod:ax}=m.promises;async function aE(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await ab("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await ax("/tmp/llvm-setup-cpp.sh","755"),await t5("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nV(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function ab(e,t){var r,n;let i=await ay(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await aS(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await aw(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function aS(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,M.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=q("1ndHP"),K=q("ER74K"),iP=q("ceI0e");const a$=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),a_=new Set(["10.0.1","15.0.5","15.0.6"]),aO=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
s.push(a7(e,a)),i);}const{readFile:aw,writeFile:ax,chmod:aE}=m.promises;async function ab(e){// TODO for older versions, this also includes the minor version
|
||||
let t=`/usr/lib/llvm-${e}`;await ix([{name:"curl"}]),await nI("curl",["-LJO","https://apt.llvm.org/llvm.sh"],{cwd:"/tmp"});let r=await aS("/tmp/llvm.sh","/tmp/llvm-setup-cpp.sh");return await ix(r),await aE("/tmp/llvm-setup-cpp.sh","755"),await t5("bash",["/tmp/llvm-setup-cpp.sh",`${e}`,"all"],{stdio:"inherit",shell:!0,timeout:12e5}),await nV(`${t}/bin`),{installDir:`${t}`,binDir:`${t}/bin`,bin:`${t}/bin/clang++`};}async function aS(e,t){var r,n;let i=await aw(e,"utf-8");// the packages needed by the script
|
||||
return i=(r=i,i=process.env.NODE_DEBUG?r:r.replace(/set -eux/g,"set -eu")).replace(/add-apt-repository "\${REPO_NAME}"/g,'add-apt-repository -y "${REPO_NAME}"'),n=i=await a$(i),i=// use nala if it is available
|
||||
iS()?n.replace(/apt-get/g,"nala"):n,await ax(t,i),[{name:"lsb-release"},{name:"wget"},{name:"software-properties-common"},{name:"gnupg"}];}async function a$(e){// fix conflicts between libclang-rt and libclang
|
||||
let t=e.replace(/apt-get install -y/g,'apt-get install -o Dpkg::Options::="--force-overwrite" -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 iR(r))&&((0,M.info)(`Removing conflicting package ${r}`),t=t.replace(e,""));})),t;}var o$=q("1ndHP"),K=q("ER74K"),iP=q("ceI0e");const a_=function(e){let t=new Set(e);for(let r of e)t.add(/^\d+/.exec(r)[0]),t.add(/^\d+\.\d+/.exec(r)[0]);return t;}(["3.5.0","3.5.1","3.5.2","3.6.0","3.6.1","3.6.2","3.7.0","3.7.1","3.8.0","3.8.1","3.9.0","3.9.1","4.0.0","4.0.1","5.0.0","5.0.1","5.0.2","6.0.0","6.0.1","7.0.0","7.0.1","7.1.0","8.0.0","8.0.1","9.0.0","9.0.1","10.0.0","10.0.1","11.0.0","11.0.1","11.1.0","12.0.0","12.0.1","13.0.0","13.0.1","14.0.0","14.0.1","14.0.2","14.0.3","14.0.4","14.0.5","14.0.6","15.0.0","15.0.1","15.0.2","15.0.3","15.0.4","15.0.5","15.0.6","15.0.7","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aO=new Set(["10.0.1","15.0.5","15.0.6"]),aC=new Set(["3.5.1","3.6.1","3.6.2","3.7.1","3.8.1","3.9.1","6.0.1","7.0.1","7.1.0","8.0.1","11.0.1","11.1.0","12.0.1",// missing x86_64
|
||||
// TODO add arm64 support
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aC=new Map(),aI={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aT="16.0.4";//================================================
|
||||
"15.0.4","15.0.5","15.0.6","16.0.0","16.0.1","16.0.2","16.0.3","16.0.4","16.0.5","16.0.6"]),aI=new Map(),aT={"3.5.0":"-ubuntu-14.04","3.5.1":"","3.5.2":"-ubuntu-14.04","3.6.0":"-ubuntu-14.04","3.6.1":"-ubuntu-14.04","3.6.2":"-ubuntu-14.04","3.7.0":"-ubuntu-14.04","3.7.1":"-ubuntu-14.04","3.8.0":"-ubuntu-16.04","3.8.1":"-ubuntu-16.04","3.9.0":"-ubuntu-16.04","3.9.1":"-ubuntu-16.04","4.0.0":"-ubuntu-16.04","5.0.0":"-ubuntu16.04","5.0.1":"-ubuntu-16.04","5.0.2":"-ubuntu-16.04","6.0.0":"-ubuntu-16.04","6.0.1":"-ubuntu-16.04","7.0.0":"-ubuntu-16.04","7.0.1":"-ubuntu-18.04","7.1.0":"-ubuntu-14.04","8.0.0":"-ubuntu-18.04","9.0.0":"-ubuntu-18.04","9.0.1":"-ubuntu-16.04","10.0.0":"-ubuntu-18.04","10.0.1":"-ubuntu-16.04","11.0.0":"-ubuntu-20.04","11.0.1":"-ubuntu-16.04","11.1.0":"-ubuntu-16.04","12.0.0":"-ubuntu-20.04","12.0.1":"-ubuntu-16.04","13.0.0":"-ubuntu-20.04","13.0.0-ubuntu-16.04":"-ubuntu-16.04","13.0.0-ubuntu-20.04":"-ubuntu-20.04","13.0.1":"-ubuntu-18.04","13.0.1-ubuntu-18.04":"-ubuntu-18.04","14.0.0":"-ubuntu-18.04",// "14.0.1": "-ubuntu-18.04", // only available for powerpc64le
|
||||
"15.0.2":"-rhel86","15.0.5":"-ubuntu-18.04","15.0.6":"-ubuntu-18.04","16.0.0":"-ubuntu-18.04","16.0.2":"-ubuntu-22.04","16.0.3":"-ubuntu-22.04","16.0.4":"-ubuntu-22.04"},aR="16.0.4";//================================================
|
||||
// URL
|
||||
//================================================
|
||||
/** Gets a LLVM download URL for GitHub. */function aR(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aP(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aA(e){let t;if(a_.has(e))return null;let r="LLVM-",n=/*@__PURE__*/B(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/B(o$)(e,"9.0.1"),o=!1;return i&&(t=aP(e,r,n),(await oz(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aR(e,r,n)),t;}function aN(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(aO.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/B(o$)(e,"9.0.1")?aP(e,r,n):aR(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aC.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!a$.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oJ(a$,e)[0];}else""!==n&&n in aI?t=aI[n]:(// default to the maximum version
|
||||
t=aI[aT],(0,K.warning)(`Falling back to LLVM version ${aT} ${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`,/*@__PURE__*/B(o$)(n,"9.0.1"))?aP(n,o,r):aR(n,o,r);}(t);case"win32":return aA(t);default:return null;}}async function aL(e,t,r){let[n,i]=await oQ(a$,t,e,aN);return(0,K.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iP.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var ak=h.resolve(__dirname,"../../src/llvm");async function aD(e,t,r){let n=await aj(e,t,r);return await aq(n.installDir??t),n;}async function aU(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aF(e,t,r),aV(r),aX()]);return n;}const aj=oq(aU,{isPromise:!0});function aM(e,t,r){return aF(e,t,r);}async function aF(e,t,r){let n=function(e){if(null===/*@__PURE__*/B(oY)(e))try{// find the semver version of an integer
|
||||
/** Gets a LLVM download URL for GitHub. */function aP(e,t,r){let n=`${t}${e}${r}`;return`https://github.com/llvm/llvm-project/releases/download/llvmorg-${e}/${n}`;}/** Gets a LLVM download URL for https://releases.llvm.org. */function aA(e,t,r){let n=`${t}${e}${r}`;return`https://releases.llvm.org/${e}/${n}`;}/** Gets an LLVM download URL for the Windows platform. */async function aN(e){let t;if(aO.has(e))return null;let r="LLVM-",n=/*@__PURE__*/B(o$)(e,"3.7.0")?"-win32.exe":"-win64.exe",i=/*@__PURE__*/B(o$)(e,"9.0.1"),o=!1;return i&&(t=aA(e,r,n),(await oz(t))||(o=!0// fallback to github
|
||||
)),(o||!i)&&(t=aP(e,r,n)),t;}function aL(e,t){switch(e){case"darwin":return(/** Gets an LLVM download URL for the Darwin platform. */function(e){if(aC.has(e))return null;let t="9.0.0"===e?"-darwin-apple":"-apple-darwin",r="clang+llvm-",n=`-x86_64${t}.tar.xz`;return/*@__PURE__*/B(o$)(e,"9.0.1")?aA(e,r,n):aP(e,r,n);}(t));case"linux":return function(e){let t,r,n=e,i=aI.get(n);// ubuntu-version is specified
|
||||
if(void 0!==i&&(n=i),n.includes("ubuntu")){let e=n.replace(/-ubuntu-.*/,"");if(!a_.has(e))throw Error(`Unsupported Ubuntu version: ${e}`);t=n.replace(e,""),n=oJ(a_,e)[0];}else""!==n&&n in aT?t=aT[n]:(// default to the maximum version
|
||||
t=aT[aR],(0,K.warning)(`Falling back to LLVM version ${aR} ${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`,/*@__PURE__*/B(o$)(n,"9.0.1"))?aA(n,o,r):aP(n,o,r);}(t);case"win32":return aN(t);default:return null;}}async function ak(e,t,r){let[n,i]=await oQ(a_,t,e,aL);return(0,K.info)(`specific llvm version: ${n}`),{url:i,extractedFolderName:"",binRelativeDir:"bin",binFileName:(0,iP.addExeExt)("clang"),extractFunction:"win32"===t?oL:(e,t)=>oD(e,t,["--strip-components=1"])};}var aD=h.resolve(__dirname,"../../src/llvm");async function aU(e,t,r){let n=await aM(e,t,r);return await aX(n.installDir??t),n;}async function aj(e,t,r){// install LLVM and its dependencies in parallel
|
||||
let[n,i,o]=await Promise.all([aB(e,t,r),aq(r),aK()]);return n;}const aM=oq(aj,{isPromise:!0});function aF(e,t,r){return aB(e,t,r);}async function aB(e,t,r){let n=function(e){if(null===/*@__PURE__*/B(oY)(e))try{// find the semver version of an integer
|
||||
let t=/*@__PURE__*/B(o_)(e);if(null!==t)return(0,K.info)(`Coerced version '${e}' to '${t}'`),t.version;}catch(e){// handled below
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iV())return await aE(i);}catch(e){(0,K.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,aL,t,r);return await aG(i),o;}async function aB(e){iV()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aG=oq(aB,{isPromise:!0});async function aH(e){"linux"===process.platform&&(await sD(su("gcc",void 0,await sm()),"",e));}const aV=oq(aH,{isPromise:!0});async function aq(e){let t=process.env.LD_LIBRARY_PATH??"",r=process.env.DYLD_LIBRARY_PATH??"",n=[nG("LLVM_PATH",e),nG("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${t}`),nG("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${r}`),nG("LDFLAGS",`-L"${e}/lib"`),nG("CPPFLAGS",`-I"${e}/include"`),nG("CC",(0,iP.addExeExt)(`${e}/bin/clang`)),nG("CXX",(0,iP.addExeExt)(`${e}/bin/clang++`)),nG("LIBRARY_PATH",`${e}/lib`),sA()];iV()&&n.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(n);}async function aX(){if(X.GITHUB_ACTIONS){let e=(0,iP.join)(ak,"llvm_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}}async function aK(e,t,r){switch(process.platform){case"win32":return iM("make",e);case"darwin":return await iD("make",e),await nV("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iF())return iz("make",e);if(iB())return iG([{name:"make",version:e}]);if(iV())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var X=q("dTX7a"),iP=q("ceI0e"),K=q("ER74K"),nF=q("dOmbL"),az=h.resolve(__dirname,"../../src/msvc");async function aW(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=al(e);// check if the given version is already installed
|
||||
(0,K.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=au(l);c=!0,(0,K.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}return e;}(e),i=parseInt(n.split(".")[0],10);try{if(iV())return await ab(i);}catch(e){(0,K.info)(`Failed to install llvm via system package manager ${e}`);}let o=await oR("llvm",e,ak,t,r);return await aH(i),o;}async function aG(e){iV()&&(e<=10?await ix([{name:"libtinfo5"}]):await ix([{name:"libtinfo-dev"}]));}const aH=oq(aG,{isPromise:!0});async function aV(e){"linux"===process.platform&&(await sU(su("gcc",void 0,await sm()),"",e));}const aq=oq(aV,{isPromise:!0});async function aX(e){let t=process.env.LD_LIBRARY_PATH??"",r=process.env.DYLD_LIBRARY_PATH??"",n=[nG("LLVM_PATH",e),nG("LD_LIBRARY_PATH",`${e}/lib${h.delimiter}${t}`),nG("DYLD_LIBRARY_PATH",`${e}/lib${h.delimiter}${r}`),nG("LDFLAGS",`-L"${e}/lib"`),nG("CPPFLAGS",`-I"${e}/include"`),nG("CC",(0,iP.addExeExt)(`${e}/bin/clang`)),nG("CXX",(0,iP.addExeExt)(`${e}/bin/clang++`)),nG("LIBRARY_PATH",`${e}/lib`),sN()];iV()&&n.push(iT("cc",`${e}/bin/clang`),iT("cxx",`${e}/bin/clang++`),iT("clang",`${e}/bin/clang`),iT("clang++",`${e}/bin/clang++`),iT("lld",`${e}/bin/lld`),iT("ld.lld",`${e}/bin/ld.lld`),iT("llvm-ar",`${e}/bin/llvm-ar`)),await Promise.all(n);}async function aK(){if(X.GITHUB_ACTIONS){let e=(0,iP.join)(aD,"llvm_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the llvm_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}}async function az(e,t,r){switch(process.platform){case"win32":return iM("make",e);case"darwin":return await iD("make",e),await nV("/usr/local/opt/make/libexec/gnubin"),{binDir:"/usr/local/opt/make/libexec/gnubin"};case"linux":if(iF())return iz("make",e);if(iB())return iG([{name:"make",version:e}]);if(iV())return ix([{name:"make",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var X=q("dTX7a"),iP=q("ceI0e"),K=q("ER74K"),nF=q("dOmbL"),aW=h.resolve(__dirname,"../../src/msvc");async function aY(e,t,r,n,i,o){let s,a;if("win32"!==process.platform)return;let l=ac(e);// check if the given version is already installed
|
||||
(0,K.info)(`Checking if MSVC ${l} is already installed`);let c=!1;try{let e=ad(l);c=!0,(0,K.info)(`Found the pre-installed version of MSVC at ${e}`);}catch{// not installed, try installing
|
||||
}// https://github.com/aminya/setup-cpp/issues/1
|
||||
if(!c)try{"14.0"===l?(s="14.0",await iM("visualcpp-build-tools","14.0.25420.1",["--ignore-dependencies"]),a="C:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/v140"):"15.0"===l?(s="14.16",await iM("visualstudio2017buildtools","15.9.41.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16"// TODO verify path
|
||||
):"16.0"===l?(s="14.29",await iM("visualstudio2019buildtools","16.11.7.0",[]),a="C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133"):"17.0"===l?(s=void 0,await iM("visualstudio2022buildtools","117.0.5.0",[]),a=void 0):(0,K.error)(`The given MSVC versions ${e} is not supported yet.`);}catch(e){(0,K.error)(e);}// run vcvarsall.bat environment variables
|
||||
await ad(l,a,r,s,n,i,o),X.GITHUB_ACTIONS&&(await aY());}async function aY(){let e=(0,iP.join)(az,"msvc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}async function aJ(e,t,r){if(!iV())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/B(nQ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iP.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
await ap(l,a,r,s,n,i,o),X.GITHUB_ACTIONS&&(await aJ());}async function aJ(){let e=(0,iP.join)(aW,"msvc_matcher.json");if(!(await(0,nF.pathExists)(e)))return(0,K.warning)("the msvc_matcher.json file does not exist in the same folder as setup-cpp.js");(0,K.info)(`::add-matcher::${e}`);}async function aQ(e,t,r){if(!iV())return;if("string"==typeof i)return{binDir:i};let n=/*@__PURE__*/B(nQ).sync("nala",{nothrow:!0});if(null!==n)return{binDir:i=(0,iP.dirname)(n)};// https://github.com/volitank/nala#-installation
|
||||
let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian/scar.key");t6("/bin/bash",["-c",`echo "deb [signed-by=${o}] http://deb.volian.org/volian/ scar main" | tee /etc/apt/sources.list.d/volian-archive-scar-unstable.list`]);try{"legacy"!==e?await ix([{name:"nala"}],!0):await ix([{name:"nala-legacy"}],!0);}catch(e){await ix([{name:"nala-legacy"}],!0);}return{binDir:i="/usr/bin"// eslint-disable-line require-atomic-updates
|
||||
};}async function aQ(e,t,r){if("win32"!==process.platform)return;await iM("opencppcoverage",e);let n=await aZ();return{binDir:n};}async function aZ(){let e="C:/Program Files/OpenCppCoverage";return await nV(e),e;}async function a0(e,t,r){switch(process.platform){case"win32":{await iM("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nV(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iF())return iz("powershell-bin",e,"yay");if(iB())return iG([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iG([{name:"powershell",version:e}]);if(iV()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
};}async function aZ(e,t,r){if("win32"!==process.platform)return;await iM("opencppcoverage",e);let n=await a0();return{binDir:n};}async function a0(){let e="C:/Program Files/OpenCppCoverage";return await nV(e),e;}async function a1(e,t,r){switch(process.platform){case"win32":{await iM("powershell-core",e);let t="C:/Program Files/PowerShell/7";return await nV(t),{binDir:t};}case"darwin":return iD("powershell",e,["--cask"]);case"linux":if(iF())return iz("powershell-bin",e,"yay");if(iB())return iG([{name:"curl"}]),t6("/bin/bash",["-c","curl https://packages.microsoft.com/config/rhel/8/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo"]),iG([{name:"powershell",version:e}]);if(iV()){await ix([{name:"curl"}]);let t=await sm(),r=`${t[0]}.0${t[1]}`;// TODO Debian
|
||||
// const keyFileName = await addAptKeyViaDownload(
|
||||
// "microsoft.asc",
|
||||
// "https://packages.microsoft.com/keys/microsoft.asc"
|
||||
|
@ -1442,15 +1442,15 @@ let o=await iI("volian-archive-scar-unstable.gpg","https://deb.volian.org/volian
|
|||
// "-c",
|
||||
// `echo "deb [arch=amd64 signed-by=${keyFileName}] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list`,
|
||||
// ])
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iP=(q("ceI0e"),q("ceI0e"));/** Get the platform data for task */function a1(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var K=q("ER74K"),nF=q("dOmbL"),iP=q("ceI0e");let a2=!1;async function a4(e,t,r){return a2&&null!==/*@__PURE__*/B(nQ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iP.dirname)(/*@__PURE__*/B(nQ).sync("vcpkg"))}:("linux"===process.platform&&(iF()?await Promise.all([iz("curl"),iz("zip"),iz("unzip"),iz("tar"),iz("git"),iz("pkg-config")]):iB()?await iG([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iV()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nF.pathExists)((0,iP.join)(t,(0,iP.addShExt)("bootstrap-vcpkg",".bat"))))?(0,K.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iP.dirname)(t),stdio:"inherit"}),nT((0,iP.addShExt)((0,iP.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nV(t),// eslint-disable-next-line require-atomic-updates
|
||||
a2=!0,{binDir:t});}const a3={nala:aJ,cmake:oj,ninja:sG,python:o5,vcpkg:a4,bazel:iq,conan:function(e,t,r){return sv("conan",e);},meson:function(e,t,r){return sv("meson",e);},gcovr:function(e,t,r){return sv("gcovr",e);},opencppcoverage:aQ,llvm:aD,gcc:sD,choco:iU,brew:iN,powershell:a0,ccache:function(e,t,r){switch(process.platform){case"win32":return iM("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iF())return iz("ccache",e);if(iB())return iG([{name:"ccache",version:e}]);if(iV())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iM("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sT,graphviz:sO,cppcheck:s$,clangtidy:aM,clangformat:aM,msvc:aW,vcvarsall:ad,kcov:sz,make:aK,task:function(e,t,r){return oR("task",e,a1,t,r);},sevenzip:oP},a6=Object.keys(a3),a5=["compiler","architecture","timeout",...a6];function a8(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
return t6("curl",["-LJO",`https://packages.microsoft.com/config/ubuntu/${r}/packages-microsoft-prod.deb`]),t6("dpkg",["-i","packages-microsoft-prod.deb"]),ix([{name:"powershell",version:e}],!0);}throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}}var iP=(q("ceI0e"),q("ceI0e"));/** Get the platform data for task */function a2(e,t,r){let n=/** Get the arch name task uses in their download links */function(e){switch(e){case"x64":return"amd64";case"ia32":case"x86":case"i386":case"x32":return"386";default:return e;}}(r),i="win32"===t;return{binRelativeDir:"",binFileName:(0,iP.addExeExt)("task"),extractedFolderName:"",extractFunction:i?ok:oD,url:`https://github.com/go-task/task/releases/download/v${e}/task_${"win32"===t?"windows":t}_${n}.${i?"zip":"tar.gz"}`};}var K=q("ER74K"),nF=q("dOmbL"),iP=q("ceI0e");let a4=!1;async function a3(e,t,r){return a4&&null!==/*@__PURE__*/B(nQ).sync("vcpkg",{nothrow:!0})?{binDir:(0,iP.dirname)(/*@__PURE__*/B(nQ).sync("vcpkg"))}:("linux"===process.platform&&(iF()?await Promise.all([iz("curl"),iz("zip"),iz("unzip"),iz("tar"),iz("git"),iz("pkg-config")]):iB()?await iG([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]):iV()&&(await ix([{name:"curl"},{name:"zip"},{name:"unzip"},{name:"tar"},{name:"git"},{name:"pkg-config"}]))),(await(0,nF.pathExists)((0,iP.join)(t,(0,iP.addShExt)("bootstrap-vcpkg",".bat"))))?(0,K.notice)(`Vcpkg folder already exists at ${t}. This might mean that ~/vcpkg is restored from the cache.`):nT("git",["clone","https://github.com/microsoft/vcpkg"],{cwd:(0,iP.dirname)(t),stdio:"inherit"}),nT((0,iP.addShExt)((0,iP.addShRelativePrefix)("bootstrap-vcpkg"),".bat"),{cwd:t,shell:!0,stdio:"inherit"}),nj(t),await nV(t),// eslint-disable-next-line require-atomic-updates
|
||||
a4=!0,{binDir:t});}const a6={nala:aQ,cmake:oj,ninja:sH,python:o5,vcpkg:a3,bazel:iq,conan:function(e,t,r){return sv("conan",e);},meson:function(e,t,r){return sv("meson",e);},gcovr:function(e,t,r){return sv("gcovr",e);},opencppcoverage:aZ,llvm:aU,gcc:sU,choco:iU,brew:iN,powershell:a1,ccache:function(e,t,r){switch(process.platform){case"win32":return iM("ccache",e);case"darwin":return iD("ccache",e);case"linux":if(iF())return iz("ccache",e);if(iB())return iG([{name:"ccache",version:e}]);if(iV())return ix([{name:"ccache",version:e}]);throw Error("Unsupported linux distribution");default:throw Error("Unsupported platform");}},sccache:function(e,t,r){switch(process.platform){case"win32":return iM("sccache",e);case"linux":case"darwin":return iD("sccache",e);default:throw Error("Unsupported platform");}},doxygen:sR,graphviz:sC,cppcheck:s_,clangtidy:aF,clangformat:aF,msvc:aY,vcvarsall:ap,kcov:sW,make:az,task:function(e,t,r){return oR("task",e,a2,t,r);},sevenzip:oP},a5=Object.keys(a6),a8=["compiler","architecture","timeout",...a5];function a7(e,t){let r=`✅ ${e} was installed successfully:`;return void 0===t||("installDir"in t&&(r+=`
|
||||
- The installation directory is ${t.installDir}`),""!==t.binDir&&(r+=`
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=q("lcRzN"),K=q("ER74K"),oY=q("eJTZB");async function a7(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/B(oY)(e)||(0,K.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${l??""}`),a){case"llvm":case"clang":case"clang++":{let e=await aD(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nG("GCOV","llvm-cov gcov"),i.push(a8("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sU(e,(0,h.join)(r,"gcc"),n):await sD(e,(0,h.join)(r,"gcc"),n);o&&(await nG("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/B(oY)(e),r=null!==t?/*@__PURE__*/B(sP)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nG("GCOV",n);}(e),i.push(a8("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aW(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nG("CPPFLAGS","")),i.push(a8("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nG("CC","clang"),nG("CXX","clang++")]),i.push(a8("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,K.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
- The binary directory is ${t.binDir}`)),r;}var ry=q("lcRzN"),K=q("ER74K"),oY=q("eJTZB");async function a9(e,t,r,n,i,o,s){try{let{compiler:a,version:l}=function(e){let t=e.split("-"),r=t[0];if(1 in t){let e=t[1];return null!==/*@__PURE__*/B(oY)(e)||(0,K.info)(`Invalid semver version ${e} used for the compiler.`),{compiler:r,version:e};}return{compiler:r,version:void 0};}(e);switch(// install the compiler. We allow some aliases for the compiler name
|
||||
(0,ry.startGroup)(`Installing ${a} ${l??""}`),a){case"llvm":case"clang":case"clang++":{let e=await aU(su("llvm",l,t),(0,h.join)(r,"llvm"),n);await nG("GCOV","llvm-cov gcov"),i.push(a7("llvm",e));break;}case"gcc":case"mingw":case"cygwin":case"msys":{let e="mingw"===a?su("mingw",l,t):su("gcc",l,t),s="mingw"===a?await sj(e,(0,h.join)(r,"gcc"),n):await sU(e,(0,h.join)(r,"gcc"),n);o&&(await nG("CPPFLAGS","")),await function(e){let t=/*@__PURE__*/B(oY)(e),r=null!==t?/*@__PURE__*/B(sA)(t):e,n=""!==r?`gcov-${r}`:"gcov";return nG("GCOV",n);}(e),i.push(a7("gcc",s));break;}case"cl":case"msvc":case"msbuild":case"vs":case"visualstudio":case"visualcpp":case"visualc++":{let e=await aY(su("msvc",l,t),(0,h.join)(r,"msvc"),n);o&&(await nG("CPPFLAGS","")),i.push(a7("msvc",e));break;}case"appleclang":case"applellvm":(0,ry.notice)("Assuming apple-clang is already installed"),await Promise.all([nG("CC","clang"),nG("CXX","clang++")]),i.push(a7("apple-clang",void 0));break;default:s.push(`Unsupported compiler ${a}`);}}catch(t){(0,K.error)(t),s.push(`Failed to install the ${e}`);}(0,ry.endGroup)();}// Run main
|
||||
/** The main entry function */(async function(e){let t,r,n=Promise.resolve();X.GITHUB_ACTIONS||(n=rv(),process.env.ACTIONS_ALLOW_UNSECURE_COMMANDS="true");// parse options using mri or github actions
|
||||
let i=function(e,t){t=t||{};var r,n,i,o,s,a={_:[]},l=0,c=0,u=0,d=(e=e||[]).length;let p=void 0!==t.alias,f=void 0!==t.unknown,h=void 0!==t.default;if(t.alias=t.alias||{},t.string=rw(t.string),t.boolean=rw(t.boolean),p)for(r in t.alias)for(l=0,n=t.alias[r]=rw(t.alias[r]);l<n.length;l++)(t.alias[n[l]]=n.concat(r)).splice(l,1);for(l=t.boolean.length;l-->0;)for(c=(n=t.alias[t.boolean[l]]||[]).length;c-->0;)t.boolean.push(n[c]);for(l=t.string.length;l-->0;)for(c=(n=t.alias[t.string[l]]||[]).length;c-->0;)t.string.push(n[c]);if(h){for(r in t.default)if(o=typeof t.default[r],n=t.alias[r]=t.alias[r]||[],void 0!==t[o])for(t[o].push(r),l=0;l<n.length;l++)t[o].push(n[l]);}let m=f?Object.keys(t.alias):[];for(l=0;l<d;l++){if("--"===(i=e[l])){a._=a._.concat(e.slice(++l));break;}for(c=0;c<i.length&&45===i.charCodeAt(c)// "-"
|
||||
;c++);if(0===c)a._.push(i);else if("no-"===i.substring(c,c+3)){if(o=i.substring(c+3),f&&!~m.indexOf(o))return t.unknown(i);a[o]=!1;}else{for(u=c+1;u<i.length&&61!==i.charCodeAt(u)// "="
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a5,"timeout"],default:Object.fromEntries(a5.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});i.help&&((0,K.info)(`
|
||||
;u++);for(o=i.substring(c,u),s=i.substring(++u)||l+1===d||45===(""+e[l+1]).charCodeAt(0)||e[++l],n=2===c?[o]:o,u=0;u<n.length;u++){if(o=n[u],f&&!~m.indexOf(o))return t.unknown("-".repeat(c)+o);!function(e,t,r,n){var i,o=e[t],s=~n.string.indexOf(t)?null==r||!0===r?"":String(r):"boolean"==typeof r?r:~n.boolean.indexOf(t)?"false"!==r&&("true"===r||(e._.push(0*(i=+r)==0?i:r),!!r)):0*(i=+r)==0?i:r;e[t]=null==o?s:Array.isArray(o)?o.concat(s):[o,s];}(a,o,u+1<n.length||s,t);}}}if(h)for(r in t.default)void 0===a[r]&&(a[r]=t.default[r]);if(p)for(r in a)for(n=t.alias[r]||[];n.length>0;)a[n.shift()]=a[r];return a;}(e,{string:[...a8,"timeout"],default:Object.fromEntries(a8.map(e=>[e,function(e){let t=(0,ry.getInput)(e.toLowerCase());if("false"!==t&&""!==t)return t;}(e)])),alias:{h:"help"},boolean:"help"});i.help&&((0,K.info)(`
|
||||
setup-cpp [options]
|
||||
setup-cpp --compiler llvm --cmake true --ninja true --ccache true --vcpkg true
|
||||
|
||||
|
@ -1466,12 +1466,12 @@ 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:"--cppcache, --sccache"},documentation:{tools:"--doxygen, --graphviz"},coverage:{tools:"--gcovr, --opencppcoverage, --kcov"},other:{tools:"--python, --powershell, --sevenzip"}},["tools"]));// cpu architecture
|
||||
let o=i.architecture??process.arch,s=process.env.SETUP_CPP_DIR??t8(""),a=[],l=[],c=Y.create({autoloadLocales:!0});Y.addLocale(/*@__PURE__*/B(J)),z.addLocale(/*@__PURE__*/B(W));// installing the specified tools
|
||||
let u=await sm();// sync the version for the llvm tools
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(i,["llvm","clangtidy","clangformat"]))return(0,K.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iF()&&"string"==typeof i.cppcheck&&"string"==typeof i.gcovr&&((0,K.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iz("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let d=!1,p=!1;for(let e of a6){// fail fast inside CI when any tool fails
|
||||
if(!function(e,t){let r=t.filter(t=>void 0!==e[t]),n=r.filter(t=>!sd(e[t])),i=n.length>=1?e[n[0]]:"true";return!n.some(t=>e[t]!==i)&&(r.forEach(t=>{e[t]=i;}),!0);}(i,["llvm","clangtidy","clangformat"]))return(0,K.error)("The same version must be used for llvm, clangformat and clangtidy"),1;iF()&&"string"==typeof i.cppcheck&&"string"==typeof i.gcovr&&((0,K.info)("installing python-pygments to avoid conflicts with cppcheck and gcovr on Arch linux"),await iz("python-pygments"));/** Used to unset CPPFLAGS of LLVM when other compilers are used as the main compiler */let d=!1,p=!1;for(let e of a5){// fail fast inside CI when any tool fails
|
||||
if(X.isCI&&0!==l.length){p=!0;break;}// get the version or "true" or undefined for this tool from the options
|
||||
let n=i[e];void 0!==n&&(// running the setup function for this tool
|
||||
t=Date.now(),// eslint-disable-next-line no-await-in-loop
|
||||
d=await ag(e,n,u,o,s,a,l,6e4*parseFloat(i.timeout??"20")),r=Date.now(),(0,K.info)(`took ${c.format(t,r)||"0 seconds"}`));}if(!p){// installing the specified compiler
|
||||
let e=i.compiler;if(void 0!==e){let t=Date.now();await a7(e,u,s,o,a,d,l);let r=Date.now();(0,K.info)(`took ${c.format(t,r)||"0 seconds"}`);}}if(await nY(),0===a.length&&0===l.length)return(0,K.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
d=await av(e,n,u,o,s,a,l,6e4*parseFloat(i.timeout??"20")),r=Date.now(),(0,K.info)(`took ${c.format(t,r)||"0 seconds"}`));}if(!p){// installing the specified compiler
|
||||
let e=i.compiler;if(void 0!==e){let t=Date.now();await a9(e,u,s,o,a,d,l);let r=Date.now();(0,K.info)(`took ${c.format(t,r)||"0 seconds"}`);}}if(await nY(),0===a.length&&0===l.length)return(0,K.warning)("setup-cpp was called without any arguments. Nothing to do."),0;if(// report the messages in the end
|
||||
a.forEach(e=>(0,K.success)(e)),l.forEach(e=>(0,K.error)(e)),(0,K.info)("setup-cpp finished"),!X.GITHUB_ACTIONS)switch(process.platform){case"win32":(0,K.warning)("Run `RefreshEnv.cmd` or restart your shell to update the environment.");break;case"linux":case"darwin":(0,K.warning)("Run `source ~/.cpprc` or restart your shell to update the environment.");}return await n,0===l.length?0:1;// exit with non-zero if any error message
|
||||
})(process.argv).then(e=>{process.exitCode=e;}).catch(e=>{(0,K.error)("main() panicked!"),(0,K.error)(e),process.exitCode=1;});
|
||||
//# sourceMappingURL=setup-cpp.js.map
|
File diff suppressed because one or more lines are too long
|
@ -47,6 +47,7 @@ async function setupPipx(foundPython: string) {
|
|||
await setupPipPackWithPython(foundPython, "pipx", undefined, { upgrade: true, usePipx: false })
|
||||
}
|
||||
await execa(foundPython, ["-m", "pipx", "ensurepath"], { stdio: "inherit" })
|
||||
await setupPipPackWithPython(foundPython, "venv", undefined, { upgrade: false, usePipx: false })
|
||||
} catch (err) {
|
||||
warning(`Failed to install pipx: ${(err as Error).toString()}. Ignoring...`)
|
||||
}
|
||||
|
|
|
@ -54,9 +54,16 @@ export async function setupPipPackWithPython(
|
|||
const upgradeFlag = upgrade ? (isPipx ? ["upgrade"] : ["install", "--upgrade"]) : ["install"]
|
||||
const userFlag = !isPipx && user ? ["--user"] : []
|
||||
|
||||
execaSync(givenPython, ["-m", pip, ...upgradeFlag, ...userFlag, nameAndVersion], {
|
||||
stdio: "inherit",
|
||||
})
|
||||
const hasPackage = await pipHasPackage(givenPython, name)
|
||||
if (hasPackage) {
|
||||
execaSync(givenPython, ["-m", pip, ...upgradeFlag, ...userFlag, nameAndVersion], {
|
||||
stdio: "inherit",
|
||||
})
|
||||
} else {
|
||||
if ((await setupPipPackSystem(name)) === null) {
|
||||
throw new Error(`Failed to install ${name}.`)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
info(`Failed to install ${name} via ${pip}: ${err}.`)
|
||||
if ((await setupPipPackSystem(name)) === null) {
|
||||
|
@ -85,6 +92,11 @@ async function getPython_raw(): Promise<string> {
|
|||
}
|
||||
const getPython = memoize(getPython_raw)
|
||||
|
||||
async function pipHasPackage(python: string, name: string) {
|
||||
const result = await execa(python, ["-m", "pip", "show", name], { stdio: "ignore", reject: false })
|
||||
return result.exitCode === 0
|
||||
}
|
||||
|
||||
async function findBinDir(dirs: string[], name: string) {
|
||||
const exists = await Promise.all(dirs.map((dir) => pathExists(join(dir, addExeExt(name)))))
|
||||
const dirIndex = exists.findIndex((exist) => exist)
|
||||
|
|
Loading…
Reference in New Issue