Commit 81a3ac3a authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

Qnx: Add device runtime check to build steps

Extend the previous "debug token check" build step to
a more generic "device status step" build step that can check
both debug token and device runtime.

Task-number: QTCREATORBUG-9709

Change-Id: I50fd3eb88b692678af6f0204455165e2cdcf41b2
Reviewed-by: default avatarRafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent a8ea31bf
......@@ -29,8 +29,8 @@
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
#include "blackberrydeviceconfiguration.h"
......@@ -44,34 +44,50 @@ namespace Qnx {
namespace Internal {
class BlackBerryDeviceInformation;
class BlackBerryCheckDebugTokenStep : public ProjectExplorer::BuildStep
class BlackBerryCheckDeviceStatusStep : public ProjectExplorer::BuildStep
{
Q_OBJECT
friend class BlackBerryCheckDebugTokenStepFactory;
friend class BlackBerryCheckDeviceStatusStepFactory;
public:
explicit BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl);
explicit BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl);
bool init();
void run(QFutureInterface<bool> &fi);
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
void raiseError(const QString& error);
void raiseError(const QString &error);
void raiseWarning(const QString &warning);
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
bool debugTokenCheckEnabled () const;
bool runtimeCheckEnabled() const;
protected:
BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs);
BlackBerryCheckDeviceStatusStep(ProjectExplorer::BuildStepList *bsl,
BlackBerryCheckDeviceStatusStep *bs);
protected slots:
void checkDeviceInfo(int status);
void emitOutputInfo();
void enableDebugTokenCheck(bool enable);
void enableRuntimeCheck(bool enable);
bool handleVersionMismatch(const QString &runtimeVersion, const QString &apiLevelVersion);
private:
BlackBerryDeviceInformation *m_deviceInfo;
BlackBerryDeviceConfiguration::ConstPtr m_device;
QEventLoop *m_eventLoop;
bool m_runtimeCheckEnabled;
bool m_debugTokenCheckEnabled;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEP_H
......@@ -29,27 +29,45 @@
**
****************************************************************************/
#include "blackberrycheckdebugtokenstepconfigwidget.h"
#include "blackberrycheckdevicestatusstepconfigwidget.h"
#include "ui_blackberrycheckdevicestatusstepconfigwidget.h"
#include "blackberrycheckdevicestatusstep.h"
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryCheckDebugTokenConfigWidget::BlackBerryCheckDebugTokenConfigWidget() :
ProjectExplorer::BuildStepConfigWidget()
BlackBerryCheckDeviceStatusStepConfigWidget::BlackBerryCheckDeviceStatusStepConfigWidget(
BlackBerryCheckDeviceStatusStep *checkDeviceStatuStep)
: ProjectExplorer::BuildStepConfigWidget()
, m_checkDeviceStatusStep(checkDeviceStatuStep)
, m_ui(new Ui::BlackBerryCheckDeviceStatusStepConfigWidget)
{
m_ui->setupUi(this);
m_ui->checkRuntime->setChecked(m_checkDeviceStatusStep->runtimeCheckEnabled());
m_ui->checkDebugToken->setChecked(m_checkDeviceStatusStep->debugTokenCheckEnabled());
connect(m_ui->checkRuntime, SIGNAL(clicked(bool)),
m_checkDeviceStatusStep, SLOT(enableRuntimeCheck(bool)));
connect(m_ui->checkDebugToken, SIGNAL(clicked(bool)),
m_checkDeviceStatusStep, SLOT(enableDebugTokenCheck(bool)));
}
BlackBerryCheckDeviceStatusStepConfigWidget::~BlackBerryCheckDeviceStatusStepConfigWidget()
{
delete m_ui;
}
QString BlackBerryCheckDebugTokenConfigWidget::displayName() const
QString BlackBerryCheckDeviceStatusStepConfigWidget::displayName() const
{
return tr("<b>Check debug token</b>");
return tr("<b>Check device status</b>");
}
QString BlackBerryCheckDebugTokenConfigWidget::summaryText() const
QString BlackBerryCheckDeviceStatusStepConfigWidget::summaryText() const
{
return displayName();
}
bool BlackBerryCheckDebugTokenConfigWidget::showWidget() const
bool BlackBerryCheckDeviceStatusStepConfigWidget::showWidget() const
{
return false;
return true;
}
......@@ -29,27 +29,37 @@
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryCheckDebugTokenConfigWidget : public ProjectExplorer::BuildStepConfigWidget
namespace Ui {
class BlackBerryCheckDeviceStatusStepConfigWidget;
}
class BlackBerryCheckDeviceStatusStep;
class BlackBerryCheckDeviceStatusStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{
Q_OBJECT
public:
explicit BlackBerryCheckDebugTokenConfigWidget();
explicit BlackBerryCheckDeviceStatusStepConfigWidget(
BlackBerryCheckDeviceStatusStep *checkDeviceStatuStep);
~BlackBerryCheckDeviceStatusStepConfigWidget();
QString displayName() const;
QString summaryText() const;
bool showWidget() const;
private:
BlackBerryCheckDeviceStatusStep *m_checkDeviceStatusStep;
Ui::BlackBerryCheckDeviceStatusStepConfigWidget *m_ui;
};
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPCONFIGWIDGET_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qnx::Internal::BlackBerryCheckDeviceStatusStepConfigWidget</class>
<widget class="QWidget" name="Qnx::Internal::BlackBerryCheckDeviceStatusStepConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>126</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkRuntime">
<property name="text">
<string>Check Device Runtime</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkDebugToken">
<property name="text">
<string>Check Debug Token</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -29,9 +29,9 @@
**
****************************************************************************/
#include "blackberrycheckdebugtokenstepfactory.h"
#include "blackberrycheckdevicestatusstepfactory.h"
#include "blackberrycheckdebugtokenstep.h"
#include "blackberrycheckdevicestatusstep.h"
#include "blackberrydeviceconfigurationfactory.h"
#include "qnxconstants.h"
......@@ -43,12 +43,13 @@
using namespace Qnx;
using namespace Qnx::Internal;
BlackBerryCheckDebugTokenStepFactory::BlackBerryCheckDebugTokenStepFactory(QObject *parent) :
BlackBerryCheckDeviceStatusStepFactory::BlackBerryCheckDeviceStatusStepFactory(QObject *parent) :
ProjectExplorer::IBuildStepFactory(parent)
{
}
QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
QList<Core::Id> BlackBerryCheckDeviceStatusStepFactory::availableCreationIds(
ProjectExplorer::BuildStepList *parent) const
{
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
return QList<Core::Id>();
......@@ -57,52 +58,53 @@ QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(Proje
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
return QList<Core::Id>();
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID);
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVICE_STATUS_BS_ID);
}
QString BlackBerryCheckDebugTokenStepFactory::displayNameForId(const Core::Id id) const
QString BlackBerryCheckDeviceStatusStepFactory::displayNameForId(const Core::Id id) const
{
if (id == Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID)
return tr("Check Debug Token");
if (id == Constants::QNX_CHECK_DEVICE_STATUS_BS_ID)
return tr("Check Device Status");
return QString();
}
bool BlackBerryCheckDebugTokenStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
bool BlackBerryCheckDeviceStatusStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
{
return availableCreationIds(parent).contains(id);
}
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::create(ProjectExplorer::BuildStepList *parent,
const Core::Id id)
{
if (!canCreate(parent, id))
return 0;
return new BlackBerryCheckDebugTokenStep(parent);
return new BlackBerryCheckDeviceStatusStep(parent);
}
bool BlackBerryCheckDebugTokenStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
bool BlackBerryCheckDeviceStatusStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
{
return canCreate(parent, ProjectExplorer::idFromMap(map));
}
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
{
if (!canRestore(parent, map))
return 0;
BlackBerryCheckDebugTokenStep *bs = new BlackBerryCheckDebugTokenStep(parent);
BlackBerryCheckDeviceStatusStep *bs = new BlackBerryCheckDeviceStatusStep(parent);
if (bs->fromMap(map))
return bs;
delete bs;
return 0;
}
bool BlackBerryCheckDebugTokenStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
bool BlackBerryCheckDeviceStatusStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
{
return canCreate(parent, product->id());
}
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
ProjectExplorer::BuildStep *BlackBerryCheckDeviceStatusStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
{
if (!canClone(parent, product))
return 0;
return new BlackBerryCheckDebugTokenStep(parent, static_cast<BlackBerryCheckDebugTokenStep *>(product));
return new BlackBerryCheckDeviceStatusStep(parent, static_cast<BlackBerryCheckDeviceStatusStep *>(product));
}
......@@ -29,19 +29,19 @@
**
****************************************************************************/
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H
#define QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H
#include <projectexplorer/buildstep.h>
namespace Qnx {
namespace Internal {
class BlackBerryCheckDebugTokenStepFactory : public ProjectExplorer::IBuildStepFactory
class BlackBerryCheckDeviceStatusStepFactory : public ProjectExplorer::IBuildStepFactory
{
Q_OBJECT
public:
explicit BlackBerryCheckDebugTokenStepFactory(QObject *parent = 0);
explicit BlackBerryCheckDeviceStatusStepFactory(QObject *parent = 0);
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
QString displayNameForId(const Core::Id id) const;
......@@ -61,4 +61,4 @@ public:
} // namespace Internal
} // namespace Qnx
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVICESTATUSSTEPFACTORY_H
......@@ -32,7 +32,7 @@
#include "blackberrydeployconfigurationfactory.h"
#include "qnxconstants.h"
#include "blackberrycheckdebugtokenstep.h"
#include "blackberrycheckdevicestatusstep.h"
#include "blackberrydeployconfiguration.h"
#include "blackberrycreatepackagestep.h"
#include "blackberrydeploystep.h"
......@@ -93,7 +93,7 @@ ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::crea
return 0;
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
dc->stepList()->insertStep(0, new BlackBerryCheckDebugTokenStep(dc->stepList()));
dc->stepList()->insertStep(0, new BlackBerryCheckDeviceStatusStep(dc->stepList()));
dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList()));
dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList()));
return dc;
......
......@@ -68,9 +68,6 @@ SOURCES += qnxplugin.cpp \
blackberrydebugtokenuploader.cpp \
blackberrydebugtokenreader.cpp \
blackberryndkprocess.cpp \
blackberrycheckdebugtokenstep.cpp \
blackberrycheckdebugtokenstepconfigwidget.cpp \
blackberrycheckdebugtokenstepfactory.cpp \
blackberrydeviceconnection.cpp \
blackberrydeviceconnectionmanager.cpp \
blackberrydeviceinformation.cpp \
......@@ -99,7 +96,10 @@ SOURCES += qnxplugin.cpp \
qnxtoolchain.cpp \
slog2inforunner.cpp \
blackberryversionnumber.cpp \
blackberrydebugtokenpinsdialog.cpp
blackberrydebugtokenpinsdialog.cpp \
blackberrycheckdevicestatusstepfactory.cpp \
blackberrycheckdevicestatusstepconfigwidget.cpp \
blackberrycheckdevicestatusstep.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
......@@ -167,9 +167,6 @@ HEADERS += qnxplugin.h\
blackberrydebugtokenuploader.h \
blackberrydebugtokenreader.h \
blackberryndkprocess.h \
blackberrycheckdebugtokenstep.h \
blackberrycheckdebugtokenstepconfigwidget.h \
blackberrycheckdebugtokenstepfactory.h \
blackberrydeviceconnection.h \
blackberrydeviceconnectionmanager.h \
blackberrydeviceinformation.h \
......@@ -198,7 +195,10 @@ HEADERS += qnxplugin.h\
qnxtoolchain.h \
slog2inforunner.h \
blackberryversionnumber.h \
blackberrydebugtokenpinsdialog.h
blackberrydebugtokenpinsdialog.h \
blackberrycheckdevicestatusstep.h \
blackberrycheckdevicestatusstepfactory.h \
blackberrycheckdevicestatusstepconfigwidget.h
FORMS += \
......@@ -231,7 +231,8 @@ FORMS += \
blackberryinstallwizardndkpage.ui \
blackberryinstallwizardprocesspage.ui \
blackberryinstallwizardoptionpage.ui \
blackberrydebugtokenpinsdialog.ui
blackberrydebugtokenpinsdialog.ui \
blackberrycheckdevicestatusstepconfigwidget.ui
include(../../private_headers.pri)
include(./cascadesimport/cascadesimport.pri)
......
......@@ -57,12 +57,13 @@ QtcPlugin {
"blackberryabstractdeploystep.h",
"blackberryapplicationrunner.cpp",
"blackberryapplicationrunner.h",
"blackberrycheckdebugtokenstep.cpp",
"blackberrycheckdebugtokenstep.h",
"blackberrycheckdebugtokenstepconfigwidget.cpp",
"blackberrycheckdebugtokenstepconfigwidget.h",
"blackberrycheckdebugtokenstepfactory.cpp",
"blackberrycheckdebugtokenstepfactory.h",
"blackberrycheckdevicestatusstep.cpp",
"blackberrycheckdevicestatusstep.h",
"blackberrycheckdevicestatusstepconfigwidget.cpp",
"blackberrycheckdevicestatusstepconfigwidget.h",
"blackberrycheckdevicestatusstepconfigwidget.ui",
"blackberrycheckdevicestatusstepfactory.cpp",
"blackberrycheckdevicestatusstepfactory.h",
"blackberryconfigurationmanager.cpp",
"blackberryconfigurationmanager.h",
"blackberrycreatepackagestep.cpp",
......
......@@ -69,7 +69,7 @@ const char QNX_QNX_RUNCONFIGURATION_PREFIX[] = "Qt4ProjectManager.QNX.QNXRunConf
const char QNX_CREATE_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxCreatePackageBuildStep";
const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep";
const char QNX_CHECK_DEBUG_TOKEN_BS_ID[] = "Qt4ProjectManager.QnxCheckDebugTokenBuildStep";
const char QNX_CHECK_DEVICE_STATUS_BS_ID[] = "Qt4ProjectManager.QnxCheckDeviceStatusBuildStep";
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
......
......@@ -49,7 +49,7 @@
#include "bardescriptoreditorfactory.h"
#include "bardescriptormagicmatcher.h"
#include "blackberrykeyspage.h"
#include "blackberrycheckdebugtokenstepfactory.h"
#include "blackberrycheckdevicestatusstepfactory.h"
#include "blackberrydeviceconnectionmanager.h"
#include "blackberryconfigurationmanager.h"
#include "blackberryconfiguration.h"
......@@ -91,7 +91,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
addAutoReleasedObject(new BlackBerryRunControlFactory);
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
addAutoReleasedObject(new BlackBerryKeysPage);
addAutoReleasedObject(new BlackBerryCheckDebugTokenStepFactory);
addAutoReleasedObject(new BlackBerryCheckDeviceStatusStepFactory);
addAutoReleasedObject(new CascadesImportWizard);
BlackBerryDeviceConnectionManager::instance()->initialize();
......
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