Skip to content

Commit b3ea527

Browse files
author
Benjamin Owad
committed
build v3.3.0
1 parent db8caaa commit b3ea527

File tree

2 files changed

+68
-55
lines changed

2 files changed

+68
-55
lines changed

action/lib/main.js

Lines changed: 67 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ const execPython = (command, args) => __awaiter(void 0, void 0, void 0, function
5757
const python = process.platform === "win32" ? "python" : "python3";
5858
return (0, exec_1.exec)(`${python} -m ${command} ${args.join(" ")}`);
5959
});
60+
const flaggedList = (flag, listArgs) => {
61+
return listArgs.length ? [flag, ...listArgs] : [];
62+
};
6063
const locateQtArchDir = (installDir) => {
6164
// For 6.4.2/gcc, qmake is at 'installDir/6.4.2/gcc_64/bin/qmake'.
6265
// This makes a list of all the viable arch directories that contain a qmake file.
@@ -150,39 +153,13 @@ class Inputs {
150153
throw TypeError(`"dir" input may not be empty`);
151154
}
152155
this.dir = `${dir}/Qt`;
153-
const modules = core.getInput("modules");
154-
if (modules) {
155-
this.modules = modules.split(" ");
156-
}
157-
else {
158-
this.modules = [];
159-
}
160-
const archives = core.getInput("archives");
161-
if (archives) {
162-
this.archives = archives.split(" ");
163-
}
164-
else {
165-
this.archives = [];
166-
}
167-
const tools = core.getInput("tools");
168-
if (tools) {
169-
this.tools = [];
170-
for (const tool of tools.split(" ")) {
171-
// The tools inputs have the tool name, variant, and arch delimited by a comma
172-
// aqt expects spaces instead
173-
this.tools.push(tool.replace(/,/g, " "));
174-
}
175-
}
176-
else {
177-
this.tools = [];
178-
}
179-
const extra = core.getInput("extra");
180-
if (extra) {
181-
this.extra = extra.split(" ");
182-
}
183-
else {
184-
this.extra = [];
185-
}
156+
this.modules = Inputs.getStringArrayInput("modules");
157+
this.archives = Inputs.getStringArrayInput("archives");
158+
this.tools = Inputs.getStringArrayInput("tools").map(
159+
// The tools inputs have the tool name, variant, and arch delimited by a comma
160+
// aqt expects spaces instead
161+
(tool) => tool.replace(/,/g, " "));
162+
this.extra = Inputs.getStringArrayInput("extra");
186163
const installDeps = core.getInput("install-deps").toLowerCase();
187164
if (installDeps === "nosudo") {
188165
this.installDeps = "nosudo";
@@ -192,10 +169,19 @@ class Inputs {
192169
}
193170
this.cache = Inputs.getBoolInput("cache");
194171
this.cacheKeyPrefix = core.getInput("cache-key-prefix");
195-
this.toolsOnly = Inputs.getBoolInput("tools-only");
172+
this.isInstallQtBinaries =
173+
!Inputs.getBoolInput("tools-only") && !Inputs.getBoolInput("no-qt-binaries");
196174
this.setEnv = Inputs.getBoolInput("set-env");
197175
this.aqtVersion = core.getInput("aqtversion");
198176
this.py7zrVersion = core.getInput("py7zrversion");
177+
this.src = Inputs.getBoolInput("source");
178+
this.srcArchives = Inputs.getStringArrayInput("src-archives");
179+
this.doc = Inputs.getBoolInput("documentation");
180+
this.docModules = Inputs.getStringArrayInput("doc-modules");
181+
this.docArchives = Inputs.getStringArrayInput("doc-archives");
182+
this.example = Inputs.getBoolInput("examples");
183+
this.exampleModules = Inputs.getStringArrayInput("example-modules");
184+
this.exampleArchives = Inputs.getStringArrayInput("example-archives");
199185
}
200186
get cacheKey() {
201187
let cacheKey = this.cacheKeyPrefix;
@@ -214,6 +200,14 @@ class Inputs {
214200
this.archives,
215201
this.extra,
216202
this.tools,
203+
this.src ? "src" : "",
204+
this.srcArchives,
205+
this.doc ? "doc" : "",
206+
this.docArchives,
207+
this.docModules,
208+
this.example ? "example" : "",
209+
this.exampleArchives,
210+
this.exampleModules,
217211
]) {
218212
for (const keyString of keyStringArray) {
219213
if (keyString) {
@@ -234,6 +228,10 @@ class Inputs {
234228
static getBoolInput(name) {
235229
return core.getInput(name).toLowerCase() === "true";
236230
}
231+
static getStringArrayInput(name) {
232+
const content = core.getInput(name);
233+
return content ? content.split(" ") : [];
234+
}
237235
}
238236
const run = () => __awaiter(void 0, void 0, void 0, function* () {
239237
try {
@@ -245,6 +243,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
245243
const dependencies = [
246244
"build-essential",
247245
"libgl1-mesa-dev",
246+
"libgstreamer-gl1.0-0",
248247
"libpulse-dev",
249248
"libxcb-glx0",
250249
"libxcb-icccm4",
@@ -299,27 +298,41 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
299298
// Install aqtinstall separately: allows aqtinstall to override py7zr if required
300299
yield execPython("pip install", [`"aqtinstall${inputs.aqtVersion}"`]);
301300
// Install Qt
302-
if (!inputs.toolsOnly) {
303-
const qtArgs = [inputs.host, inputs.target, inputs.version];
304-
if (inputs.arch) {
305-
qtArgs.push(inputs.arch);
306-
}
307-
qtArgs.push("--outputdir", inputs.dir);
308-
if (inputs.modules.length) {
309-
qtArgs.push("--modules");
310-
for (const module of inputs.modules) {
311-
qtArgs.push(module);
312-
}
313-
}
314-
if (inputs.archives.length) {
315-
qtArgs.push("--archives");
316-
for (const archive of inputs.archives) {
317-
qtArgs.push(archive);
318-
}
319-
}
320-
qtArgs.push(...inputs.extra);
301+
if (inputs.isInstallQtBinaries) {
302+
const qtArgs = [
303+
inputs.host,
304+
inputs.target,
305+
inputs.version,
306+
...(inputs.arch ? [inputs.arch] : []),
307+
...["--outputdir", inputs.dir],
308+
...flaggedList("--modules", inputs.modules),
309+
...flaggedList("--archives", inputs.archives),
310+
...inputs.extra,
311+
];
321312
yield execPython("aqt install-qt", qtArgs);
322313
}
314+
const installSrcDocExamples = (flavor, archives, modules) => __awaiter(void 0, void 0, void 0, function* () {
315+
const qtArgs = [
316+
inputs.host,
317+
// Aqtinstall < 2.0.4 requires `inputs.target` here, but that's deprecated
318+
inputs.version,
319+
...["--outputdir", inputs.dir],
320+
...flaggedList("--archives", archives),
321+
...flaggedList("--modules", modules),
322+
...inputs.extra,
323+
];
324+
yield execPython(`aqt install-${flavor}`, qtArgs);
325+
});
326+
// Install source, docs, & examples
327+
if (inputs.src) {
328+
yield installSrcDocExamples("src", inputs.srcArchives, []);
329+
}
330+
if (inputs.doc) {
331+
yield installSrcDocExamples("doc", inputs.docArchives, inputs.docModules);
332+
}
333+
if (inputs.example) {
334+
yield installSrcDocExamples("example", inputs.exampleArchives, inputs.exampleModules);
335+
}
323336
// Install tools
324337
for (const tool of inputs.tools) {
325338
const toolArgs = [inputs.host, inputs.target, tool];
@@ -338,7 +351,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
338351
if (inputs.tools.length) {
339352
core.exportVariable("IQTA_TOOLS", nativePath(`${inputs.dir}/Tools`));
340353
}
341-
if (!inputs.toolsOnly) {
354+
if (inputs.isInstallQtBinaries) {
342355
const qtPath = nativePath(locateQtArchDir(inputs.dir));
343356
if (process.platform === "linux") {
344357
setOrAppendEnvVar("LD_LIBRARY_PATH", nativePath(`${qtPath}/lib`));

action/node_modules/.package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)