forked from qt-creator/qt-creator
QNX: Abort deployment if device is not in Development Mode
This adds a new deploy step (BlackBerryCheckDevModeStep), which checks for Development Mode being set on the device. If not set, the deployment stops early on in the process. Without this step, the deployment would not fail until after uploading the package. Moved blackberry-deploy into a constant, as it's used in multiple places by now. Change-Id: I813754108fb4be281e752b12ac56d4f0b302077d Reviewed-by: Mehdi Fekari <mfekari@rim.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
committed by
Tobias Nätterlund
parent
3e373927c5
commit
e72d41cb1e
@@ -32,7 +32,9 @@
|
||||
#include "blackberryabstractdeploystep.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/task.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
@@ -176,6 +178,13 @@ void BlackBerryAbstractDeployStep::emitOutputInfo(const ProjectExplorer::Process
|
||||
BuildStep::MessageOutput);
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::raiseError(const QString &errorMessage)
|
||||
{
|
||||
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
}
|
||||
|
||||
void BlackBerryAbstractDeployStep::processReadyReadStdOutput()
|
||||
{
|
||||
m_process->setReadChannel(QProcess::StandardOutput);
|
||||
|
||||
@@ -71,6 +71,8 @@ protected:
|
||||
|
||||
void emitOutputInfo(const ProjectExplorer::ProcessParameters ¶ms, const QString& arguments);
|
||||
|
||||
void raiseError(const QString &errorMessage);
|
||||
|
||||
private slots:
|
||||
void processReadyReadStdOutput();
|
||||
void processReadyReadStdError();
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "blackberrydeployconfiguration.h"
|
||||
#include "blackberryrunconfiguration.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <qt4projectmanager/qt4buildconfiguration.h>
|
||||
@@ -43,8 +44,6 @@
|
||||
#include <QDir>
|
||||
|
||||
namespace {
|
||||
const char DEPLOY_CMD[] = "blackberry-deploy";
|
||||
|
||||
qint64 parsePid(const QString &line)
|
||||
{
|
||||
QTC_ASSERT(line.startsWith(QLatin1String("result::")), return -1);
|
||||
@@ -103,7 +102,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe
|
||||
Target *target = runConfiguration->target();
|
||||
BuildConfiguration *buildConfig = target->activeBuildConfiguration();
|
||||
m_environment = buildConfig->environment();
|
||||
m_deployCmd = m_environment.searchInPath(QLatin1String(DEPLOY_CMD));
|
||||
m_deployCmd = m_environment.searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
|
||||
|
||||
m_device = BlackBerryDeviceConfiguration::device(target->kit());
|
||||
m_barPackage = runConfiguration->barPackage();
|
||||
|
||||
135
src/plugins/qnx/blackberrycheckdevmodestep.cpp
Normal file
135
src/plugins/qnx/blackberrycheckdevmodestep.cpp
Normal file
@@ -0,0 +1,135 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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;
|
||||
|
||||
namespace {
|
||||
const char ERROR_MESSAGE_START[] = "Error: ";
|
||||
const char AUTHENTICATION_ERROR[] = "Authentication failed.";
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
void BlackBerryCheckDevModeStep::stdOutput(const QString &line)
|
||||
{
|
||||
handleErrorOutput(line);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDevModeStep::stdError(const QString &line)
|
||||
{
|
||||
handleErrorOutput(line);
|
||||
}
|
||||
|
||||
void BlackBerryCheckDevModeStep::handleErrorOutput(const QString &line)
|
||||
{
|
||||
if (line.startsWith(QLatin1String(ERROR_MESSAGE_START))) {
|
||||
if (line.contains(QLatin1String(AUTHENTICATION_ERROR)))
|
||||
raiseError(tr("Authentication failed. Please make sure the password for the device is correct."));
|
||||
else
|
||||
raiseError(line);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
68
src/plugins/qnx/blackberrycheckdevmodestep.h
Normal file
68
src/plugins/qnx/blackberrycheckdevmodestep.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
||||
|
||||
#include "blackberryabstractdeploystep.h"
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCheckDevModeStep : public BlackBerryAbstractDeployStep
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class BlackBerryCheckDevModeStepFactory;
|
||||
|
||||
public:
|
||||
explicit BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl);
|
||||
|
||||
bool init();
|
||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
|
||||
void stdOutput(const QString &line);
|
||||
void stdError(const QString &line);
|
||||
|
||||
protected:
|
||||
BlackBerryCheckDevModeStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCheckDevModeStep *bs);
|
||||
|
||||
void processStarted(const ProjectExplorer::ProcessParameters ¶ms);
|
||||
|
||||
private:
|
||||
void handleErrorOutput(const QString &line);
|
||||
|
||||
QString password() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEP_H
|
||||
55
src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.cpp
Normal file
55
src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycheckdevmodestepconfigwidget.h"
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BlackBerryCheckDevModeStepConfigWidget::BlackBerryCheckDevModeStepConfigWidget() :
|
||||
ProjectExplorer::BuildStepConfigWidget()
|
||||
{
|
||||
}
|
||||
|
||||
QString BlackBerryCheckDevModeStepConfigWidget::displayName() const
|
||||
{
|
||||
return tr("<b>Check development mode</b>");
|
||||
}
|
||||
|
||||
QString BlackBerryCheckDevModeStepConfigWidget::summaryText() const
|
||||
{
|
||||
return displayName();
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDevModeStepConfigWidget::showWidget() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
55
src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.h
Normal file
55
src/plugins/qnx/blackberrycheckdevmodestepconfigwidget.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCheckDevModeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackBerryCheckDevModeStepConfigWidget();
|
||||
|
||||
QString displayName() const;
|
||||
QString summaryText() const;
|
||||
|
||||
bool showWidget() const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPCONFIGWIDGET_H
|
||||
108
src/plugins/qnx/blackberrycheckdevmodestepfactory.cpp
Normal file
108
src/plugins/qnx/blackberrycheckdevmodestepfactory.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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 "blackberrycheckdevmodestepfactory.h"
|
||||
|
||||
#include "blackberrycheckdevmodestep.h"
|
||||
#include "blackberrydeviceconfigurationfactory.h"
|
||||
#include "qnxconstants.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
BlackBerryCheckDevModeStepFactory::BlackBerryCheckDevModeStepFactory(QObject *parent) :
|
||||
ProjectExplorer::IBuildStepFactory(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QList<Core::Id> BlackBerryCheckDevModeStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
|
||||
{
|
||||
if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
return QList<Core::Id>();
|
||||
|
||||
Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
|
||||
if (deviceType != BlackBerryDeviceConfigurationFactory::deviceType())
|
||||
return QList<Core::Id>();
|
||||
|
||||
return QList<Core::Id>() << Core::Id(Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID);
|
||||
}
|
||||
|
||||
QString BlackBerryCheckDevModeStepFactory::displayNameForId(const Core::Id id) const
|
||||
{
|
||||
if (id == Constants::QNX_CHECK_DEVELOPMENT_MODE_BS_ID)
|
||||
return tr("Check Development Mode");
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDevModeStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
|
||||
{
|
||||
return availableCreationIds(parent).contains(id);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
|
||||
{
|
||||
if (!canCreate(parent, id))
|
||||
return 0;
|
||||
return new BlackBerryCheckDevModeStep(parent);
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDevModeStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
|
||||
{
|
||||
return canCreate(parent, ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
|
||||
{
|
||||
if (!canRestore(parent, map))
|
||||
return 0;
|
||||
BlackBerryCheckDevModeStep *bs = new BlackBerryCheckDevModeStep(parent);
|
||||
if (bs->fromMap(map))
|
||||
return bs;
|
||||
delete bs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool BlackBerryCheckDevModeStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
|
||||
{
|
||||
return canCreate(parent, product->id());
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *BlackBerryCheckDevModeStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
|
||||
{
|
||||
if (!canClone(parent, product))
|
||||
return 0;
|
||||
return new BlackBerryCheckDevModeStep(parent, static_cast<BlackBerryCheckDevModeStep *>(product));
|
||||
}
|
||||
64
src/plugins/qnx/blackberrycheckdevmodestepfactory.h
Normal file
64
src/plugins/qnx/blackberrycheckdevmodestepfactory.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 - 2013 Research In Motion
|
||||
**
|
||||
** Contact: Research In Motion (blackberry-qt@qnx.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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
|
||||
#define QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
class BlackBerryCheckDevModeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BlackBerryCheckDevModeStepFactory(QObject *parent = 0);
|
||||
|
||||
QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const;
|
||||
QString displayNameForId(const Core::Id id) const;
|
||||
|
||||
bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const;
|
||||
ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id);
|
||||
|
||||
bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const;
|
||||
ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent,
|
||||
const QVariantMap &map);
|
||||
|
||||
bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const;
|
||||
ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent,
|
||||
ProjectExplorer::BuildStep *product);
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qnx
|
||||
|
||||
#endif // QNX_INTERNAL_BLACKBERRYCHECKDEVMODESTEPFACTORY_H
|
||||
@@ -153,13 +153,6 @@ QString BlackBerryCreatePackageStep::debugToken() const
|
||||
return device->debugToken();
|
||||
}
|
||||
|
||||
void BlackBerryCreatePackageStep::raiseError(const QString &errorMessage)
|
||||
{
|
||||
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
}
|
||||
|
||||
bool BlackBerryCreatePackageStep::prepareAppDescriptorFile(const QString &appDescriptorPath, const QString &preparedFilePath)
|
||||
{
|
||||
BlackBerryQtVersion *qtVersion = dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(target()->kit()));
|
||||
|
||||
@@ -57,8 +57,6 @@ public:
|
||||
protected:
|
||||
BlackBerryCreatePackageStep(ProjectExplorer::BuildStepList *bsl, BlackBerryCreatePackageStep *bs);
|
||||
|
||||
void raiseError(const QString &errorMessage);
|
||||
|
||||
private:
|
||||
bool prepareAppDescriptorFile(const QString &appDescriptorPath, const QString &preparedFilePath);
|
||||
};
|
||||
|
||||
@@ -31,8 +31,9 @@
|
||||
|
||||
#include "blackberrydebugtokenuploader.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
|
||||
namespace {
|
||||
static const char PROCESS_NAME[] = "blackberry-deploy";
|
||||
static const char ERR_NO_ROUTE_HOST[] = "Cannot connect";
|
||||
static const char ERR_AUTH_FAILED[] = "Authentication failed";
|
||||
static const char ERR_DEVELOPMENT_MODE_DISABLED[] = "Device is not in the Development Mode";
|
||||
@@ -42,7 +43,7 @@ namespace Qnx {
|
||||
namespace Internal {
|
||||
|
||||
BlackBerryDebugTokenUploader::BlackBerryDebugTokenUploader(QObject *parent) :
|
||||
BlackBerryNdkProcess(QLatin1String(PROCESS_NAME), parent)
|
||||
BlackBerryNdkProcess(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD), parent)
|
||||
{
|
||||
addErrorStringMapping(QLatin1String(ERR_NO_ROUTE_HOST), NoRouteToHost);
|
||||
addErrorStringMapping(QLatin1String(ERR_AUTH_FAILED), AuthenticationFailed);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "blackberrydeployconfigurationfactory.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "blackberrycheckdevmodestep.h"
|
||||
#include "blackberrydeployconfiguration.h"
|
||||
#include "blackberrycreatepackagestep.h"
|
||||
#include "blackberrydeploystep.h"
|
||||
@@ -92,8 +93,9 @@ ProjectExplorer::DeployConfiguration *BlackBerryDeployConfigurationFactory::crea
|
||||
return 0;
|
||||
|
||||
BlackBerryDeployConfiguration *dc = new BlackBerryDeployConfiguration(parent);
|
||||
dc->stepList()->insertStep(0, new BlackBerryCreatePackageStep(dc->stepList()));
|
||||
dc->stepList()->insertStep(1, new BlackBerryDeployStep(dc->stepList()));
|
||||
dc->stepList()->insertStep(0, new BlackBerryCheckDevModeStep(dc->stepList()));
|
||||
dc->stepList()->insertStep(1, new BlackBerryCreatePackageStep(dc->stepList()));
|
||||
dc->stepList()->insertStep(2, new BlackBerryDeployStep(dc->stepList()));
|
||||
return dc;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,6 @@ using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
namespace {
|
||||
const char DEPLOY_CMD[] = "blackberry-deploy";
|
||||
|
||||
int parseProgress(const QString &line)
|
||||
{
|
||||
const QString startOfLine = QLatin1String("Info: Progress ");
|
||||
@@ -90,10 +88,10 @@ bool BlackBerryDeployStep::init()
|
||||
if (!BlackBerryAbstractDeployStep::init())
|
||||
return false;
|
||||
|
||||
QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(DEPLOY_CMD));
|
||||
QString deployCmd = target()->activeBuildConfiguration()->environment().searchInPath(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD));
|
||||
if (deployCmd.isEmpty()) {
|
||||
raiseError(tr("Could not find deploy command '%1' in the build environment")
|
||||
.arg(QLatin1String(DEPLOY_CMD)));
|
||||
.arg(QLatin1String(Constants::QNX_BLACKBERRY_DEPLOY_CMD)));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -189,10 +187,3 @@ QString BlackBerryDeployStep::password() const
|
||||
return device->sshParameters().password;
|
||||
return QString();
|
||||
}
|
||||
|
||||
void BlackBerryDeployStep::raiseError(const QString &errorMessage)
|
||||
{
|
||||
emit addOutput(errorMessage, BuildStep::ErrorMessageOutput);
|
||||
emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, Utils::FileName(), -1,
|
||||
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
|
||||
}
|
||||
|
||||
@@ -58,8 +58,6 @@ protected:
|
||||
void stdOutput(const QString &line);
|
||||
void processStarted(const ProjectExplorer::ProcessParameters ¶ms);
|
||||
|
||||
void raiseError(const QString &errorMessage);
|
||||
|
||||
private:
|
||||
QString deviceHost() const;
|
||||
QString password() const;
|
||||
|
||||
@@ -74,7 +74,10 @@ SOURCES += qnxplugin.cpp \
|
||||
blackberrydebugtokenuploader.cpp \
|
||||
blackberrydebugtokenreader.cpp \
|
||||
blackberryndkprocess.cpp \
|
||||
blackberrydeviceprocesssupport.cpp
|
||||
blackberrydeviceprocesssupport.cpp \
|
||||
blackberrycheckdevmodestepfactory.cpp \
|
||||
blackberrycheckdevmodestep.cpp \
|
||||
blackberrycheckdevmodestepconfigwidget.cpp
|
||||
|
||||
HEADERS += qnxplugin.h\
|
||||
qnxconstants.h \
|
||||
@@ -145,7 +148,10 @@ HEADERS += qnxplugin.h\
|
||||
blackberrydebugtokenuploader.h \
|
||||
blackberrydebugtokenreader.h \
|
||||
blackberryndkprocess.h \
|
||||
blackberrydeviceprocesssupport.h
|
||||
blackberrydeviceprocesssupport.h \
|
||||
blackberrycheckdevmodestepfactory.h \
|
||||
blackberrycheckdevmodestep.h \
|
||||
blackberrycheckdevmodestepconfigwidget.h
|
||||
|
||||
FORMS += \
|
||||
blackberrydeviceconfigurationwizardsetuppage.ui \
|
||||
|
||||
@@ -37,6 +37,12 @@ QtcPlugin {
|
||||
"blackberryabstractdeploystep.h",
|
||||
"blackberryapplicationrunner.cpp",
|
||||
"blackberryapplicationrunner.h",
|
||||
"blackberrycheckdevmodestep.cpp",
|
||||
"blackberrycheckdevmodestep.h",
|
||||
"blackberrycheckdevmodestepconfigwidget.cpp",
|
||||
"blackberrycheckdevmodestepconfigwidget.h",
|
||||
"blackberrycheckdevmodestepfactory.cpp",
|
||||
"blackberrycheckdevmodestepfactory.h",
|
||||
"blackberryconnect.cpp",
|
||||
"blackberryconnect.h",
|
||||
"blackberrycreatepackagestep.cpp",
|
||||
|
||||
@@ -69,6 +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_DEVELOPMENT_MODE_BS_ID[] = "Qt4ProjectManager.QnxCheckDevelopmentModeBuildStep";
|
||||
|
||||
const char QNX_PROFILEPATH_KEY[] = "Qt4ProjectManager.QnxRunConfiguration.ProFilePath";
|
||||
|
||||
@@ -103,6 +104,9 @@ const char QNX_TASK_CATEGORY_BARDESCRIPTOR[] = "Task.Category.BarDescriptor";
|
||||
const char QNX_KEY_AUTHOR[] = "author";
|
||||
const char QNX_KEY_PATH[] = "path";
|
||||
const char QNX_KEY_ACTIVE[] = "active";
|
||||
|
||||
const char QNX_BLACKBERRY_DEPLOY_CMD[] = "blackberry-deploy";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Qnx
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "bardescriptoreditorfactory.h"
|
||||
#include "bardescriptormagicmatcher.h"
|
||||
#include "blackberrykeyspage.h"
|
||||
#include "blackberrycheckdevmodestepfactory.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
@@ -80,6 +81,7 @@ bool QNXPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
addAutoReleasedObject(new BlackBerryRunControlFactory);
|
||||
addAutoReleasedObject(new BlackBerryNDKSettingsPage);
|
||||
addAutoReleasedObject(new BlackBerryKeysPage);
|
||||
addAutoReleasedObject(new BlackBerryCheckDevModeStepFactory);
|
||||
|
||||
// Handles QNX
|
||||
addAutoReleasedObject(new QnxQtVersionFactory);
|
||||
|
||||
Reference in New Issue
Block a user