diff options
author | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-08-12 10:32:29 +0200 |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@theqtcompany.com> | 2015-08-13 09:04:01 +0000 |
commit | f14366819d1745b54c90a86ba8b0fdbd6dd246e1 (patch) | |
tree | 55552a46b9c194421b55fa43e292d275b5390597 | |
parent | 7a3718b02ca782c25ccc9de5c92664fccd6907bf (diff) | |
download | qttools-f14366819d1745b54c90a86ba8b0fdbd6dd246e1.tar.gz |
macdeployqt: halt on missing qmlimportscanner
This is going to produce a broken bundle; stop
and print the error.
Change-Id: Ie58d357b97adc229393d80e9dde5e10c65c9bc99
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
-rw-r--r-- | src/macdeployqt/macdeployqt/main.cpp | 6 | ||||
-rw-r--r-- | src/macdeployqt/shared/shared.cpp | 9 | ||||
-rw-r--r-- | src/macdeployqt/shared/shared.h | 2 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp index 9dc53ae31..9c6e3fe03 100644 --- a/src/macdeployqt/macdeployqt/main.cpp +++ b/src/macdeployqt/macdeployqt/main.cpp @@ -87,6 +87,7 @@ int main(int argc, char **argv) extern bool runStripEnabled; extern bool alwaysOwerwriteEnabled; QStringList additionalExecutables; + bool qmldirArgumentUsed = false; QStringList qmlDirs; extern bool runCodesign; extern QString codesignIdentiy; @@ -125,6 +126,7 @@ int main(int argc, char **argv) additionalExecutables << argument.mid(index+1); } else if (argument.startsWith(QByteArray("-qmldir"))) { LogDebug() << "Argument found:" << argument; + qmldirArgumentUsed = true; int index = argument.indexOf('='); if (index == -1) LogError() << "Missing qml directory path"; @@ -162,7 +164,9 @@ int main(int argc, char **argv) } if (!qmlDirs.isEmpty()) { - deployQmlImports(appBundlePath, deploymentInfo, qmlDirs); + bool ok = deployQmlImports(appBundlePath, deploymentInfo, qmlDirs); + if (!ok && qmldirArgumentUsed) + return 1; // exit if the user explicitly asked for qml import deployment // Update deploymentInfo.deployedFrameworks - the QML imports // may have brought in extra frameworks as dependencies. diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 2328ad5df..0cc596320 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -1073,7 +1073,7 @@ void deployQmlImport(const QString &appBundlePath, const QSet<QString> &rpaths, } // Scan qml files in qmldirs for import statements, deploy used imports from Qml2ImportsPath to Contents/Resources/qml. -void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs) +bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs) { LogNormal() << ""; LogNormal() << "Deploying QML imports "; @@ -1084,7 +1084,7 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf if (!QFile(qmlImportScannerPath).exists()) { LogError() << "qmlimportscanner not found at" << qmlImportScannerPath; LogError() << "Rebuild qtdeclarative/tools/qmlimportscanner"; - return; + return false; } // build argument list for qmlimportsanner: "-rootPath foo/ -rootPath bar/ -importPath path/to/qt/qml" @@ -1103,7 +1103,7 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf qmlImportScanner.start(qmlImportScannerPath, argumentList); if (!qmlImportScanner.waitForStarted()) { LogError() << "Could not start qmlimpoortscanner. Process error is" << qmlImportScanner.errorString(); - return; + return false; } qmlImportScanner.waitForFinished(); @@ -1122,7 +1122,7 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf if (!doc.isArray()) { LogError() << "qmlimportscanner output error. Expected json array, got:"; LogError() << json; - return; + return false; } bool qtQuickContolsInUse = false; // condition for QtQuick.PrivateWidgets below @@ -1184,6 +1184,7 @@ void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf deployQmlImport(appBundlePath, deploymentInfo.rpathsUsed, path, name); LogNormal() << ""; } + return true; } void changeQtFrameworks(const QList<FrameworkInfo> frameworks, const QStringList &binaryPaths, const QString &absoluteQtPath) diff --git a/src/macdeployqt/shared/shared.h b/src/macdeployqt/shared/shared.h index b561a5ed9..d1517d6a1 100644 --- a/src/macdeployqt/shared/shared.h +++ b/src/macdeployqt/shared/shared.h @@ -100,7 +100,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); -void deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs); +bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs); void changeIdentification(const QString &id, const QString &binaryPath); void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath); void runStrip(const QString &binaryPath); |