From 073fd91705be5241de93d16b881dba8a017d8b50 Mon Sep 17 00:00:00 2001 From: El Mehdi Fekari <mfekari@blackberry.com> Date: Thu, 6 Mar 2014 17:53:08 +0100 Subject: [PATCH] Qnx: Package user assets as well when bundling Qt libs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTCREATORBUG-11652 Change-Id: Ib5c26b0b25542eb8e92f5ff65a4f3ec31b82bfff Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: David Kaspar <dkaspar@blackberry.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com> --- .../qnx/blackberrycreatepackagestep.cpp | 61 ++++++++----------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/src/plugins/qnx/blackberrycreatepackagestep.cpp b/src/plugins/qnx/blackberrycreatepackagestep.cpp index 26a3c744700..5b325d2c3fe 100644 --- a/src/plugins/qnx/blackberrycreatepackagestep.cpp +++ b/src/plugins/qnx/blackberrycreatepackagestep.cpp @@ -134,7 +134,6 @@ bool BlackBerryCreatePackageStep::init() // If there is an error, prepareAppDescriptorFile() will raise it return false; - QStringList args; if (m_packageMode == DevelopmentMode) { args << QLatin1String("-devMode"); @@ -165,39 +164,6 @@ bool BlackBerryCreatePackageStep::init() args << QLatin1String("-package") << QnxUtils::addQuotes(QDir::toNativeSeparators(info.packagePath())); args << QnxUtils::addQuotes(QDir::toNativeSeparators(preparedFilePath)); - if (m_packageMode == DevelopmentMode && m_bundleMode == BundleQt) { - BlackBerryQtVersion *qtVersion = dynamic_cast<BlackBerryQtVersion *> - (QtSupport::QtKitInformation::qtVersion(target()->kit())); - if (!qtVersion) { - raiseError(tr("Qt version configured for BlackBerry kit " - "is not a BlackBerry Qt version.")); - return false; - } - - QMap<QString, QString> qtFolders; - qtFolders[QLatin1String("lib")] = - qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS")); - qtFolders[QLatin1String("plugins")] = - qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_PLUGINS")); - qtFolders[QLatin1String("imports")] = - qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS")); - qtFolders[QLatin1String("qml")] = - qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_QML")); - - for (QMap<QString, QString>::const_iterator it = qtFolders.constBegin(); - it != qtFolders.constEnd(); ++it) { - const QString target = it.key(); - const QString qtFolder = it.value(); - if (QFileInfo(qtFolder).exists()) { - args << QLatin1String("-e"); - args << qtFolder; - args << target; - } - } - - args << QLatin1String("."); - } - addCommand(packageCmd, args); } @@ -358,6 +324,8 @@ bool BlackBerryCreatePackageStep::prepareAppDescriptorFile(const QString &appDes QList<Utils::EnvironmentItem> envItems = doc.value(BarDescriptorDocument::env).value<QList<Utils::EnvironmentItem> >(); Utils::Environment env(Utils::EnvironmentItem::toStringList(envItems), Utils::OsTypeOtherUnix); + BarDescriptorAssetList assetList = doc.value(BarDescriptorDocument::asset) + .value<BarDescriptorAssetList>(); if (m_packageMode == SigningPackageMode || (m_packageMode == DevelopmentMode && m_bundleMode == PreInstalledQt)) { @@ -371,6 +339,29 @@ bool BlackBerryCreatePackageStep::prepareAppDescriptorFile(const QString &appDes env.prependOrSetLibrarySearchPath(QString::fromLatin1("/usr/lib/qt%1/lib") .arg(versionNumber.majorVersion)); } else if (m_packageMode == DevelopmentMode && m_bundleMode == BundleQt) { + QList<QPair<QString, QString> > qtFolders; + qtFolders.append(qMakePair(QString::fromLatin1("lib"), + qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_LIBS")))); + qtFolders.append(qMakePair(QString::fromLatin1("plugins"), + qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_PLUGINS")))); + qtFolders.append(qMakePair(QString::fromLatin1("imports"), + qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_IMPORTS")))); + qtFolders.append(qMakePair(QString::fromLatin1("qml"), + qtVersion->versionInfo().value(QLatin1String("QT_INSTALL_QML")))); + + for (QList<QPair<QString, QString> >::const_iterator it = qtFolders.constBegin(); + it != qtFolders.constEnd(); ++it) { + const QString target = it->first; + const QString qtFolder = it->second; + if (QFileInfo(qtFolder).exists()) { + BarDescriptorAsset asset; + asset.source = qtFolder; + asset.destination = target; + asset.entry = false; + assetList << asset; + } + } + env.appendOrSet(QLatin1String("QML2_IMPORT_PATH"), QLatin1String("app/native/imports:app/native/qml"), QLatin1String(":")); env.appendOrSet(QLatin1String("QML_IMPORT_PATH"), @@ -390,6 +381,8 @@ bool BlackBerryCreatePackageStep::prepareAppDescriptorFile(const QString &appDes env.prependOrSetLibrarySearchPath(QString::fromLatin1("%1/lib").arg(fullQtLibraryPath())); } + doc.setValue(BarDescriptorDocument::asset, QVariant::fromValue(assetList)); + QVariant envVar; envVar.setValue(Utils::EnvironmentItem::fromStringList(env.toStringList())); doc.setValue(BarDescriptorDocument::env, envVar); -- GitLab