Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set QT_HOST_PATH for parallel desktop installations #268

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions action/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const flaggedList = (flag: string, listArgs: readonly string[]): string[] => {
return listArgs.length ? [flag, ...listArgs] : [];
};

const locateQtArchDir = (installDir: string): string => {
const locateQtArchDir = (installDir: string): [string, boolean] => {
// For 6.4.2/gcc, qmake is at 'installDir/6.4.2/gcc_64/bin/qmake'.
// This makes a list of all the viable arch directories that contain a qmake file.
const qtArchDirs = glob
Expand All @@ -84,16 +84,16 @@ const locateQtArchDir = (installDir: string): string => {
const requiresParallelDesktop = qtArchDirs.filter((archPath) => {
const archDir = path.basename(archPath);
const versionDir = path.basename(path.join(archPath, ".."));
return versionDir.match(/^6\.\d+\.\d+$/) && archDir.match(/^(android*|ios|wasm*|msvc*_arm64)$/);
return versionDir.match(/^6\.\d+\.\d+$/) && archDir.match(/^(android.*|ios|wasm.*|msvc.*_arm64)$/);
});
if (requiresParallelDesktop.length) {
// NOTE: if multiple mobile/wasm installations coexist, this may not select the desired directory
return requiresParallelDesktop[0];
return [requiresParallelDesktop[0], true];
} else if (!qtArchDirs.length) {
throw Error(`Failed to locate a Qt installation directory in ${installDir}`);
} else {
// NOTE: if multiple Qt installations exist, this may not select the desired directory
return qtArchDirs[0];
return [qtArchDirs[0], false];
}
};

Expand Down Expand Up @@ -455,7 +455,7 @@ const run = async (): Promise<void> => {
}
// Set environment variables/outputs for binaries
if (inputs.isInstallQtBinaries) {
const qtPath = locateQtArchDir(inputs.dir);
const [qtPath, requiresParallelDesktop] = locateQtArchDir(inputs.dir);
// Set outputs
core.setOutput("qtPath", qtPath);

Expand All @@ -474,6 +474,11 @@ const run = async (): Promise<void> => {
core.exportVariable("QT_ROOT_DIR", qtPath);
core.exportVariable("QT_PLUGIN_PATH", path.resolve(qtPath, "plugins"));
core.exportVariable("QML2_IMPORT_PATH", path.resolve(qtPath, "qml"));
if (requiresParallelDesktop) {
const qmakePath = path.resolve(qtPath, "bin", "qmake");
const queryResult = await getExecOutput(`${qmakePath} -query QT_HOST_PREFIX`);
core.exportVariable("QT_HOST_PATH", path.normalize(queryResult.stdout.trim()));
jdpurcell marked this conversation as resolved.
Show resolved Hide resolved
}
core.addPath(path.resolve(qtPath, "bin"));
}
}
Expand Down