forked from qt-creator/qt-creator
Qnx: Add a build step for checking the device's debug token
This patch replaces the development mode check build step by a debug token check which privdes more explicit error message if the device's debug token is not valid. Task-number: QTCREATORBUG-9673 Task-number: QTCREATORBUG-9001 Change-Id: I0a6148cc533156f3bfd6acbeb4abec2713b37b3c Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
committed by
Mehdi Fekari
parent
b20ed0a0f3
commit
27f3702f56
156
src/plugins/qnx/blackberrycheckdebugtokenstep.cpp
Normal file
156
src/plugins/qnx/blackberrycheckdebugtokenstep.cpp
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
|
||||||
|
**
|
||||||
|
** Contact: BlackBerry (qt@blackberry.com)
|
||||||
|
** Contact: KDAB (info@kdab.com)
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator.
|
||||||
|
**
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and Digia. For licensing terms and
|
||||||
|
** conditions see http://qt.digia.com/licensing. For further information
|
||||||
|
** use the contact form at http://qt.digia.com/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Digia gives you certain additional
|
||||||
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "blackberrycheckdebugtokenstep.h"
|
||||||
|
|
||||||
|
#include "blackberrycheckdebugtokenstepconfigwidget.h"
|
||||||
|
#include "blackberrydeviceinformation.h"
|
||||||
|
#include "qnxconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
#include <projectexplorer/task.h>
|
||||||
|
#include <ssh/sshconnection.h>
|
||||||
|
|
||||||
|
#include <qeventloop.h>
|
||||||
|
|
||||||
|
using namespace Qnx;
|
||||||
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
|
BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl) :
|
||||||
|
ProjectExplorer::BuildStep(bsl, Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID))
|
||||||
|
, m_deviceInfo(0)
|
||||||
|
, m_eventLoop(0)
|
||||||
|
{
|
||||||
|
setDisplayName(tr("Check Debug Token"));
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackBerryCheckDebugTokenStep::BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs) :
|
||||||
|
ProjectExplorer::BuildStep(bsl, bs)
|
||||||
|
, m_deviceInfo(0)
|
||||||
|
, m_eventLoop(0)
|
||||||
|
{
|
||||||
|
setDisplayName(tr("Check Debug Token"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerryCheckDebugTokenStep::checkDeviceInfo(int status)
|
||||||
|
{
|
||||||
|
// Skip debug token check for internal non secure devices and simulators
|
||||||
|
if (m_deviceInfo->isProductionDevice() && !m_deviceInfo->isSimulator()) {
|
||||||
|
if (status != BlackBerryDeviceInformation::Success) {
|
||||||
|
switch (status) {
|
||||||
|
case BlackBerryDeviceInformation::AuthenticationFailed:
|
||||||
|
raiseError(tr("Authentication failed."));
|
||||||
|
break;
|
||||||
|
case BlackBerryDeviceInformation::NoRouteToHost:
|
||||||
|
raiseError(tr("Cannot connect to device."));
|
||||||
|
break;
|
||||||
|
case BlackBerryDeviceInformation::DevelopmentModeDisabled:
|
||||||
|
raiseError(tr("Device is not in the development mode."));
|
||||||
|
break;
|
||||||
|
case BlackBerryDeviceInformation::InferiorProcessTimedOut:
|
||||||
|
raiseError(tr("Timeout querying device information."));
|
||||||
|
break;
|
||||||
|
case BlackBerryDeviceInformation::FailedToStartInferiorProcess:
|
||||||
|
raiseError(tr("Failed to query device information."));
|
||||||
|
break;
|
||||||
|
case BlackBerryDeviceInformation::InferiorProcessCrashed:
|
||||||
|
raiseError(tr("Process to query device information has crashed."));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
raiseError(tr("Cannot query device information."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_eventLoop->exit(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_deviceInfo->debugTokenValid()) {
|
||||||
|
raiseError(m_deviceInfo->debugTokenValidationError());
|
||||||
|
m_eventLoop->exit(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_eventLoop->exit(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerryCheckDebugTokenStep::emitOutputInfo()
|
||||||
|
{
|
||||||
|
emit addOutput(tr("Checking debug token..."), BuildStep::MessageOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BlackBerryCheckDebugTokenStep::init()
|
||||||
|
{
|
||||||
|
m_device = BlackBerryDeviceConfiguration::device(target()->kit());
|
||||||
|
if (!m_device)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (m_device->sshParameters().host.isEmpty()) {
|
||||||
|
raiseError(tr("No hostname specified for the device"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerryCheckDebugTokenStep::run(QFutureInterface<bool> &fi)
|
||||||
|
{
|
||||||
|
m_eventLoop = new QEventLoop;
|
||||||
|
m_deviceInfo = new BlackBerryDeviceInformation;
|
||||||
|
|
||||||
|
connect(m_deviceInfo, SIGNAL(started()), this, SLOT(emitOutputInfo()));
|
||||||
|
connect(m_deviceInfo, SIGNAL(finished(int)), this, SLOT(checkDeviceInfo(int)), Qt::DirectConnection);
|
||||||
|
m_deviceInfo->setDeviceTarget(m_device->sshParameters().host, m_device->sshParameters().password);
|
||||||
|
|
||||||
|
bool returnValue = m_eventLoop->exec();
|
||||||
|
|
||||||
|
delete m_eventLoop;
|
||||||
|
m_eventLoop = 0;
|
||||||
|
|
||||||
|
delete m_deviceInfo;
|
||||||
|
m_deviceInfo = 0;
|
||||||
|
|
||||||
|
return fi.reportResult(returnValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDebugTokenStep::createConfigWidget()
|
||||||
|
{
|
||||||
|
return new BlackBerryCheckDebugTokenConfigWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BlackBerryCheckDebugTokenStep::raiseError(const QString &errorMessage)
|
||||||
|
{
|
||||||
|
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||||
|
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||||
|
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
|
||||||
|
}
|
||||||
@@ -29,35 +29,49 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
|
||||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
|
||||||
|
|
||||||
#include "blackberryabstractdeploystep.h"
|
#include "blackberrydeviceconfiguration.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildstep.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QEventLoop;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BlackBerryCheckDevModeStep : public BlackBerryAbstractDeployStep
|
class BlackBerryDeviceInformation;
|
||||||
|
class BlackBerryCheckDebugTokenStep : public ProjectExplorer::BuildStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class BlackBerryCheckDevModeStepFactory;
|
friend class BlackBerryCheckDebugTokenStepFactory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl);
|
explicit BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
|
|
||||||
bool init();
|
bool init();
|
||||||
|
void run(QFutureInterface<bool> &fi);
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||||
|
|
||||||
protected:
|
void raiseError(const QString& error);
|
||||||
BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDevModeStep *bs);
|
|
||||||
|
|
||||||
void processStarted(const ProjectExplorer::ProcessParameters ¶ms);
|
protected:
|
||||||
|
BlackBerryCheckDebugTokenStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDebugTokenStep *bs);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void checkDeviceInfo(int status);
|
||||||
|
void emitOutputInfo();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString password() const;
|
BlackBerryDeviceInformation *m_deviceInfo;
|
||||||
|
BlackBerryDeviceConfiguration::ConstPtr m_device;
|
||||||
|
QEventLoop *m_eventLoop;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qnx
|
} // namespace Qnx
|
||||||
|
|
||||||
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEP_H
|
||||||
@@ -29,27 +29,27 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "blackberrycheckdevmodestepconfigwidget.h"
|
#include "blackberrycheckdebugtokenstepconfigwidget.h"
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
BlackBerryCheckDevModeStepConfigWidget::BlackBerryCheckDevModeStepConfigWidget() :
|
BlackBerryCheckDebugTokenConfigWidget::BlackBerryCheckDebugTokenConfigWidget() :
|
||||||
ProjectExplorer::BuildStepConfigWidget()
|
ProjectExplorer::BuildStepConfigWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BlackBerryCheckDevModeStepConfigWidget::displayName() const
|
QString BlackBerryCheckDebugTokenConfigWidget::displayName() const
|
||||||
{
|
{
|
||||||
return tr("<b>Check development mode</b>");
|
return tr("<b>Check debug token</b>");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BlackBerryCheckDevModeStepConfigWidget::summaryText() const
|
QString BlackBerryCheckDebugTokenConfigWidget::summaryText() const
|
||||||
{
|
{
|
||||||
return displayName();
|
return displayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryCheckDevModeStepConfigWidget::showWidget() const
|
bool BlackBerryCheckDebugTokenConfigWidget::showWidget() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -29,19 +29,19 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
|
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
|
||||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
|
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPCONFIGWIDGET_H
|
||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BlackBerryCheckDevModeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
class BlackBerryCheckDebugTokenConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BlackBerryCheckDevModeStepConfigWidget();
|
explicit BlackBerryCheckDebugTokenConfigWidget();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QString summaryText() const;
|
QString summaryText() const;
|
||||||
@@ -29,9 +29,9 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "blackberrycheckdevmodestepfactory.h"
|
#include "blackberrycheckdebugtokenstepfactory.h"
|
||||||
|
|
||||||
#include "blackberrycheckdevmodestep.h"
|
#include "blackberrycheckdebugtokenstep.h"
|
||||||
#include "blackberrydeviceconfigurationfactory.h"
|
#include "blackberrydeviceconfigurationfactory.h"
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
|
|
||||||
@@ -43,12 +43,12 @@
|
|||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
BlackBerryCheckDevModeStepFactory::BlackBerryCheckDevModeStepFactory(QObject *parent) :
|
BlackBerryCheckDebugTokenStepFactory::BlackBerryCheckDebugTokenStepFactory(QObject *parent) :
|
||||||
ProjectExplorer::IBuildStepFactory(parent)
|
ProjectExplorer::IBuildStepFactory(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Core::Id> BlackBerryCheckDevModeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
QList<Core::Id> BlackBerryCheckDebugTokenStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
||||||
{
|
{
|
||||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||||
return QList<Core::Id>();
|
return QList<Core::Id>();
|
||||||
@@ -57,52 +57,52 @@ QList<Core::Id> BlackBerryCheckDevModeStepFactory::availableCreationIds(ProjectE
|
|||||||
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
|
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
|
||||||
return QList<Core::Id>();
|
return QList<Core::Id>();
|
||||||
|
|
||||||
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID);
|
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BlackBerryCheckDevModeStepFactory::displayNameForId(const Core::Id id) const
|
QString BlackBerryCheckDebugTokenStepFactory::displayNameForId(const Core::Id id) const
|
||||||
{
|
{
|
||||||
if (id == Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID)
|
if (id == Constants::QNX_CHECK_DEBUG_TOKEN_BS_ID)
|
||||||
return tr("Check Development Mode");
|
return tr("Check Debug Token");
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryCheckDevModeStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
|
bool BlackBerryCheckDebugTokenStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
|
||||||
{
|
{
|
||||||
return availableCreationIds(parent).contains(id);
|
return availableCreationIds(parent).contains(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
|
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
|
||||||
{
|
{
|
||||||
if (!canCreate(parent, id))
|
if (!canCreate(parent, id))
|
||||||
return 0;
|
return 0;
|
||||||
return new BlackBerryCheckDevModeStep(parent);
|
return new BlackBerryCheckDebugTokenStep(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryCheckDevModeStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
|
bool BlackBerryCheckDebugTokenStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
|
||||||
{
|
{
|
||||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
|
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!canRestore(parent, map))
|
if (!canRestore(parent, map))
|
||||||
return 0;
|
return 0;
|
||||||
BlackBerryCheckDevModeStep *bs = new BlackBerryCheckDevModeStep(parent);
|
BlackBerryCheckDebugTokenStep *bs = new BlackBerryCheckDebugTokenStep(parent);
|
||||||
if (bs->fromMap(map))
|
if (bs->fromMap(map))
|
||||||
return bs;
|
return bs;
|
||||||
delete bs;
|
delete bs;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlackBerryCheckDevModeStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
|
bool BlackBerryCheckDebugTokenStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
|
||||||
{
|
{
|
||||||
return canCreate(parent, product->id());
|
return canCreate(parent, product->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
ProjectExplorer::BuildStep *BlackBerryCheckDebugTokenStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
||||||
{
|
{
|
||||||
if (!canClone(parent, product))
|
if (!canClone(parent, product))
|
||||||
return 0;
|
return 0;
|
||||||
return new BlackBerryCheckDevModeStep(parent, static_cast<BlackBerryCheckDevModeStep *>(product));
|
return new BlackBerryCheckDebugTokenStep(parent, static_cast<BlackBerryCheckDebugTokenStep *>(product));
|
||||||
}
|
}
|
||||||
@@ -29,19 +29,19 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
|
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
|
||||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
|
#define QNX_INTERNAL_BLACKBERRYCHECKDEBUGTOKENSTEPFACTORY_H
|
||||||
|
|
||||||
#include <projectexplorer/buildstep.h>
|
#include <projectexplorer/buildstep.h>
|
||||||
|
|
||||||
namespace Qnx {
|
namespace Qnx {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class BlackBerryCheckDevModeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class BlackBerryCheckDebugTokenStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit BlackBerryCheckDevModeStepFactory(QObject *parent = 0);
|
explicit BlackBerryCheckDebugTokenStepFactory(QObject *parent = 0);
|
||||||
|
|
||||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||||
QString displayNameForId(const Core::Id id) const;
|
QString displayNameForId(const Core::Id id) const;
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
|
|
||||||
**
|
|
||||||
** Contact: BlackBerry (qt@blackberry.com)
|
|
||||||
** Contact: KDAB (info@kdab.com)
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Digia. For licensing terms and
|
|
||||||
** conditions see http://qt.digia.com/licensing. For further information
|
|
||||||
** use the contact form at http://qt.digia.com/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** In addition, as a special exception, Digia gives you certain additional
|
|
||||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
||||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "blackberrycheckdevmodestep.h"
|
|
||||||
|
|
||||||
#include "blackberrycheckdevmodestepconfigwidget.h"
|
|
||||||
#include "blackberrydeviceconfiguration.h"
|
|
||||||
#include "qnxconstants.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
#include <ssh/sshconnection.h>
|
|
||||||
|
|
||||||
using namespace Qnx;
|
|
||||||
using namespace Qnx::Internal;
|
|
||||||
|
|
||||||
BlackBerryCheckDevModeStep::BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl) :
|
|
||||||
BlackBerryAbstractDeployStep(bsl, Core::Id(Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID))
|
|
||||||
{
|
|
||||||
setDisplayName(tr("Check Development Mode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
BlackBerryCheckDevModeStep::BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDevModeStep *bs) :
|
|
||||||
BlackBerryAbstractDeployStep(bsl, bs)
|
|
||||||
{
|
|
||||||
setDisplayName(tr("Check Development Mode"));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlackBerryCheckDevModeStep::init()
|
|
||||||
{
|
|
||||||
if (!BlackBerryAbstractDeployStep::init())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
|
|
||||||
if (deployCmd.isEmpty()) {
|
|
||||||
raiseError(tr("Could not find command '%1' in the build environment")
|
|
||||||
.arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
|
|
||||||
QString deviceHost = device ? device->sshParameters().host : QString();
|
|
||||||
if (deviceHost.isEmpty()) {
|
|
||||||
raiseError(tr("No hostname specified for device"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList args;
|
|
||||||
args << QLatin1String("-listDeviceInfo");
|
|
||||||
args << deviceHost;
|
|
||||||
if (!device->sshParameters().password.isEmpty()) {
|
|
||||||
args << QLatin1String("-password");
|
|
||||||
args << device->sshParameters().password;
|
|
||||||
}
|
|
||||||
|
|
||||||
addCommand(deployCmd, args);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::BuildStepConfigWidget *BlackBerryCheckDevModeStep::createConfigWidget()
|
|
||||||
{
|
|
||||||
return new BlackBerryCheckDevModeStepConfigWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BlackBerryCheckDevModeStep::password() const
|
|
||||||
{
|
|
||||||
BlackBerryDeviceConfiguration::ConstPtr device = BlackBerryDeviceConfiguration::device(target()->kit());
|
|
||||||
return device ? device->sshParameters().password : QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlackBerryCheckDevModeStep::processStarted(const ProjectExplorer::ProcessParameters ¶ms)
|
|
||||||
{
|
|
||||||
QString arguments = params.prettyArguments();
|
|
||||||
if (!password().isEmpty()) {
|
|
||||||
const QString passwordLine = QLatin1String(" -password ") + password();
|
|
||||||
const QString hiddenPasswordLine = QLatin1String(" -password <hidden>");
|
|
||||||
arguments.replace(passwordLine, hiddenPasswordLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
emitOutputInfo(params, arguments);
|
|
||||||
}
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "blackberrydeployconfigurationfactory.h"
|
#include "blackberrydeployconfigurationfactory.h"
|
||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
#include "blackberrycheckdevmodestep.h"
|
#include "blackberrycheckdebugtokenstep.h"
|
||||||
#include "blackberrydeployconfiguration.h"
|
#include "blackberrydeployconfiguration.h"
|
||||||
#include "blackberrycreatepackagestep.h"
|
#include "blackberrycreatepackagestep.h"
|
||||||
#include "blackberrydeploystep.h"
|
#include "blackberrydeploystep.h"
|
||||||
@@ -93,7 +93,7 @@ ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::crea
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
|
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
|
||||||
dc->stepList()->insertStep(0, new BlackBerryCheckDevModeStep(dc->stepList()));
|
dc->stepList()->insertStep(0, new BlackBerryCheckDebugTokenStep(dc->stepList()));
|
||||||
dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList()));
|
dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList()));
|
||||||
dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList()));
|
dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList()));
|
||||||
return dc;
|
return dc;
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void BlackBerryDeviceInformation::resetResults()
|
|||||||
m_deviceOS.clear();
|
m_deviceOS.clear();
|
||||||
m_hardwareId.clear();
|
m_hardwareId.clear();
|
||||||
m_debugTokenAuthor.clear();
|
m_debugTokenAuthor.clear();
|
||||||
|
m_debugTokenValidationError.clear();
|
||||||
m_scmBundle.clear();
|
m_scmBundle.clear();
|
||||||
m_hostName.clear();
|
m_hostName.clear();
|
||||||
m_debugTokenValid = false;
|
m_debugTokenValid = false;
|
||||||
@@ -95,6 +96,11 @@ QString BlackBerryDeviceInformation::debugTokenAuthor() const
|
|||||||
return m_debugTokenAuthor;
|
return m_debugTokenAuthor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString BlackBerryDeviceInformation::debugTokenValidationError() const
|
||||||
|
{
|
||||||
|
return m_debugTokenValidationError;
|
||||||
|
}
|
||||||
|
|
||||||
QString BlackBerryDeviceInformation::scmBundle() const
|
QString BlackBerryDeviceInformation::scmBundle() const
|
||||||
{
|
{
|
||||||
return m_scmBundle;
|
return m_scmBundle;
|
||||||
@@ -125,8 +131,9 @@ void BlackBerryDeviceInformation::processData(const QString &line)
|
|||||||
static const QString devicepin = QLatin1String("devicepin::0x");
|
static const QString devicepin = QLatin1String("devicepin::0x");
|
||||||
static const QString device_os = QLatin1String("device_os::");
|
static const QString device_os = QLatin1String("device_os::");
|
||||||
static const QString hardwareid = QLatin1String("hardwareid::");
|
static const QString hardwareid = QLatin1String("hardwareid::");
|
||||||
static const QString debug_token_author = QLatin1String("debug_token_author::");
|
static const QString debug_token_author = QLatin1String("[n]debug_token_author::");
|
||||||
static const QString debug_token_valid = QLatin1String("debug_token_valid:b:");
|
static const QString debug_token_validation_error = QLatin1String("[n]debug_token_validation_error::");
|
||||||
|
static const QString debug_token_valid = QLatin1String("[n]debug_token_valid:b:");
|
||||||
static const QString simulator = QLatin1String("simulator:b:");
|
static const QString simulator = QLatin1String("simulator:b:");
|
||||||
static const QString scmbundle = QLatin1String("scmbundle::");
|
static const QString scmbundle = QLatin1String("scmbundle::");
|
||||||
static const QString hostname = QLatin1String("hostname::");
|
static const QString hostname = QLatin1String("hostname::");
|
||||||
@@ -140,6 +147,8 @@ void BlackBerryDeviceInformation::processData(const QString &line)
|
|||||||
m_hardwareId = line.mid(hardwareid.size()).trimmed();
|
m_hardwareId = line.mid(hardwareid.size()).trimmed();
|
||||||
else if (line.startsWith(debug_token_author))
|
else if (line.startsWith(debug_token_author))
|
||||||
m_debugTokenAuthor = line.mid(debug_token_author.size()).trimmed();
|
m_debugTokenAuthor = line.mid(debug_token_author.size()).trimmed();
|
||||||
|
else if (line.startsWith(debug_token_validation_error))
|
||||||
|
m_debugTokenValidationError = line.mid(debug_token_validation_error.size()).trimmed();
|
||||||
else if (line.startsWith(debug_token_valid))
|
else if (line.startsWith(debug_token_valid))
|
||||||
m_debugTokenValid = line.mid(debug_token_valid.size()).trimmed() == QLatin1String("true");
|
m_debugTokenValid = line.mid(debug_token_valid.size()).trimmed() == QLatin1String("true");
|
||||||
else if (line.startsWith(simulator))
|
else if (line.startsWith(simulator))
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public:
|
|||||||
QString deviceOS() const;
|
QString deviceOS() const;
|
||||||
QString hardwareId() const;
|
QString hardwareId() const;
|
||||||
QString debugTokenAuthor() const;
|
QString debugTokenAuthor() const;
|
||||||
|
QString debugTokenValidationError() const;
|
||||||
bool debugTokenValid() const;
|
bool debugTokenValid() const;
|
||||||
QString scmBundle() const;
|
QString scmBundle() const;
|
||||||
QString hostName() const;
|
QString hostName() const;
|
||||||
@@ -75,6 +76,7 @@ private:
|
|||||||
QString m_debugTokenAuthor;
|
QString m_debugTokenAuthor;
|
||||||
QString m_scmBundle;
|
QString m_scmBundle;
|
||||||
QString m_hostName;
|
QString m_hostName;
|
||||||
|
QString m_debugTokenValidationError;
|
||||||
bool m_debugTokenValid;
|
bool m_debugTokenValid;
|
||||||
bool m_isSimulator;
|
bool m_isSimulator;
|
||||||
bool m_isProductionDevice;
|
bool m_isProductionDevice;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ BlackBerryNdkProcess::BlackBerryNdkProcess(const QString &command, QObject *pare
|
|||||||
{
|
{
|
||||||
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
|
|
||||||
|
connect(m_process, SIGNAL(started()), this, SIGNAL(started()));
|
||||||
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||||
this, SLOT(processFinished()));
|
this, SLOT(processFinished()));
|
||||||
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
connect(m_process, SIGNAL(error(QProcess::ProcessError)),
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void finished(int status);
|
void finished(int status);
|
||||||
|
void started();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit BlackBerryNdkProcess(const QString &command, QObject *parent = 0);
|
explicit BlackBerryNdkProcess(const QString &command, QObject *parent = 0);
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ SOURCES += qnxplugin.cpp \
|
|||||||
blackberrydebugtokenuploader.cpp \
|
blackberrydebugtokenuploader.cpp \
|
||||||
blackberrydebugtokenreader.cpp \
|
blackberrydebugtokenreader.cpp \
|
||||||
blackberryndkprocess.cpp \
|
blackberryndkprocess.cpp \
|
||||||
blackberrycheckdevmodestepfactory.cpp \
|
blackberrycheckdebugtokenstep.cpp \
|
||||||
blackberrycheckdevmodestep.cpp \
|
blackberrycheckdebugtokenstepconfigwidget.cpp \
|
||||||
blackberrycheckdevmodestepconfigwidget.cpp \
|
blackberrycheckdebugtokenstepfactory.cpp \
|
||||||
blackberrydeviceconnection.cpp \
|
blackberrydeviceconnection.cpp \
|
||||||
blackberrydeviceconnectionmanager.cpp \
|
blackberrydeviceconnectionmanager.cpp \
|
||||||
blackberrydeviceinformation.cpp \
|
blackberrydeviceinformation.cpp \
|
||||||
@@ -167,9 +167,9 @@ HEADERS += qnxplugin.h\
|
|||||||
blackberrydebugtokenuploader.h \
|
blackberrydebugtokenuploader.h \
|
||||||
blackberrydebugtokenreader.h \
|
blackberrydebugtokenreader.h \
|
||||||
blackberryndkprocess.h \
|
blackberryndkprocess.h \
|
||||||
blackberrycheckdevmodestepfactory.h \
|
blackberrycheckdebugtokenstep.h \
|
||||||
blackberrycheckdevmodestep.h \
|
blackberrycheckdebugtokenstepconfigwidget.h \
|
||||||
blackberrycheckdevmodestepconfigwidget.h \
|
blackberrycheckdebugtokenstepfactory.h \
|
||||||
blackberrydeviceconnection.h \
|
blackberrydeviceconnection.h \
|
||||||
blackberrydeviceconnectionmanager.h \
|
blackberrydeviceconnectionmanager.h \
|
||||||
blackberrydeviceinformation.h \
|
blackberrydeviceinformation.h \
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ QtcPlugin {
|
|||||||
"blackberryabstractdeploystep.h",
|
"blackberryabstractdeploystep.h",
|
||||||
"blackberryapplicationrunner.cpp",
|
"blackberryapplicationrunner.cpp",
|
||||||
"blackberryapplicationrunner.h",
|
"blackberryapplicationrunner.h",
|
||||||
"blackberrycheckdevmodestep.cpp",
|
"blackberrycheckdebugtokenstep.cpp",
|
||||||
"blackberrycheckdevmodestep.h",
|
"blackberrycheckdebugtokenstep.h",
|
||||||
"blackberrycheckdevmodestepconfigwidget.cpp",
|
"blackberrycheckdebugtokenstepconfigwidget.cpp",
|
||||||
"blackberrycheckdevmodestepconfigwidget.h",
|
"blackberrycheckdebugtokenstepconfigwidget.h",
|
||||||
"blackberrycheckdevmodestepfactory.cpp",
|
"blackberrycheckdebugtokenstepfactory.cpp",
|
||||||
"blackberrycheckdevmodestepfactory.h",
|
"blackberrycheckdebugtokenstepfactory.h",
|
||||||
"blackberryconfigurationmanager.cpp",
|
"blackberryconfigurationmanager.cpp",
|
||||||
"blackberryconfigurationmanager.h",
|
"blackberryconfigurationmanager.h",
|
||||||
"blackberrycreatepackagestep.cpp",
|
"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_CREATE_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxCreatePackageBuildStep";
|
||||||
const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep";
|
const char QNX_DEPLOY_PACKAGE_BS_ID[] = "Qt4ProjectManager.QnxDeployPackageBuildStep";
|
||||||
const char QNX_CHECK_DEVELOPMENT_MODE_BS_ID[] = "Qt4ProjectManager.QnxCheckDevelopmentModeBuildStep";
|
const char QNX_CHECK_DEBUG_TOKEN_BS_ID[] = "Qt4ProjectManager.QnxCheckDebugTokenBuildStep";
|
||||||
|
|
||||||
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
|
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include "bardescriptoreditorfactory.h"
|
#include "bardescriptoreditorfactory.h"
|
||||||
#include "bardescriptormagicmatcher.h"
|
#include "bardescriptormagicmatcher.h"
|
||||||
#include "blackberrykeyspage.h"
|
#include "blackberrykeyspage.h"
|
||||||
#include "blackberrycheckdevmodestepfactory.h"
|
#include "blackberrycheckdebugtokenstepfactory.h"
|
||||||
#include "blackberrydeviceconnectionmanager.h"
|
#include "blackberrydeviceconnectionmanager.h"
|
||||||
#include "blackberryconfigurationmanager.h"
|
#include "blackberryconfigurationmanager.h"
|
||||||
#include "cascadesimport/cascadesimportwizard.h"
|
#include "cascadesimport/cascadesimportwizard.h"
|
||||||
@@ -91,7 +91,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
|
|||||||
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
||||||
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
||||||
addAutoReleasedObject(new BlackBerryKeysPage);
|
addAutoReleasedObject(new BlackBerryKeysPage);
|
||||||
addAutoReleasedObject(new BlackBerryCheckDevModeStepFactory);
|
addAutoReleasedObject(new BlackBerryCheckDebugTokenStepFactory);
|
||||||
addAutoReleasedObject(new CascadesImportWizard);
|
addAutoReleasedObject(new CascadesImportWizard);
|
||||||
BlackBerryDeviceConnectionManager::instance()->initialize();
|
BlackBerryDeviceConnectionManager::instance()->initialize();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user