Commit 03ffc4ea authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

QNX: Use one single bar descriptor when deploying

No more generated bar descriptor file. The default bar descriptor
should be the same one used when packaging and all changes
should be visible to the user.

Change-Id: Ib0eb1dc2ad2d49e159fa1b6009bac2e0d2569c5a
Reviewed-by: default avatarSergio Ahumada <sahumada@blackberry.com>
parent df0adaa2
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<name>PROJECTNAME</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>
<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
<autoOrients>true</autoOrients>
<aspectRatio>landscape</aspectRatio>
</initialWindow>
<publisher>PUBLISHER</publisher>
<author>PUBLISHER</author>
<copyright>COPYRIGHT</copyright>
<arg>-style</arg>
<!-- available styles are bb10dark and bb10bright -->
<arg>bb10dark</arg>
<env var="LD_LIBRARY_PATH" value="/usr/lib/qt4/lib:$LD_LIBRARY_PATH"/>
<env var="QT_PLUGIN_PATH" value="/usr/lib/qt4/plugins:$QT_PLUGIN_PATH"/>
<env var="QML_IMPORT_PATH" value="/usr/lib/qt4/imports:$QML_IMPORT_PATH"/>
<action system="true">run_native</action>
<!-- PROJECTPATH should point to the project binary, path can be relative -->
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<asset type="Qnx/Elf" path="${BUILD_DIR}/TARGETNAME" entry="true">PROJECTNAME</asset>
</qnx>
......@@ -4,23 +4,22 @@
<name>%ProjectName%</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>
<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
<autoOrients>true</autoOrients>
<aspectRatio>landscape</aspectRatio>
</initialWindow>
<!-- The icon for the application, which should be 114x114. -->
<icon>
<image>icon.png</image>
</icon>
<action system="true">run_native</action>
<!-- Application assets -->
<asset path="%SRC_DIR%/icon.png">icon.png</asset>
<asset path="%SRC_DIR%/assets">assets</asset>
<asset path="%ProjectName%" type="Qnx/Elf" entry="true">%ProjectName%</asset>
<env var="LD_LIBRARY_PATH" value="/usr/lib/qt4/lib:$LD_LIBRARY_PATH"/>
<env var="QT_PLUGIN_PATH" value="/usr/lib/qt4/plugins:$QT_PLUGIN_PATH"/>
<env var="QML_IMPORT_PATH" value="/usr/lib/qt4/imports:$QML_IMPORT_PATH"/>
<asset path="icon.png">icon.png</asset>
<asset path="assets">assets</asset>
<asset type="Qnx/Elf" path="${BUILD_DIR}/TARGETNAME" entry="true">%ProjectName%</asset>
</qnx>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<?xml version='1.0' encoding='utf-8' standalone='no'?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>ID</id>
<name>PROJECTNAME</name>
<versionNumber>1.0.0</versionNumber>
<description>DESCRIPTION</description>
<publisher>PUBLISHER</publisher>
<copyright>COPYRIGHT</copyright>
<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
<autoOrients>true</autoOrients>
<aspectRatio>landscape</aspectRatio>
</initialWindow>
<env value="/usr/lib/qt5/lib:$LD_LIBRARY_PATH" var="LD_LIBRARY_PATH"/>
<env value="/usr/lib/qt5/plugins:$QT_PLUGIN_PATH" var="QT_PLUGIN_PATH"/>
<env value="/usr/lib/qt5/imports:$QML_IMPORT_PATH" var="QML_IMPORT_PATH"/>
<env value="/usr/lib/qt5/qml:$QML2_IMPORT_PATH" var="QML2_IMPORT_PATH"/>
<action system="true">run_native</action>
<asset entry="true" path="PROJECTPATH" type="Qnx/Elf">PROJECTNAME</asset>
<asset path="${BUILD_DIR}/TARGETNAME" entry="true" type="Qnx/Elf">PROJECTNAME</asset>
<author>PUBLISHER</author>
</qnx>
......@@ -34,14 +34,20 @@
#include "bardescriptorfilenode.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrydeployinformation.h"
#include "blackberrycreatepackagestep.h"
#include "blackberryqtversion.h"
#include "bardescriptordocument.h"
#include "qnxconstants.h"
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h>
#include <qmakeprojectmanager/qmakenodes.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
......@@ -137,6 +143,9 @@ void BarDescriptorFileNodeManager::updateBarDescriptorNodes(ProjectExplorer::Pro
if (!createBarDescriptor(project, package.appDescriptorPath(), projectNode))
continue;
} else {
// Update the Qt environment if not matching the one in the deployment settings
updateBarDescriptor(package.appDescriptorPath(), project->activeTarget());
}
BarDescriptorFileNode *existingNode = findBarDescriptorFileNode(projectNode);
......@@ -218,12 +227,12 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
QString content = QString::fromUtf8(reader.data());
content.replace(QLatin1String("PROJECTNAME"), projectName);
content.replace(QLatin1String("PROJECTPATH"), targetName);
content.replace(QLatin1String("TARGETNAME"), targetName);
content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName);
if (project->projectDirectory().appendPath(QLatin1String("qml")).toFileInfo().exists())
content.replace(QLatin1String("</qnx>"),
QLatin1String(" <asset path=\"%SRC_DIR%/qml\">qml</asset>\n</qnx>"));
QLatin1String(" <asset path=\"qml\">qml</asset>\n</qnx>"));
Utils::FileSaver writer(barDescriptorFile.fileName(), QIODevice::WriteOnly);
writer.write(content.toUtf8());
......@@ -236,6 +245,36 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
return true;
}
void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescriptorPath,
ProjectExplorer::Target *target)
{
BarDescriptorDocument doc;
QString errorString;
if (!doc.open(&errorString, barDescriptorPath)) {
QMessageBox::warning(Core::ICore::mainWindow(), tr("Error"),
tr("Cannot open BAR application descriptor file"));
return;
}
QList<Utils::EnvironmentItem> envItems =
doc.value(BarDescriptorDocument::env).value<QList<Utils::EnvironmentItem> >();
Utils::Environment env(Utils::EnvironmentItem::toStringList(envItems), Utils::OsTypeOtherUnix);
BlackBerryQtVersion *qtVersion =
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(target->kit()));
if (!qtVersion)
return;
ProjectExplorer::BuildStepList *stepList = target->activeDeployConfiguration()->stepList();
foreach (ProjectExplorer::BuildStep *step, stepList->steps()) {
BlackBerryCreatePackageStep *createPackageStep = dynamic_cast<BlackBerryCreatePackageStep *>(step);
if (createPackageStep) {
createPackageStep->doUpdateAppDescriptorFile(barDescriptorPath,
BlackBerryCreatePackageStep::EditMode::QtEnvironment);
}
}
}
void BarDescriptorFileNodeManager::removeBarDescriptorNodes(ProjectExplorer::Project *project)
{
if (!project)
......
......@@ -65,6 +65,7 @@ private:
void updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate);
bool createBarDescriptor(ProjectExplorer::Project *project, const QString &barDescriptorPath,
ProjectExplorer::ProjectNode *projectNode);
void updateBarDescriptor(const QString &barDescriptorPath, ProjectExplorer::Target *target);
void removeBarDescriptorNodes(ProjectExplorer::Project *project);
void removeBarDescriptorNodes(ProjectExplorer::ProjectNode *parent);
......
......@@ -82,6 +82,8 @@ bool BlackBerryAbstractDeployStep::init()
m_environment = target()->activeBuildConfiguration()->environment();
m_buildDirectory = target()->activeBuildConfiguration()->buildDirectory().toString();
// The bar descriptor is using BUILD_DIR variable to set the target path
m_environment.appendOrSet(QLatin1String("BUILD_DIR"), m_buildDirectory);
return true;
}
......
......@@ -45,6 +45,7 @@ class BlackBerryCreatePackageStep : public BlackBerryAbstractDeployStep
{
Q_OBJECT
friend class BlackBerryCreatePackageStepFactory;
friend class BarDescriptorFileNodeManager;
public:
enum PackageMode {
......@@ -58,6 +59,12 @@ public:
DeployedQt
};
enum EditMode {
PlaceHolders = 0x01,
QtEnvironment = 0x02
};
Q_DECLARE_FLAGS(EditModes, EditMode)
explicit BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl);
bool init();
......@@ -84,6 +91,7 @@ public slots:
void setBundleMode(BundleMode bundleMode);
void setQtLibraryPath(const QString &qtLibraryPath);
void updateAppDescriptorFile();
signals:
void cskPasswordChanged(QString);
......@@ -97,8 +105,10 @@ protected:
private:
void ctor();
bool prepareAppDescriptorFile(const QString &appDescriptorPath, const QString &preparedFilePath);
QString fullQtLibraryPath() const;
bool doUpdateAppDescriptorFile(const QString &appDescriptorPath,
QFlags<EditMode> types);
QString fullDeployedQtLibraryPath() const;
PackageMode m_packageMode;
QString m_cskPassword;
......@@ -111,4 +121,6 @@ private:
} // namespace Internal
} // namespace Qnx
Q_DECLARE_OPERATORS_FOR_FLAGS(Qnx::Internal::BlackBerryCreatePackageStep::EditModes)
#endif // QNX_INTERNAL_BLACKBERRYCREATEPACKAGESTEP_H
......@@ -135,6 +135,8 @@ void BlackBerryCreatePackageStepConfigWidget::setBundleMode(int qtLibraryIndex)
m_ui->qtLibraryExplanationLabel->setText(m_qtLibraryExplanations[qtLibraryIndex]);
m_ui->qtLibraryPath->setVisible(bundleMode == BlackBerryCreatePackageStep::DeployedQt);
m_ui->qtLibraryLabel->setVisible(bundleMode == BlackBerryCreatePackageStep::DeployedQt);
emit bundleModeChanged();
}
void BlackBerryCreatePackageStepConfigWidget::updateDeployWidgetsState()
......
......@@ -60,6 +60,9 @@ private slots:
void updateDeployWidgetsState();
void deployLibraries();
signals:
void bundleModeChanged();
private:
BlackBerryCreatePackageStep *m_step;
Ui::BlackBerryCreatePackageStepConfigWidget *m_ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment