summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Bizyaev <bizyaev@zoho.com>2018-10-06 19:59:56 +0300
committerIlya Bizyaev <bizyaev@zoho.com>2018-10-31 21:22:13 +0000
commit24189b5f0935914a979b7e9d3786bec8f9f019bc (patch)
tree6e50ef18000010a0d5e85a5befa1ec8d06f07d79
parent76cdf802b7333b037d005b75a2cb7f3623359335 (diff)
Add option to specify qmlimportscanner importPaths
This patch adds a new option, -qmlimport, which enables macdeployqt to pass custom QML module import paths to qmlimportscanner. Fixes: QTBUG-70977 Change-Id: I39edfb88e48e05c42c6c4690efa3e728046baff3 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
-rw-r--r--src/macdeployqt/macdeployqt/main.cpp11
-rw-r--r--src/macdeployqt/shared/shared.cpp7
-rw-r--r--src/macdeployqt/shared/shared.h2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp
index 14507a38..0599b739 100644
--- a/src/macdeployqt/macdeployqt/main.cpp
+++ b/src/macdeployqt/macdeployqt/main.cpp
@@ -49,6 +49,7 @@ int main(int argc, char **argv)
qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)";
qDebug() << " -executable=<path> : Let the given executable use the deployed frameworks too";
qDebug() << " -qmldir=<path> : Scan for QML imports in the given path";
+ qDebug() << " -qmlimport=<path> : Add the given path to the QML module search locations";
qDebug() << " -always-overwrite : Copy files even if the target file exists";
qDebug() << " -codesign=<ident> : Run codesign with the given identity on all executables";
qDebug() << " -appstore-compliant: Skip deployment of components that use private API";
@@ -92,6 +93,7 @@ int main(int argc, char **argv)
QStringList additionalExecutables;
bool qmldirArgumentUsed = false;
QStringList qmlDirs;
+ QStringList qmlImportPaths;
extern bool runCodesign;
extern QString codesignIdentiy;
extern bool appstoreCompliant;
@@ -136,6 +138,13 @@ int main(int argc, char **argv)
LogError() << "Missing qml directory path";
else
qmlDirs << argument.mid(index+1);
+ } else if (argument.startsWith(QByteArray("-qmlimport"))) {
+ LogDebug() << "Argument found:" << argument;
+ int index = argument.indexOf('=');
+ if (index == -1)
+ LogError() << "Missing qml import path";
+ else
+ qmlImportPaths << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-libpath"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
@@ -194,7 +203,7 @@ int main(int argc, char **argv)
}
if (!qmlDirs.isEmpty()) {
- bool ok = deployQmlImports(appBundlePath, deploymentInfo, qmlDirs);
+ bool ok = deployQmlImports(appBundlePath, deploymentInfo, qmlDirs, qmlImportPaths);
if (!ok && qmldirArgumentUsed)
return 1; // exit if the user explicitly asked for qml import deployment
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 33d29ecc..a6ff37ea 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -1216,11 +1216,12 @@ static bool importLessThan(const QVariant &v1, const QVariant &v2)
}
// Scan qml files in qmldirs for import statements, deploy used imports from Qml2ImportsPath to Contents/Resources/qml.
-bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs)
+bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs, QStringList &qmlImportPaths)
{
LogNormal() << "";
LogNormal() << "Deploying QML imports ";
- LogNormal() << "Application QML file search path(s) is" << qmlDirs;
+ LogNormal() << "Application QML file path(s) is" << qmlDirs;
+ LogNormal() << "QML module search path(s) is" << qmlImportPaths;
// Use qmlimportscanner from QLibraryInfo::BinariesPath
QString qmlImportScannerPath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlimportscanner");
@@ -1243,6 +1244,8 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
argumentList.append("-rootPath");
argumentList.append(qmlDir);
}
+ for (const QString &importPath : qmlImportPaths)
+ argumentList << "-importPath" << importPath;
QString qmlImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
argumentList.append( "-importPath");
argumentList.append(qmlImportsPath);
diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h
index 588b5dd6..ab28360d 100644
--- a/src/macdeployqt/shared/shared.h
+++ b/src/macdeployqt/shared/shared.h
@@ -124,7 +124,7 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis
DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,const QString &bundlePath, const QStringList &binaryPaths, bool useDebugLibs, bool useLoaderPath);
void createQtConf(const QString &appBundlePath);
void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs);
-bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs);
+bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs, QStringList &qmlImportPaths);
void changeIdentification(const QString &id, const QString &binaryPath);
void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath);
void runStrip(const QString &binaryPath);