summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-05-06 11:22:19 +0200
committerMorten Johan Sørvig <morten.sorvig@digia.com>2014-09-26 11:41:13 +0200
commit631bf20ca8ef4d27b81a89c54091f14da860db63 (patch)
tree38333aef514db809fb082ef9df3d337e49c1f135
parent794e271d4718d4e82da18011fa79ba578011f237 (diff)
downloadqttools-631bf20ca8ef4d27b81a89c54091f14da860db63.tar.gz
Improve how macdeployqt calls qmlimportscanner
Construct the argument list using "-rootPath", which correctly handles multiple qmlDirs. Don't merge qmlimportscanner stdout and stderr. Log stderr as macdeployqt warnings. Change-Id: I6f82f90f4e242c9aa246ab26ba3b9af88e1fd123 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/macdeployqt/shared/shared.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index a204360da..0c7e9417f 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -673,6 +673,10 @@ void deployQmlImport(const QString &appBundlePath, const QString &importSourcePa
// Scan qml files in qmldirs for import statements, deploy used imports from Qml2ImportsPath to Contents/Resources/qml.
void deployQmlImports(const QString &appBundlePath, QStringList &qmlDirs)
{
+ LogNormal() << "";
+ LogNormal() << "Deploying QML imports ";
+ LogNormal() << "Application QML file search path(s) is" << qmlDirs;
+
// verify that qmlimportscanner is in BinariesPath
QString qmlImportScannerPath = QDir::cleanPath(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlimportscanner");
if (!QFile(qmlImportScannerPath).exists()) {
@@ -681,20 +685,37 @@ void deployQmlImports(const QString &appBundlePath, QStringList &qmlDirs)
return;
}
- // run qmlimportscanner
+ // build argument list for qmlimportsanner: "-rootPath foo/ -rootPath bar/ -importPath path/to/qt/qml"
+ // ("rootPath" points to a directory containing app qml, "importPath" is where the Qt imports are installed)
+ QStringList argumentList;
+ foreach (const QString &qmlDir, qmlDirs) {
+ argumentList.append("-rootPath");
+ argumentList.append(qmlDir);
+ }
QString qmlImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+ argumentList.append( "-importPath");
+ argumentList.append(qmlImportsPath);
+
+ // run qmlimportscanner
QProcess qmlImportScanner;
- qmlImportScanner.setProcessChannelMode(QProcess::MergedChannels);
- qmlImportScanner.start(qmlImportScannerPath, QStringList() << qmlDirs << "-importPath" << qmlImportsPath);
+ qmlImportScanner.start(qmlImportScannerPath, argumentList);
if (!qmlImportScanner.waitForStarted()) {
LogError() << "Could not start qmlimpoortscanner. Process error is" << qmlImportScanner.errorString();
return;
}
-
qmlImportScanner.waitForFinished();
- QByteArray json = qmlImportScanner.readAll();
+
+ // log qmlimportscanner errors
+ qmlImportScanner.setReadChannel(QProcess::StandardError);
+ QByteArray errors = qmlImportScanner.readAll();
+ if (!errors.isEmpty()) {
+ LogWarning() << "QML file parse error (deployment will continue):";
+ LogWarning() << errors;
+ }
// parse qmlimportscanner json
+ qmlImportScanner.setReadChannel(QProcess::StandardOutput);
+ QByteArray json = qmlImportScanner.readAll();
QJsonDocument doc = QJsonDocument::fromJson(json);
if (!doc.isArray()) {
LogError() << "qmlimportscanner output error. Expected json array, got:";
@@ -739,6 +760,7 @@ void deployQmlImports(const QString &appBundlePath, QStringList &qmlDirs)
name.append(version);
deployQmlImport(appBundlePath, path, name);
+ LogNormal() << "";
}
}