Skip to content

Commit

Permalink
Built v2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jurplel committed Apr 15, 2020
1 parent 2f23f00 commit fd35d36
Showing 1 changed file with 84 additions and 77 deletions.
161 changes: 84 additions & 77 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
}
Expand Down

0 comments on commit fd35d36

Please sign in to comment.