remotelinux: Add generic Runconfiguration interface

Adds a generic interface (AbstractRemoteLinuxRunConfiguration), so plugins
can ship a custom remote runconfig.

Change-Id: I4ef8e39c4c69224d4e55224c782f3d544f10c945
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
This commit is contained in:
Benjamin Zeller
2014-04-08 11:07:42 +02:00
parent d33e66c895
commit 0d017e5a5d
16 changed files with 151 additions and 31 deletions

View File

@@ -0,0 +1,50 @@
/****************************************************************************
**
** Copyright (C) 2014 Canonical Ltd.
** Contact: http://www.qt-project.org/legal
**
** 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 "abstractremotelinuxrunconfiguration.h"
namespace RemoteLinux {
AbstractRemoteLinuxRunConfiguration::AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
Core::Id id): RunConfiguration(parent, id)
{
}
AbstractRemoteLinuxRunConfiguration::~AbstractRemoteLinuxRunConfiguration()
{
}
AbstractRemoteLinuxRunConfiguration::AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
AbstractRemoteLinuxRunConfiguration *source): RunConfiguration(parent, source)
{
}
} // namespace RemoteLinux

View File

@@ -0,0 +1,65 @@
/****************************************************************************
**
** Copyright (C) 2014 Canonical Ltd.
** Contact: http://www.qt-project.org/legal
**
** 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 REMOTELINUX_ABSTRACTREMOTELINUXRUNCONFIGURATION_H
#define REMOTELINUX_ABSTRACTREMOTELINUXRUNCONFIGURATION_H
#include "remotelinux_export.h"
#include <projectexplorer/runconfiguration.h>
QT_FORWARD_DECLARE_CLASS(QStringList)
namespace Utils { class Environment; }
namespace RemoteLinux {
class REMOTELINUX_EXPORT AbstractRemoteLinuxRunConfiguration :
public ProjectExplorer::RunConfiguration
{
Q_OBJECT
Q_DISABLE_COPY(AbstractRemoteLinuxRunConfiguration)
public:
AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id);
~AbstractRemoteLinuxRunConfiguration();
virtual QString localExecutableFilePath() const = 0;
virtual QString remoteExecutableFilePath() const = 0;
virtual QStringList arguments() const = 0;
virtual QString workingDirectory() const = 0;
virtual Utils::Environment environment() const = 0;
protected:
AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
AbstractRemoteLinuxRunConfiguration *source);
};
} // namespace RemoteLinux
#endif // REMOTELINUX_ABSTRACTREMOTELINUXRUNCONFIGURATION_H

View File

@@ -28,7 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "abstractremotelinuxrunsupport.h" #include "abstractremotelinuxrunsupport.h"
#include "remotelinuxrunconfiguration.h" #include "abstractremotelinuxrunconfiguration.h"
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
@@ -45,7 +45,7 @@ namespace Internal {
class AbstractRemoteLinuxRunSupportPrivate class AbstractRemoteLinuxRunSupportPrivate
{ {
public: public:
AbstractRemoteLinuxRunSupportPrivate(const RemoteLinuxRunConfiguration *runConfig) AbstractRemoteLinuxRunSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig)
: state(AbstractRemoteLinuxRunSupport::Inactive), : state(AbstractRemoteLinuxRunSupport::Inactive),
device(DeviceKitInformation::device(runConfig->target()->kit())), device(DeviceKitInformation::device(runConfig->target()->kit())),
remoteFilePath(runConfig->remoteExecutableFilePath()), remoteFilePath(runConfig->remoteExecutableFilePath()),
@@ -70,7 +70,7 @@ public:
using namespace Internal; using namespace Internal;
AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig, QObject *parent) AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig, QObject *parent)
: QObject(parent), : QObject(parent),
d(new AbstractRemoteLinuxRunSupportPrivate(runConfig)) d(new AbstractRemoteLinuxRunSupportPrivate(runConfig))
{ {

View File

@@ -42,7 +42,7 @@ namespace Utils { class Environment; }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration; class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; } namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; }
@@ -58,7 +58,7 @@ protected:
Running Running
}; };
public: public:
AbstractRemoteLinuxRunSupport(RemoteLinuxRunConfiguration *runConfig, AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
QObject *parent = 0); QObject *parent = 0);
~AbstractRemoteLinuxRunSupport(); ~AbstractRemoteLinuxRunSupport();

View File

@@ -10,6 +10,7 @@ HEADERS += \
remotelinuxplugin.h \ remotelinuxplugin.h \
remotelinux_export.h \ remotelinux_export.h \
linuxdevice.h \ linuxdevice.h \
abstractremotelinuxrunconfiguration.h \
remotelinuxrunconfiguration.h \ remotelinuxrunconfiguration.h \
publickeydeploymentdialog.h \ publickeydeploymentdialog.h \
genericlinuxdeviceconfigurationwizard.h \ genericlinuxdeviceconfigurationwizard.h \
@@ -56,6 +57,7 @@ SOURCES += \
remotelinuxenvironmentaspectwidget.cpp \ remotelinuxenvironmentaspectwidget.cpp \
remotelinuxplugin.cpp \ remotelinuxplugin.cpp \
linuxdevice.cpp \ linuxdevice.cpp \
abstractremotelinuxrunconfiguration.cpp \
remotelinuxrunconfiguration.cpp \ remotelinuxrunconfiguration.cpp \
publickeydeploymentdialog.cpp \ publickeydeploymentdialog.cpp \
genericlinuxdeviceconfigurationwizard.cpp \ genericlinuxdeviceconfigurationwizard.cpp \

View File

@@ -25,6 +25,8 @@ QtcPlugin {
"abstractremotelinuxdeploystep.h", "abstractremotelinuxdeploystep.h",
"abstractremotelinuxrunsupport.cpp", "abstractremotelinuxrunsupport.cpp",
"abstractremotelinuxrunsupport.h", "abstractremotelinuxrunsupport.h",
"abstractremotelinuxrunconfiguration.h",
"abstractremotelinuxrunconfiguration.cpp",
"abstractuploadandinstallpackageservice.cpp", "abstractuploadandinstallpackageservice.cpp",
"abstractuploadandinstallpackageservice.h", "abstractuploadandinstallpackageservice.h",
"embeddedlinuxqtversion.cpp", "embeddedlinuxqtversion.cpp",
@@ -109,7 +111,7 @@ QtcPlugin {
"typespecificdeviceconfigurationlistmodel.h", "typespecificdeviceconfigurationlistmodel.h",
"uploadandinstalltarpackagestep.cpp", "uploadandinstalltarpackagestep.cpp",
"uploadandinstalltarpackagestep.h", "uploadandinstalltarpackagestep.h",
"images/embeddedtarget.png", "images/embeddedtarget.png"
] ]
Export { Export {

View File

@@ -73,7 +73,7 @@ public:
using namespace Internal; using namespace Internal;
AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig, AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig,
RunMode runMode) RunMode runMode)
{ {
AnalyzerStartParameters params; AnalyzerStartParameters params;
@@ -88,7 +88,7 @@ AnalyzerStartParameters RemoteLinuxAnalyzeSupport::startParameters(const RemoteL
return params; return params;
} }
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig, RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
AnalyzerRunControl *engine, RunMode runMode) AnalyzerRunControl *engine, RunMode runMode)
: AbstractRemoteLinuxRunSupport(runConfig, engine), : AbstractRemoteLinuxRunSupport(runConfig, engine),
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode)) d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))

View File

@@ -41,7 +41,7 @@ class AnalyzerRunControl;
} }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration; class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; } namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; }
@@ -49,10 +49,10 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
{ {
Q_OBJECT Q_OBJECT
public: public:
static Analyzer::AnalyzerStartParameters startParameters(const RemoteLinuxRunConfiguration *runConfig, static Analyzer::AnalyzerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig,
ProjectExplorer::RunMode runMode); ProjectExplorer::RunMode runMode);
RemoteLinuxAnalyzeSupport(RemoteLinuxRunConfiguration *runConfig, RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
Analyzer::AnalyzerRunControl *engine, ProjectExplorer::RunMode runMode); Analyzer::AnalyzerRunControl *engine, ProjectExplorer::RunMode runMode);
~RemoteLinuxAnalyzeSupport(); ~RemoteLinuxAnalyzeSupport();

View File

@@ -55,7 +55,7 @@ namespace Internal {
class LinuxDeviceDebugSupportPrivate class LinuxDeviceDebugSupportPrivate
{ {
public: public:
LinuxDeviceDebugSupportPrivate(const RemoteLinuxRunConfiguration *runConfig, LinuxDeviceDebugSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine) DebuggerEngine *engine)
: engine(engine), : engine(engine),
qmlDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()), qmlDebugging(runConfig->extraAspect<Debugger::DebuggerRunConfigurationAspect>()->useQmlDebugger()),
@@ -76,7 +76,7 @@ public:
using namespace Internal; using namespace Internal;
DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const RemoteLinuxRunConfiguration *runConfig) DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig)
{ {
DebuggerStartParameters params; DebuggerStartParameters params;
Target *target = runConfig->target(); Target *target = runConfig->target();
@@ -118,10 +118,10 @@ DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const RemoteLin
return params; return params;
} }
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RemoteLinuxRunConfiguration *runConfig, LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
DebuggerEngine *engine) DebuggerEngine *engine)
: AbstractRemoteLinuxRunSupport(runConfig, engine), : AbstractRemoteLinuxRunSupport(runConfig, engine),
d(new LinuxDeviceDebugSupportPrivate(static_cast<RemoteLinuxRunConfiguration *>(runConfig), engine)) d(new LinuxDeviceDebugSupportPrivate(static_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig), engine))
{ {
connect(d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleRemoteSetupRequested())); connect(d->engine, SIGNAL(requestRemoteSetup()), this, SLOT(handleRemoteSetupRequested()));
} }

View File

@@ -38,7 +38,7 @@ class DebuggerStartParameters;
} }
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxRunConfiguration; class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class LinuxDeviceDebugSupportPrivate; } namespace Internal { class LinuxDeviceDebugSupportPrivate; }
@@ -46,9 +46,9 @@ class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public AbstractRemoteLinuxRun
{ {
Q_OBJECT Q_OBJECT
public: public:
static Debugger::DebuggerStartParameters startParameters(const RemoteLinuxRunConfiguration *runConfig); static Debugger::DebuggerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig);
LinuxDeviceDebugSupport(RemoteLinuxRunConfiguration *runConfig, LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
Debugger::DebuggerEngine *engine); Debugger::DebuggerEngine *engine);
~LinuxDeviceDebugSupport(); ~LinuxDeviceDebugSupport();

View File

@@ -73,9 +73,9 @@ Utils::Environment RemoteLinuxEnvironmentAspect::baseEnvironment() const
return Utils::Environment(); return Utils::Environment();
} }
RemoteLinuxRunConfiguration *RemoteLinuxEnvironmentAspect::runConfiguration() const AbstractRemoteLinuxRunConfiguration *RemoteLinuxEnvironmentAspect::runConfiguration() const
{ {
return qobject_cast<RemoteLinuxRunConfiguration *>(EnvironmentAspect::runConfiguration()); return qobject_cast<AbstractRemoteLinuxRunConfiguration *>(EnvironmentAspect::runConfiguration());
} }
Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const

View File

@@ -30,7 +30,7 @@
#ifndef REMOTELINUXENVIRONMENTASPECT_H #ifndef REMOTELINUXENVIRONMENTASPECT_H
#define REMOTELINUXENVIRONMENTASPECT_H #define REMOTELINUXENVIRONMENTASPECT_H
#include "remotelinuxrunconfiguration.h" #include "abstractremotelinuxrunconfiguration.h"
#include "remotelinux_export.h" #include "remotelinux_export.h"
@@ -38,7 +38,7 @@
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxEnvironmentAspectWidget; class RemoteLinuxEnvironmentAspectWidget;
class RemoteLinuxRunConfiguration; class AbstractRemoteLinuxRunConfiguration;
class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::EnvironmentAspect class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::EnvironmentAspect
{ {
@@ -53,7 +53,7 @@ public:
QString baseEnvironmentDisplayName(int base) const; QString baseEnvironmentDisplayName(int base) const;
Utils::Environment baseEnvironment() const; Utils::Environment baseEnvironment() const;
RemoteLinuxRunConfiguration *runConfiguration() const; AbstractRemoteLinuxRunConfiguration *runConfiguration() const;
Utils::Environment remoteEnvironment() const; Utils::Environment remoteEnvironment() const;
void setRemoteEnvironment(const Utils::Environment &env); void setRemoteEnvironment(const Utils::Environment &env);

View File

@@ -84,7 +84,7 @@ using namespace Internal;
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const Core::Id id,
const QString &proFilePath) const QString &proFilePath)
: RunConfiguration(parent, id), : AbstractRemoteLinuxRunConfiguration(parent, id),
d(new RemoteLinuxRunConfigurationPrivate(proFilePath)) d(new RemoteLinuxRunConfigurationPrivate(proFilePath))
{ {
init(); init();
@@ -92,7 +92,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, const C
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
RemoteLinuxRunConfiguration *source) RemoteLinuxRunConfiguration *source)
: RunConfiguration(parent, source), : AbstractRemoteLinuxRunConfiguration(parent, source),
d(new RemoteLinuxRunConfigurationPrivate(source->d)) d(new RemoteLinuxRunConfigurationPrivate(source->d))
{ {
init(); init();

View File

@@ -31,6 +31,7 @@
#define REMOTELINUXRUNCONFIGURATION_H #define REMOTELINUXRUNCONFIGURATION_H
#include "remotelinux_export.h" #include "remotelinux_export.h"
#include "abstractremotelinuxrunconfiguration.h"
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
@@ -50,7 +51,7 @@ class RemoteLinuxRunConfigurationPrivate;
class RemoteLinuxRunConfigurationFactory; class RemoteLinuxRunConfigurationFactory;
} // namespace Internal } // namespace Internal
class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public AbstractRemoteLinuxRunConfiguration
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(RemoteLinuxRunConfiguration) Q_DISABLE_COPY(RemoteLinuxRunConfiguration)

View File

@@ -29,7 +29,7 @@
#include "remotelinuxruncontrol.h" #include "remotelinuxruncontrol.h"
#include "remotelinuxrunconfiguration.h" #include "abstractremotelinuxrunconfiguration.h"
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
@@ -60,7 +60,7 @@ RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
{ {
d->running = false; d->running = false;
d->device = DeviceKitInformation::device(rc->target()->kit()); d->device = DeviceKitInformation::device(rc->target()->kit());
const RemoteLinuxRunConfiguration * const lrc = qobject_cast<RemoteLinuxRunConfiguration *>(rc); const AbstractRemoteLinuxRunConfiguration * const lrc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(rc);
d->remoteExecutable = lrc->remoteExecutableFilePath(); d->remoteExecutable = lrc->remoteExecutableFilePath();
d->arguments = lrc->arguments(); d->arguments = lrc->arguments();
d->environment = lrc->environment(); d->environment = lrc->environment();

View File

@@ -37,7 +37,7 @@
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerrunconfigwidget.h> #include <analyzerbase/analyzerrunconfigwidget.h>
#include <remotelinux/remotelinuxrunconfiguration.h> #include <remotelinux/abstractremotelinuxrunconfiguration.h>
#include <debugger/debuggerrunconfigurationaspect.h> #include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/environmentaspect.h> #include <projectexplorer/environmentaspect.h>
@@ -94,8 +94,8 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
sp.connParams.host = server.serverAddress().toString(); sp.connParams.host = server.serverAddress().toString();
sp.connParams.port = server.serverPort(); sp.connParams.port = server.serverPort();
sp.startMode = StartLocal; sp.startMode = StartLocal;
} else if (RemoteLinux::RemoteLinuxRunConfiguration *rc2 = } else if (RemoteLinux::AbstractRemoteLinuxRunConfiguration *rc2 =
qobject_cast<RemoteLinux::RemoteLinuxRunConfiguration *>(runConfiguration)) { qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
sp.startMode = StartRemote; sp.startMode = StartRemote;
sp.debuggee = rc2->remoteExecutableFilePath(); sp.debuggee = rc2->remoteExecutableFilePath();
sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters(); sp.connParams = DeviceKitInformation::device(rc2->target()->kit())->sshParameters();