From fd35d36d9ca63f4e4f7eadc692c85f8468b7bea3 Mon Sep 17 00:00:00 2001 From: Benjamin O Date: Wed, 15 Apr 2020 12:13:40 -0400 Subject: [PATCH] Built v2.6.1 --- lib/main.js | 161 +++++++++++++++++++++++++++------------------------- 1 file changed, 84 insertions(+), 77 deletions(-) diff --git a/lib/main.js b/lib/main.js index 49fc7f45..4b68eef8 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,93 +21,100 @@ const core = __importStar(require("@actions/core")); const exec = __importStar(require("@actions/exec")); function run() { return __awaiter(this, void 0, void 0, function* () { - try { - const dir = (core.getInput("dir") || process.env.RUNNER_WORKSPACE) + "/Qt"; - const version = core.getInput("version"); - // Qt installer assumes basic requirements that are not installed by - // default on Ubuntu. - if (process.platform == "linux" && core.getInput("install-deps") == "true") { - yield exec.exec("sudo apt-get update"); - yield exec.exec("sudo apt-get install build-essential libgl1-mesa-dev -y"); - } - if (core.getInput("cached") != "true") { - // 7-zip is required, and not included on macOS - if (process.platform == "darwin") { - yield exec.exec("brew install p7zip"); + let tries = 0; + while (true) { + try { + const dir = (core.getInput("dir") || process.env.RUNNER_WORKSPACE) + "/Qt"; + const version = core.getInput("version"); + // Qt installer assumes basic requirements that are not installed by + // default on Ubuntu. + if (process.platform == "linux" && core.getInput("install-deps") == "true") { + yield exec.exec("sudo apt-get update"); + yield exec.exec("sudo apt-get install build-essential libgl1-mesa-dev -y"); } - yield exec.exec("pip3 install setuptools wheel"); - yield exec.exec("pip3 install \"py7zr" + core.getInput("py7zrversion") + "\""); - yield exec.exec("pip3 install \"aqtinstall" + core.getInput("aqtversion") + "\""); - let host = core.getInput("host"); - let target = core.getInput("target"); - let arch = core.getInput("arch"); - let modules = core.getInput("modules").split(" "); - let mirror = core.getInput("mirror"); - let extra = core.getInput("extra").split(" "); - ; - //set host automatically if omitted - if (!host) { - switch (process.platform) { - case "win32": { - host = "windows"; - break; + if (core.getInput("cached") != "true") { + // 7-zip is required, and not included on macOS + if (process.platform == "darwin") { + yield exec.exec("brew install p7zip"); + } + yield exec.exec("pip3 install setuptools wheel"); + yield exec.exec("pip3 install \"py7zr" + core.getInput("py7zrversion") + "\""); + yield exec.exec("pip3 install \"aqtinstall" + core.getInput("aqtversion") + "\""); + let host = core.getInput("host"); + const target = core.getInput("target"); + let arch = core.getInput("arch"); + const mirror = core.getInput("mirror"); + const extra = core.getInput("extra"); + const modules = core.getInput("modules"); + //set host automatically if omitted + if (!host) { + switch (process.platform) { + case "win32": { + host = "windows"; + break; + } + case "darwin": { + host = "mac"; + break; + } + default: { + host = "linux"; + break; + } } - case "darwin": { - host = "mac"; - break; + } + //set arch automatically if omitted + if (!arch) { + if (host == "windows") { + arch = "win64_msvc2017_64"; } - default: { - host = "linux"; - break; + else if (host == "android") { + arch = "android_armv7"; } } - } - //set arch automatically if omitted - if (!arch) { - if (host == "windows") { - arch = "win64_msvc2017_64"; + //set args + let args = ["-O", `${dir}`, `${version}`, `${host}`, `${target}`]; + if (arch && (host == "windows" || target == "android")) { + args.push(`${arch}`); } - else if (host == "android") { - arch = "android_armv7"; + if (mirror) { + args.push("-b"); + args.push(mirror); } + if (extra) { + extra.split(" ").forEach(function (string) { + args.push(string); + }); + } + if (modules) { + args.push("-m"); + modules.split(" ").forEach(function (currentModule) { + args.push(currentModule); + }); + } + //accomodate for differences in python 3 executable name + let pythonName = "python3"; + if (process.platform == "win32") { + pythonName = "python"; + } + //run aqtinstall with args + yield exec.exec(`${pythonName} -m aqt install`, args); } - //set args - let args = ["-O", `${dir}`, `${version}`, `${host}`, `${target}`]; - if (arch && (host == "windows" || target == "android")) { - args.push(`${arch}`); - } - if (mirror) { - args.push("-b"); - args.push(mirror); - } - if (extra) { - extra.forEach(function (string) { - args.push(string); - }); - } - if (modules) { - args.push("-m"); - modules.forEach(function (currentModule) { - args.push(currentModule); - }); - } - //accomodate for differences in python 3 executable name - let pythonName = "python3"; - if (process.platform == "win32") { - pythonName = "python"; + //set environment variables + let qtPath = dir + "/" + version; + qtPath = glob.sync(qtPath + '/**/*')[0]; + core.exportVariable('Qt5_Dir', qtPath); // Incorrect name that was fixed, but kept around so it doesn't break anything + core.exportVariable('Qt5_DIR', qtPath); + core.addPath(qtPath + "/bin"); + break; + } + catch (error) { + tries++; + if (tries >= 3) { + core.setFailed(error.message); + return; } - //run aqtinstall with args - yield exec.exec(`${pythonName} -m aqt install`, args); } - //set environment variables - let qtPath = dir + "/" + version; - qtPath = glob.sync(qtPath + '/**/*')[0]; - core.exportVariable('Qt5_Dir', qtPath); // Incorrect name that was fixed, but kept around so it doesn't break anything - core.exportVariable('Qt5_DIR', qtPath); - core.addPath(qtPath + "/bin"); - } - catch (error) { - core.setFailed(error.message); } }); }