RemoteLinux/Qnx: Use StandardRunnable

Change-Id: I73331985eb68065b5fb123ff4491888d824de766
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
hjk
2016-01-26 15:53:26 +01:00
parent bfa292cdc9
commit 7be3eb85e1
27 changed files with 190 additions and 347 deletions

View File

@@ -41,11 +41,8 @@ using namespace Qnx::Internal;
QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent) QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent)
: QObject(parent) : QObject(parent)
, m_remoteExecutable(runConfig->remoteExecutableFilePath())
, m_device(DeviceKitInformation::device(runConfig->target()->kit())) , m_device(DeviceKitInformation::device(runConfig->target()->kit()))
, m_state(Inactive) , m_state(Inactive)
, m_environment(runConfig->environment())
, m_workingDir(runConfig->workingDirectory())
{ {
m_runner = new DeviceApplicationRunner(this); m_runner = new DeviceApplicationRunner(this);
m_portsGatherer = new DeviceUsedPortsGatherer(this); m_portsGatherer = new DeviceUsedPortsGatherer(this);
@@ -127,8 +124,3 @@ bool QnxAbstractRunSupport::setPort(int &port)
} }
return true; return true;
} }
QString QnxAbstractRunSupport::executable() const
{
return m_remoteExecutable;
}

View File

@@ -60,10 +60,6 @@ protected:
bool setPort(int &port); bool setPort(int &port);
virtual void startExecution() = 0; virtual void startExecution() = 0;
virtual QString executable() const;
Utils::Environment environment() const { return m_environment; }
QString workingDirectory() const { return m_workingDir; }
void setFinished(); void setFinished();
State state() const; State state() const;
@@ -87,12 +83,9 @@ private slots:
private: private:
ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer; ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer;
Utils::PortList m_portList; Utils::PortList m_portList;
const QString m_remoteExecutable;
ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::IDevice::ConstPtr m_device;
ProjectExplorer::DeviceApplicationRunner *m_runner; ProjectExplorer::DeviceApplicationRunner *m_runner;
State m_state; State m_state;
Utils::Environment m_environment;
QString m_workingDir;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -47,6 +47,7 @@ namespace Internal {
QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig,
Analyzer::AnalyzerRunControl *runControl) Analyzer::AnalyzerRunControl *runControl)
: QnxAbstractRunSupport(runConfig, runControl) : QnxAbstractRunSupport(runConfig, runControl)
, m_runnable(runConfig->runnable().as<StandardRunnable>())
, m_runControl(runControl) , m_runControl(runControl)
, m_qmlPort(-1) , m_qmlPort(-1)
{ {
@@ -105,9 +106,9 @@ void QnxAnalyzeSupport::startExecution()
<< QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs) << QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs)
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort); << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort);
appRunner()->setEnvironment(environment()); appRunner()->setEnvironment(m_runnable.environment);
appRunner()->setWorkingDirectory(workingDirectory()); appRunner()->setWorkingDirectory(m_runnable.workingDirectory);
appRunner()->start(device(), executable(), args); appRunner()->start(device(), m_runnable.executable, args);
} }
void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
@@ -116,7 +117,7 @@ void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success)
return; return;
if (!success) if (!success)
showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), showMessage(tr("The %1 process closed unexpectedly.").arg(m_runnable.executable),
NormalMessageFormat); NormalMessageFormat);
m_runControl->notifyRemoteFinished(); m_runControl->notifyRemoteFinished();

View File

@@ -28,7 +28,7 @@
#include "qnxabstractrunsupport.h" #include "qnxabstractrunsupport.h"
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/runnables.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
#include <qmldebug/qmloutputparser.h> #include <qmldebug/qmloutputparser.h>
@@ -65,6 +65,7 @@ private slots:
private: private:
void startExecution(); void startExecution();
ProjectExplorer::StandardRunnable m_runnable;
Analyzer::AnalyzerRunControl *m_runControl; Analyzer::AnalyzerRunControl *m_runControl;
QmlDebug::QmlOutputParser m_outputParser; QmlDebug::QmlOutputParser m_outputParser;
int m_qmlPort; int m_qmlPort;

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h> #include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -48,6 +49,7 @@ using namespace Qnx::Internal;
QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl) QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl)
: QnxAbstractRunSupport(runConfig, runControl) : QnxAbstractRunSupport(runConfig, runControl)
, m_runnable(runConfig->runnable().as<StandardRunnable>())
, m_runControl(runControl) , m_runControl(runControl)
, m_pdebugPort(-1) , m_pdebugPort(-1)
, m_qmlPort(-1) , m_qmlPort(-1)
@@ -106,9 +108,9 @@ void QnxDebugSupport::startExecution()
arguments << QString::number(m_pdebugPort); arguments << QString::number(m_pdebugPort);
else if (m_useQmlDebugger && !m_useCppDebugger) else if (m_useQmlDebugger && !m_useCppDebugger)
arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs); arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs);
appRunner()->setEnvironment(environment()); appRunner()->setEnvironment(m_runnable.environment);
appRunner()->setWorkingDirectory(workingDirectory()); appRunner()->setWorkingDirectory(m_runnable.workingDirectory);
appRunner()->start(device(), executable(), arguments); appRunner()->start(device(), processExecutable(), arguments);
} }
void QnxDebugSupport::handleRemoteProcessStarted() void QnxDebugSupport::handleRemoteProcessStarted()
@@ -135,7 +137,7 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success)
} else { } else {
Debugger::RemoteSetupResult result; Debugger::RemoteSetupResult result;
result.success = false; result.success = false;
result.reason = tr("The %1 process closed unexpectedly.").arg(executable()); result.reason = tr("The %1 process closed unexpectedly.").arg(processExecutable());
m_runControl->notifyEngineRemoteSetupFinished(result); m_runControl->notifyEngineRemoteSetupFinished(result);
} }
} }
@@ -150,14 +152,14 @@ void QnxDebugSupport::handleDebuggingFinished()
killInferiorProcess(); killInferiorProcess();
} }
QString QnxDebugSupport::executable() const QString QnxDebugSupport::processExecutable() const
{ {
return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : QnxAbstractRunSupport::executable(); return m_useCppDebugger? QLatin1String(Constants::QNX_DEBUG_EXECUTABLE) : m_runnable.executable;
} }
void QnxDebugSupport::killInferiorProcess() void QnxDebugSupport::killInferiorProcess()
{ {
device()->signalOperation()->killProcess(QnxAbstractRunSupport::executable()); device()->signalOperation()->killProcess(m_runnable.executable);
} }
void QnxDebugSupport::handleProgressReport(const QString &progressOutput) void QnxDebugSupport::handleProgressReport(const QString &progressOutput)

View File

@@ -28,6 +28,8 @@
#include "qnxabstractrunsupport.h" #include "qnxabstractrunsupport.h"
#include <projectexplorer/runnables.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
namespace Debugger { class DebuggerRunControl; } namespace Debugger { class DebuggerRunControl; }
@@ -64,10 +66,11 @@ private slots:
private: private:
void startExecution(); void startExecution();
QString executable() const; QString processExecutable() const;
void killInferiorProcess(); void killInferiorProcess();
ProjectExplorer::StandardRunnable m_runnable;
Slog2InfoRunner *m_slog2Info; Slog2InfoRunner *m_slog2Info;
Debugger::DebuggerRunControl *m_runControl; Debugger::DebuggerRunControl *m_runControl;

View File

@@ -26,6 +26,7 @@
#include "qnxrunconfiguration.h" #include "qnxrunconfiguration.h"
#include "qnxconstants.h" #include "qnxconstants.h"
#include <projectexplorer/runnables.h>
#include <remotelinux/remotelinuxrunconfigurationwidget.h> #include <remotelinux/remotelinuxrunconfigurationwidget.h>
#include <utils/environment.h> #include <utils/environment.h>
@@ -50,23 +51,22 @@ QnxRunConfiguration::QnxRunConfiguration(Target *parent, QnxRunConfiguration *so
{ {
} }
Utils::Environment QnxRunConfiguration::environment() const Runnable QnxRunConfiguration::runnable() const
{ {
Utils::Environment env = RemoteLinuxRunConfiguration::environment(); auto r = RemoteLinuxRunConfiguration::runnable().as<StandardRunnable>();
if (!m_qtLibPath.isEmpty()) { if (!m_qtLibPath.isEmpty()) {
env.appendOrSet(QLatin1String("LD_LIBRARY_PATH"), r.environment.appendOrSet(QLatin1String("LD_LIBRARY_PATH"),
m_qtLibPath + QLatin1String("/lib:$LD_LIBRARY_PATH")); m_qtLibPath + QLatin1String("/lib:$LD_LIBRARY_PATH"));
env.appendOrSet(QLatin1String("QML_IMPORT_PATH"), r.environment.appendOrSet(QLatin1String("QML_IMPORT_PATH"),
m_qtLibPath + QLatin1String("/imports:$QML_IMPORT_PATH")); m_qtLibPath + QLatin1String("/imports:$QML_IMPORT_PATH"));
env.appendOrSet(QLatin1String("QML2_IMPORT_PATH"), r.environment.appendOrSet(QLatin1String("QML2_IMPORT_PATH"),
m_qtLibPath + QLatin1String("/qml:$QML2_IMPORT_PATH")); m_qtLibPath + QLatin1String("/qml:$QML2_IMPORT_PATH"));
env.appendOrSet(QLatin1String("QT_PLUGIN_PATH"), r.environment.appendOrSet(QLatin1String("QT_PLUGIN_PATH"),
m_qtLibPath + QLatin1String("/plugins:$QT_PLUGIN_PATH")); m_qtLibPath + QLatin1String("/plugins:$QT_PLUGIN_PATH"));
env.set(QLatin1String("QT_QPA_FONTDIR"), r.environment.set(QLatin1String("QT_QPA_FONTDIR"),
m_qtLibPath + QLatin1String("/lib/fonts")); m_qtLibPath + QLatin1String("/lib/fonts"));
} }
return r;
return env;
} }
QWidget *QnxRunConfiguration::createConfigurationWidget() QWidget *QnxRunConfiguration::createConfigurationWidget()

View File

@@ -28,8 +28,6 @@
#include <remotelinux/remotelinuxrunconfiguration.h> #include <remotelinux/remotelinuxrunconfiguration.h>
namespace Utils { class Environment; }
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {
@@ -41,7 +39,8 @@ public:
QnxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, QnxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id,
const QString &targetName); const QString &targetName);
Utils::Environment environment() const override; ProjectExplorer::Runnable runnable() const override;
QWidget *createConfigurationWidget() override; QWidget *createConfigurationWidget() override;
QVariantMap toMap() const override; QVariantMap toMap() const override;

View File

@@ -1,44 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Canonical Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "abstractremotelinuxrunconfiguration.h"
#include <debugger/debuggerrunconfigurationaspect.h>
namespace RemoteLinux {
AbstractRemoteLinuxRunConfiguration::AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
Core::Id id): RunConfiguration(parent, id)
{
}
AbstractRemoteLinuxRunConfiguration::AbstractRemoteLinuxRunConfiguration(ProjectExplorer::Target *parent,
AbstractRemoteLinuxRunConfiguration *source): RunConfiguration(parent, source)
{
}
} // namespace RemoteLinux

View File

@@ -1,58 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 Canonical Ltd.
** Contact: https://www.qt.io/licensing/
**
** 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 The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef REMOTELINUX_ABSTRACTREMOTELINUXRUNCONFIGURATION_H
#define REMOTELINUX_ABSTRACTREMOTELINUXRUNCONFIGURATION_H
#include "remotelinux_export.h"
#include <projectexplorer/runconfiguration.h>
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);
virtual QString localExecutableFilePath() const = 0;
virtual QString remoteExecutableFilePath() const = 0;
virtual QString 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

@@ -24,12 +24,13 @@
****************************************************************************/ ****************************************************************************/
#include "abstractremotelinuxrunsupport.h" #include "abstractremotelinuxrunsupport.h"
#include "abstractremotelinuxrunconfiguration.h"
#include <projectexplorer/target.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h> #include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/portlist.h> #include <utils/portlist.h>
@@ -41,32 +42,26 @@ namespace Internal {
class AbstractRemoteLinuxRunSupportPrivate class AbstractRemoteLinuxRunSupportPrivate
{ {
public: public:
AbstractRemoteLinuxRunSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig) AbstractRemoteLinuxRunSupportPrivate(const RunConfiguration *runConfig)
: state(AbstractRemoteLinuxRunSupport::Inactive), : state(AbstractRemoteLinuxRunSupport::Inactive),
device(DeviceKitInformation::device(runConfig->target()->kit())), runnable(runConfig->runnable().as<StandardRunnable>()),
remoteFilePath(runConfig->remoteExecutableFilePath()), device(DeviceKitInformation::device(runConfig->target()->kit()))
arguments(runConfig->arguments()),
environment(runConfig->environment()),
workingDir(runConfig->workingDirectory())
{ {
} }
AbstractRemoteLinuxRunSupport::State state; AbstractRemoteLinuxRunSupport::State state;
StandardRunnable runnable;
DeviceApplicationRunner appRunner; DeviceApplicationRunner appRunner;
DeviceUsedPortsGatherer portsGatherer; DeviceUsedPortsGatherer portsGatherer;
const IDevice::ConstPtr device; const IDevice::ConstPtr device;
Utils::PortList portList; Utils::PortList portList;
const QString remoteFilePath;
const QStringList arguments;
const Utils::Environment environment;
const QString workingDir;
}; };
} // namespace Internal } // namespace Internal
using namespace Internal; using namespace Internal;
AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig, QObject *parent) AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunConfiguration *runConfig, QObject *parent)
: QObject(parent), : QObject(parent),
d(new AbstractRemoteLinuxRunSupportPrivate(runConfig)) d(new AbstractRemoteLinuxRunSupportPrivate(runConfig))
{ {
@@ -143,31 +138,16 @@ bool AbstractRemoteLinuxRunSupport::setPort(int &port)
return true; return true;
} }
QStringList AbstractRemoteLinuxRunSupport::arguments() const
{
return d->arguments;
}
QString AbstractRemoteLinuxRunSupport::remoteFilePath() const
{
return d->remoteFilePath;
}
Utils::Environment AbstractRemoteLinuxRunSupport::environment() const
{
return d->environment;
}
QString AbstractRemoteLinuxRunSupport::workingDirectory() const
{
return d->workingDir;
}
const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const
{ {
return d->device; return d->device;
} }
const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const
{
return d->runnable;
}
void AbstractRemoteLinuxRunSupport::reset() void AbstractRemoteLinuxRunSupport::reset()
{ {
d->portsGatherer.disconnect(this); d->portsGatherer.disconnect(this);

View File

@@ -32,14 +32,14 @@
#include <QObject> #include <QObject>
namespace ProjectExplorer { class DeviceApplicationRunner; } namespace ProjectExplorer {
class DeviceApplicationRunner;
namespace Utils { class Environment; } class RunConfiguration;
class StandardRunnable;
}
namespace RemoteLinux { namespace RemoteLinux {
class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; } namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; }
class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public QObject class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public QObject
@@ -54,7 +54,7 @@ protected:
Running Running
}; };
public: public:
AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig, AbstractRemoteLinuxRunSupport(ProjectExplorer::RunConfiguration *runConfig,
QObject *parent = 0); QObject *parent = 0);
~AbstractRemoteLinuxRunSupport(); ~AbstractRemoteLinuxRunSupport();
@@ -71,11 +71,8 @@ protected:
void setFinished(); void setFinished();
bool setPort(int &port); bool setPort(int &port);
QStringList arguments() const;
QString remoteFilePath() const;
Utils::Environment environment() const;
QString workingDirectory() const;
const ProjectExplorer::IDevice::ConstPtr device() const; const ProjectExplorer::IDevice::ConstPtr device() const;
const ProjectExplorer::StandardRunnable &runnable() const;
void reset(); void reset();

View File

@@ -10,7 +10,6 @@ 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 \
@@ -58,7 +57,6 @@ 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

@@ -23,8 +23,6 @@ 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",

View File

@@ -35,6 +35,7 @@
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -46,6 +47,7 @@
using namespace QSsh; using namespace QSsh;
using namespace Analyzer; using namespace Analyzer;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -71,7 +73,7 @@ public:
using namespace Internal; using namespace Internal;
RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig, RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunConfiguration *runConfig,
AnalyzerRunControl *engine, Core::Id runMode) AnalyzerRunControl *engine, Core::Id runMode)
: AbstractRemoteLinuxRunSupport(runConfig, engine), : AbstractRemoteLinuxRunSupport(runConfig, engine),
d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode)) d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode))
@@ -130,12 +132,12 @@ void RemoteLinuxAnalyzeSupport::startExecution()
connect(runner, &DeviceApplicationRunner::reportError, connect(runner, &DeviceApplicationRunner::reportError,
this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError); this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError);
const QStringList args = arguments() QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux);
<< QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort); args.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort));
runner->setWorkingDirectory(workingDirectory()); runner->setWorkingDirectory(runnable().workingDirectory);
runner->setEnvironment(environment()); runner->setEnvironment(runnable().environment);
runner->start(device(), remoteFilePath(), args); runner->start(device(), runnable().executable, args);
} }
void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error) void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error)

View File

@@ -36,7 +36,6 @@
namespace Analyzer { class AnalyzerRunControl; } namespace Analyzer { class AnalyzerRunControl; }
namespace RemoteLinux { namespace RemoteLinux {
class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; } namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; }
@@ -44,7 +43,7 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR
{ {
Q_OBJECT Q_OBJECT
public: public:
RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig, RemoteLinuxAnalyzeSupport(ProjectExplorer::RunConfiguration *runConfig,
Analyzer::AnalyzerRunControl *engine, Core::Id runMode); Analyzer::AnalyzerRunControl *engine, Core::Id runMode);
~RemoteLinuxAnalyzeSupport(); ~RemoteLinuxAnalyzeSupport();

View File

@@ -28,15 +28,20 @@
#include "remotelinuxenvironmentaspect.h" #include "remotelinuxenvironmentaspect.h"
#include "ui_remotelinuxcustomrunconfigurationwidget.h" #include "ui_remotelinuxcustomrunconfigurationwidget.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/qtoutputformatter.h> #include <qtsupport/qtoutputformatter.h>
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class RemoteLinuxCustomRunConfigWidget : public ProjectExplorer::RunConfigWidget class RemoteLinuxCustomRunConfigWidget : public RunConfigWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -50,23 +55,24 @@ public:
detailsContainer->setState(Utils::DetailsWidget::NoSummary); detailsContainer->setState(Utils::DetailsWidget::NoSummary);
QWidget * const detailsWidget = new QWidget(this); QWidget * const detailsWidget = new QWidget(this);
detailsContainer->setWidget(detailsWidget); detailsContainer->setWidget(detailsWidget);
auto const runnable = runConfig->runnable().as<StandardRunnable>();
m_ui.setupUi(detailsWidget); m_ui.setupUi(detailsWidget);
m_ui.localExecutablePathChooser->setExpectedKind(Utils::PathChooser::File); m_ui.localExecutablePathChooser->setExpectedKind(Utils::PathChooser::File);
m_ui.localExecutablePathChooser->setPath(m_runConfig->localExecutableFilePath()); m_ui.localExecutablePathChooser->setPath(runConfig->localExecutableFilePath());
m_ui.remoteExeLineEdit->setText(m_runConfig->remoteExecutableFilePath()); m_ui.remoteExeLineEdit->setText(runnable.executable);
m_ui.argsLineEdit->setText(m_runConfig->arguments()); m_ui.argsLineEdit->setText(runnable.commandLineArguments);
m_ui.workingDirLineEdit->setText(m_runConfig->workingDirectory()); m_ui.workingDirLineEdit->setText(runnable.workingDirectory);
connect(m_ui.localExecutablePathChooser, SIGNAL(pathChanged(QString)), connect(m_ui.localExecutablePathChooser, &Utils::PathChooser::pathChanged,
SLOT(handleLocalExecutableChanged(QString))); this, &RemoteLinuxCustomRunConfigWidget::handleLocalExecutableChanged);
connect(m_ui.remoteExeLineEdit, SIGNAL(textEdited(QString)), connect(m_ui.remoteExeLineEdit, &QLineEdit::textEdited,
SLOT(handleRemoteExecutableChanged(QString))); this, &RemoteLinuxCustomRunConfigWidget::handleRemoteExecutableChanged);
connect(m_ui.argsLineEdit, SIGNAL(textEdited(QString)), connect(m_ui.argsLineEdit, &QLineEdit::textEdited,
SLOT(handleArgumentsChanged(QString))); this, &RemoteLinuxCustomRunConfigWidget::handleArgumentsChanged);
connect(m_ui.workingDirLineEdit, SIGNAL(textEdited(QString)), connect(m_ui.workingDirLineEdit, &QLineEdit::textEdited,
SLOT(handleWorkingDirChanged(QString))); this, &RemoteLinuxCustomRunConfigWidget::handleWorkingDirChanged);
} }
private slots: private:
void handleLocalExecutableChanged(const QString &path) { void handleLocalExecutableChanged(const QString &path) {
m_runConfig->setLocalExecutableFilePath(path.trimmed()); m_runConfig->setLocalExecutableFilePath(path.trimmed());
} }
@@ -84,7 +90,6 @@ private slots:
m_runConfig->setWorkingDirectory(wd.trimmed()); m_runConfig->setWorkingDirectory(wd.trimmed());
} }
private:
QString displayName() const { return m_runConfig->displayName(); } QString displayName() const { return m_runConfig->displayName(); }
RemoteLinuxCustomRunConfiguration * const m_runConfig; RemoteLinuxCustomRunConfiguration * const m_runConfig;
@@ -92,14 +97,14 @@ private:
}; };
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent) RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent)
: AbstractRemoteLinuxRunConfiguration(parent, runConfigId()) : RunConfiguration(parent, runConfigId())
{ {
init(); init();
} }
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent, RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent,
RemoteLinuxCustomRunConfiguration *source) RemoteLinuxCustomRunConfiguration *source)
: AbstractRemoteLinuxRunConfiguration(parent, source) : RunConfiguration(parent, source)
, m_localExecutable(source->m_localExecutable) , m_localExecutable(source->m_localExecutable)
, m_remoteExecutable(source->m_remoteExecutable) , m_remoteExecutable(source->m_remoteExecutable)
, m_arguments(source->m_arguments) , m_arguments(source->m_arguments)
@@ -136,11 +141,14 @@ Utils::OutputFormatter *RemoteLinuxCustomRunConfiguration::createOutputFormatter
return new QtSupport::QtOutputFormatter(target()->project()); return new QtSupport::QtOutputFormatter(target()->project());
} }
Utils::Environment RemoteLinuxCustomRunConfiguration::environment() const Runnable RemoteLinuxCustomRunConfiguration::runnable() const
{ {
RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>(); StandardRunnable r;
QTC_ASSERT(aspect, return Utils::Environment()); r.environment = extraAspect<RemoteLinuxEnvironmentAspect>()->environment();
return aspect->environment(); r.executable = m_remoteExecutable;
r.commandLineArguments = m_arguments;
r.workingDirectory = m_workingDirectory;
return r;
} }
void RemoteLinuxCustomRunConfiguration::setRemoteExecutableFilePath(const QString &executable) void RemoteLinuxCustomRunConfiguration::setRemoteExecutableFilePath(const QString &executable)
@@ -187,7 +195,7 @@ static QString workingDirKey()
bool RemoteLinuxCustomRunConfiguration::fromMap(const QVariantMap &map) bool RemoteLinuxCustomRunConfiguration::fromMap(const QVariantMap &map)
{ {
if (!AbstractRemoteLinuxRunConfiguration::fromMap(map)) if (!RunConfiguration::fromMap(map))
return false; return false;
setLocalExecutableFilePath(map.value(localExeKey()).toString()); setLocalExecutableFilePath(map.value(localExeKey()).toString());
setRemoteExecutableFilePath(map.value(remoteExeKey()).toString()); setRemoteExecutableFilePath(map.value(remoteExeKey()).toString());
@@ -202,7 +210,7 @@ bool RemoteLinuxCustomRunConfiguration::fromMap(const QVariantMap &map)
QVariantMap RemoteLinuxCustomRunConfiguration::toMap() const QVariantMap RemoteLinuxCustomRunConfiguration::toMap() const
{ {
QVariantMap map = AbstractRemoteLinuxRunConfiguration::toMap(); QVariantMap map = RunConfiguration::toMap();
map.insert(localExeKey(), m_localExecutable); map.insert(localExeKey(), m_localExecutable);
map.insert(remoteExeKey(), m_remoteExecutable); map.insert(remoteExeKey(), m_remoteExecutable);
map.insert(argsKey(), m_arguments); map.insert(argsKey(), m_arguments);

View File

@@ -26,12 +26,12 @@
#ifndef REMOTELINUXCUSTOMRUNCONFIGURATION_H #ifndef REMOTELINUXCUSTOMRUNCONFIGURATION_H
#define REMOTELINUXCUSTOMRUNCONFIGURATION_H #define REMOTELINUXCUSTOMRUNCONFIGURATION_H
#include "abstractremotelinuxrunconfiguration.h" #include <projectexplorer/runconfiguration.h>
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
class RemoteLinuxCustomRunConfiguration : public AbstractRemoteLinuxRunConfiguration class RemoteLinuxCustomRunConfiguration : public ProjectExplorer::RunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:
@@ -47,12 +47,8 @@ public:
ConfigurationState ensureConfigured(QString *errorMessage) override; ConfigurationState ensureConfigured(QString *errorMessage) override;
QWidget *createConfigurationWidget() override; QWidget *createConfigurationWidget() override;
Utils::OutputFormatter *createOutputFormatter() const override; Utils::OutputFormatter *createOutputFormatter() const override;
ProjectExplorer::Runnable runnable() const override;
QString localExecutableFilePath() const override { return m_localExecutable; } QString localExecutableFilePath() const { return m_localExecutable; }
QString remoteExecutableFilePath() const override { return m_remoteExecutable; }
QString arguments() const override { return m_arguments; }
QString workingDirectory() const override { return m_workingDirectory; }
Utils::Environment environment() const override;
void setLocalExecutableFilePath(const QString &executable) { m_localExecutable = executable; } void setLocalExecutableFilePath(const QString &executable) { m_localExecutable = executable; }
void setRemoteExecutableFilePath(const QString &executable); void setRemoteExecutableFilePath(const QString &executable);
@@ -69,7 +65,6 @@ private:
QString m_remoteExecutable; QString m_remoteExecutable;
QString m_arguments; QString m_arguments;
QString m_workingDirectory; QString m_workingDirectory;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -33,20 +33,23 @@
#include <debugger/debuggerkitinformation.h> #include <debugger/debuggerkitinformation.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <utils/qtcassert.h>
#include <qmldebug/qmldebugcommandlinearguments.h> #include <qmldebug/qmldebugcommandlinearguments.h>
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <QPointer> #include <QPointer>
using namespace QSsh; using namespace QSsh;
using namespace Debugger; using namespace Debugger;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
@@ -54,8 +57,7 @@ namespace Internal {
class LinuxDeviceDebugSupportPrivate class LinuxDeviceDebugSupportPrivate
{ {
public: public:
LinuxDeviceDebugSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig, LinuxDeviceDebugSupportPrivate(const RunConfiguration *runConfig, DebuggerRunControl *runControl)
DebuggerRunControl *runControl)
: runControl(runControl), : runControl(runControl),
qmlDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useQmlDebugger()), qmlDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useQmlDebugger()),
cppDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useCppDebugger()), cppDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useCppDebugger()),
@@ -75,45 +77,15 @@ public:
using namespace Internal; using namespace Internal;
DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig) LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunConfiguration *runConfig,
{
DebuggerStartParameters params;
Target *target = runConfig->target();
Kit *k = target->kit();
const IDevice::ConstPtr device = DeviceKitInformation::device(k);
QTC_ASSERT(device, return params);
params.startMode = AttachToRemoteServer;
params.closeMode = KillAndExitMonitorAtClose;
params.remoteSetupNeeded = true;
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) {
params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = 0; // port is selected later on
}
if (aspect->useCppDebugger()) {
aspect->setUseMultiProcess(true);
params.processArgs = runConfig->arguments();
if (aspect->useQmlDebugger()) {
params.processArgs.prepend(QLatin1Char(' '));
params.processArgs.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
}
params.executable = runConfig->localExecutableFilePath();
params.remoteChannel = device->sshParameters().host + QLatin1String(":-1");
params.remoteExecutable = runConfig->remoteExecutableFilePath();
}
return params;
}
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig,
DebuggerRunControl *runControl) DebuggerRunControl *runControl)
: AbstractRemoteLinuxRunSupport(runConfig, runControl), : AbstractRemoteLinuxRunSupport(runConfig, runControl),
d(new LinuxDeviceDebugSupportPrivate(static_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig), runControl)) d(new LinuxDeviceDebugSupportPrivate(runConfig, runControl))
{ {
connect(runControl, &DebuggerRunControl::requestRemoteSetup, connect(runControl, &DebuggerRunControl::requestRemoteSetup,
this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested); this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested);
connect(runControl, &RunControl::finished,
this, &LinuxDeviceDebugSupport::handleDebuggingFinished);
} }
LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport() LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport()
@@ -156,14 +128,14 @@ void LinuxDeviceDebugSupport::startExecution()
connect(runner, &DeviceApplicationRunner::remoteProcessStarted, connect(runner, &DeviceApplicationRunner::remoteProcessStarted,
this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted); this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted);
QStringList args = arguments(); QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux);
QString command; QString command;
if (d->qmlDebugging) if (d->qmlDebugging)
args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort)); args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort));
if (d->qmlDebugging && !d->cppDebugging) { if (d->qmlDebugging && !d->cppDebugging) {
command = remoteFilePath(); command = runnable().executable;
} else { } else {
command = device()->debugServerPath(); command = device()->debugServerPath();
if (command.isEmpty()) if (command.isEmpty())
@@ -179,8 +151,8 @@ void LinuxDeviceDebugSupport::startExecution()
this, &LinuxDeviceDebugSupport::handleProgressReport); this, &LinuxDeviceDebugSupport::handleProgressReport);
connect(runner, &DeviceApplicationRunner::reportError, connect(runner, &DeviceApplicationRunner::reportError,
this, &LinuxDeviceDebugSupport::handleAppRunnerError); this, &LinuxDeviceDebugSupport::handleAppRunnerError);
runner->setEnvironment(environment()); runner->setEnvironment(runnable().environment);
runner->setWorkingDirectory(workingDirectory()); runner->setWorkingDirectory(runnable().workingDirectory);
runner->start(device(), command, args); runner->start(device(), command, args);
} }

View File

@@ -28,23 +28,18 @@
#include "abstractremotelinuxrunsupport.h" #include "abstractremotelinuxrunsupport.h"
namespace Debugger { namespace Debugger { class DebuggerRunControl; }
class DebuggerRunControl;
class DebuggerStartParameters;
}
namespace RemoteLinux { namespace RemoteLinux {
class AbstractRemoteLinuxRunConfiguration;
namespace Internal { class LinuxDeviceDebugSupportPrivate; } namespace Internal { class LinuxDeviceDebugSupportPrivate; }
class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public AbstractRemoteLinuxRunSupport class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public AbstractRemoteLinuxRunSupport
{ {
Q_OBJECT Q_OBJECT
public:
static Debugger::DebuggerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig);
LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig, public:
LinuxDeviceDebugSupport(ProjectExplorer::RunConfiguration *runConfig,
Debugger::DebuggerRunControl *runControl); Debugger::DebuggerRunControl *runControl);
~LinuxDeviceDebugSupport(); ~LinuxDeviceDebugSupport();

View File

@@ -25,7 +25,6 @@
#include "remotelinuxenvironmentaspect.h" #include "remotelinuxenvironmentaspect.h"
#include "abstractremotelinuxrunconfiguration.h"
#include "remotelinuxenvironmentaspectwidget.h" #include "remotelinuxenvironmentaspectwidget.h"
namespace RemoteLinux { namespace RemoteLinux {
@@ -74,11 +73,6 @@ Utils::Environment RemoteLinuxEnvironmentAspect::baseEnvironment() const
return env; return env;
} }
AbstractRemoteLinuxRunConfiguration *RemoteLinuxEnvironmentAspect::runConfiguration() const
{
return qobject_cast<AbstractRemoteLinuxRunConfiguration *>(EnvironmentAspect::runConfiguration());
}
Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const
{ {
return m_remoteEnvironment; return m_remoteEnvironment;

View File

@@ -32,7 +32,6 @@
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxEnvironmentAspectWidget; class RemoteLinuxEnvironmentAspectWidget;
class AbstractRemoteLinuxRunConfiguration;
class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::EnvironmentAspect class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::EnvironmentAspect
{ {
@@ -47,8 +46,6 @@ public:
QString baseEnvironmentDisplayName(int base) const; QString baseEnvironmentDisplayName(int base) const;
Utils::Environment baseEnvironment() const; Utils::Environment baseEnvironment() 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

@@ -30,7 +30,9 @@
#include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h> #include <projectexplorer/deploymentdata.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qtsupport/qtoutputformatter.h> #include <qtsupport/qtoutputformatter.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
@@ -79,7 +81,7 @@ using namespace Internal;
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::Id id, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::Id id,
const QString &targetName) const QString &targetName)
: AbstractRemoteLinuxRunConfiguration(parent, id), : RunConfiguration(parent, id),
d(new RemoteLinuxRunConfigurationPrivate(targetName)) d(new RemoteLinuxRunConfigurationPrivate(targetName))
{ {
init(); init();
@@ -87,7 +89,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::I
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent,
RemoteLinuxRunConfiguration *source) RemoteLinuxRunConfiguration *source)
: AbstractRemoteLinuxRunConfiguration(parent, source), : RunConfiguration(parent, source),
d(new RemoteLinuxRunConfigurationPrivate(source->d)) d(new RemoteLinuxRunConfigurationPrivate(source->d))
{ {
init(); init();
@@ -125,6 +127,15 @@ OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const
return new QtSupport::QtOutputFormatter(target()->project()); return new QtSupport::QtOutputFormatter(target()->project());
} }
Runnable RemoteLinuxRunConfiguration::runnable() const
{
StandardRunnable r;
r.environment = extraAspect<RemoteLinuxEnvironmentAspect>()->environment();
r.executable = remoteExecutableFilePath();
r.commandLineArguments = arguments();
r.workingDirectory = workingDirectory();
return r;
}
QVariantMap RemoteLinuxRunConfiguration::toMap() const QVariantMap RemoteLinuxRunConfiguration::toMap() const
{ {
@@ -171,13 +182,6 @@ QString RemoteLinuxRunConfiguration::arguments() const
return d->arguments; return d->arguments;
} }
Environment RemoteLinuxRunConfiguration::environment() const
{
RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>();
QTC_ASSERT(aspect, return Environment());
return aspect->environment();
}
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
{ {
return target()->applicationTargets().targetFilePath(d->targetName).toString(); return target()->applicationTargets().targetFilePath(d->targetName).toString();

View File

@@ -27,7 +27,6 @@
#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>
@@ -47,7 +46,7 @@ class RemoteLinuxRunConfigurationPrivate;
class RemoteLinuxRunConfigurationFactory; class RemoteLinuxRunConfigurationFactory;
} // namespace Internal } // namespace Internal
class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public AbstractRemoteLinuxRunConfiguration class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration
{ {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(RemoteLinuxRunConfiguration) Q_DISABLE_COPY(RemoteLinuxRunConfiguration)
@@ -63,14 +62,14 @@ public:
QWidget *createConfigurationWidget() override; QWidget *createConfigurationWidget() override;
Utils::OutputFormatter *createOutputFormatter() const override; Utils::OutputFormatter *createOutputFormatter() const override;
virtual Utils::Environment environment() const override; ProjectExplorer::Runnable runnable() const override;
QString localExecutableFilePath() const override; QString localExecutableFilePath() const;
QString defaultRemoteExecutableFilePath() const; QString defaultRemoteExecutableFilePath() const;
QString remoteExecutableFilePath() const override; QString remoteExecutableFilePath() const;
QString arguments() const override; QString arguments() const;
void setArguments(const QString &args); void setArguments(const QString &args);
QString workingDirectory() const override; QString workingDirectory() const;
void setWorkingDirectory(const QString &wd); void setWorkingDirectory(const QString &wd);
void setAlternateRemoteExecutable(const QString &exe); void setAlternateRemoteExecutable(const QString &exe);
QString alternateRemoteExecutable() const; QString alternateRemoteExecutable() const;

View File

@@ -25,14 +25,12 @@
#include "remotelinuxruncontrol.h" #include "remotelinuxruncontrol.h"
#include "abstractremotelinuxrunconfiguration.h"
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorericons.h> #include <projectexplorer/projectexplorericons.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/environment.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -45,10 +43,7 @@ public:
bool running; bool running;
DeviceApplicationRunner runner; DeviceApplicationRunner runner;
IDevice::ConstPtr device; IDevice::ConstPtr device;
QString remoteExecutable; StandardRunnable runnable;
QString arguments;
Utils::Environment environment;
QString workingDir;
}; };
RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc) RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
@@ -57,12 +52,8 @@ RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
setIcon(ProjectExplorer::Icons::RUN_SMALL); setIcon(ProjectExplorer::Icons::RUN_SMALL);
d->running = false; d->running = false;
d->runnable = rc->runnable().as<StandardRunnable>();
d->device = DeviceKitInformation::device(rc->target()->kit()); d->device = DeviceKitInformation::device(rc->target()->kit());
const AbstractRemoteLinuxRunConfiguration * const lrc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(rc);
d->remoteExecutable = lrc->remoteExecutableFilePath();
d->arguments = lrc->arguments();
d->environment = lrc->environment();
d->workingDir = lrc->workingDirectory();
} }
RemoteLinuxRunControl::~RemoteLinuxRunControl() RemoteLinuxRunControl::~RemoteLinuxRunControl()
@@ -85,10 +76,11 @@ void RemoteLinuxRunControl::start()
this, &RemoteLinuxRunControl::handleRunnerFinished); this, &RemoteLinuxRunControl::handleRunnerFinished);
connect(&d->runner, &DeviceApplicationRunner::reportProgress, connect(&d->runner, &DeviceApplicationRunner::reportProgress,
this, &RemoteLinuxRunControl::handleProgressReport); this, &RemoteLinuxRunControl::handleProgressReport);
d->runner.setEnvironment(d->environment); d->runner.setEnvironment(d->runnable.environment);
d->runner.setWorkingDirectory(d->workingDir); d->runner.setWorkingDirectory(d->runnable.workingDirectory);
d->runner.start(d->device, d->remoteExecutable, d->runner.start(d->device, d->runnable.executable,
Utils::QtcProcess::splitArgs(d->arguments, Utils::OsTypeLinux)); Utils::QtcProcess::splitArgs(d->runnable.commandLineArguments,
Utils::OsTypeLinux));
} }
RunControl::StopResult RemoteLinuxRunControl::stop() RunControl::StopResult RemoteLinuxRunControl::stop()

View File

@@ -31,14 +31,20 @@
#include "remotelinuxrunconfiguration.h" #include "remotelinuxrunconfiguration.h"
#include "remotelinuxruncontrol.h" #include "remotelinuxruncontrol.h"
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerstartparameters.h>
#include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/ianalyzertool.h> #include <analyzerbase/ianalyzertool.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerstartparameters.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
#include <utils/portlist.h> #include <utils/portlist.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -81,6 +87,10 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE)
return new RemoteLinuxRunControl(runConfig); return new RemoteLinuxRunControl(runConfig);
const auto rcRunnable = runConfig->runnable();
QTC_ASSERT(rcRunnable.is<StandardRunnable>(), return 0);
const auto stdRunnable = rcRunnable.as<StandardRunnable>();
if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE if (mode == ProjectExplorer::Constants::DEBUG_RUN_MODE
|| mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) { || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) {
IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit()); IDevice::ConstPtr dev = DeviceKitInformation::device(runConfig->target()->kit());
@@ -88,8 +98,6 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
*errorMessage = tr("Cannot debug: Kit has no device."); *errorMessage = tr("Cannot debug: Kit has no device.");
return 0; return 0;
} }
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>(); auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
int portsUsed = aspect ? aspect->portsUsedByDebugger() : 0; int portsUsed = aspect ? aspect->portsUsedByDebugger() : 0;
@@ -97,32 +105,51 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
*errorMessage = tr("Cannot debug: Not enough free ports available."); *errorMessage = tr("Cannot debug: Not enough free ports available.");
return 0; return 0;
} }
auto *crc = qobject_cast<RemoteLinuxCustomRunConfiguration *>(rc);
if (crc && crc->localExecutableFilePath().isEmpty()) { QString localExecutable;
if (auto rlrc = qobject_cast<RemoteLinuxRunConfiguration *>(runConfig))
localExecutable = rlrc->localExecutableFilePath();
if (localExecutable.isEmpty()) {
*errorMessage = tr("Cannot debug: Local executable is not set."); *errorMessage = tr("Cannot debug: Local executable is not set.");
return 0; return 0;
} }
DebuggerStartParameters params = LinuxDeviceDebugSupport::startParameters(rc); DebuggerStartParameters params;
params.startMode = AttachToRemoteServer;
params.closeMode = KillAndExitMonitorAtClose;
params.remoteSetupNeeded = true;
if (aspect->useQmlDebugger()) {
params.qmlServerAddress = dev->sshParameters().host;
params.qmlServerPort = 0; // port is selected later on
}
if (aspect->useCppDebugger()) {
aspect->setUseMultiProcess(true);
params.processArgs = stdRunnable.commandLineArguments;
if (aspect->useQmlDebugger()) {
params.processArgs.prepend(QLatin1Char(' '));
params.processArgs.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices));
}
params.executable = localExecutable;
params.remoteChannel = dev->sshParameters().host + QLatin1String(":-1");
params.remoteExecutable = stdRunnable.executable;
}
DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage, mode); DebuggerRunControl * const runControl = createDebuggerRunControl(params, runConfig, errorMessage, mode);
if (!runControl) if (!runControl)
return 0; return 0;
LinuxDeviceDebugSupport * const debugSupport = (void) new LinuxDeviceDebugSupport(runConfig, runControl);
new LinuxDeviceDebugSupport(rc, runControl);
connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished()));
return runControl; return runControl;
} }
if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) { if (mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE) {
auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig);
QTC_ASSERT(rc, return 0);
auto runControl = AnalyzerManager::createRunControl(runConfig, mode); auto runControl = AnalyzerManager::createRunControl(runConfig, mode);
AnalyzerConnection connection; AnalyzerConnection connection;
connection.connParams = connection.connParams =
DeviceKitInformation::device(runConfig->target()->kit())->sshParameters(); DeviceKitInformation::device(runConfig->target()->kit())->sshParameters();
connection.analyzerHost = connection.connParams.host; connection.analyzerHost = connection.connParams.host;
runControl->setConnection(connection); runControl->setConnection(connection);
(void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode); (void) new RemoteLinuxAnalyzeSupport(runConfig, runControl, mode);
return runControl; return runControl;
} }

View File

@@ -37,13 +37,12 @@
#include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerrunconfigwidget.h> #include <analyzerbase/analyzerrunconfigwidget.h>
#include <remotelinux/abstractremotelinuxrunconfiguration.h>
#include <debugger/debuggerrunconfigurationaspect.h> #include <debugger/debuggerrunconfigurationaspect.h>
#include <projectexplorer/environmentaspect.h> #include <projectexplorer/environmentaspect.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -81,9 +80,9 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
AnalyzerConnection connection; AnalyzerConnection connection;
QString workingDirectory; QString workingDirectory;
Runnable rcRunnable = runConfiguration->runnable(); Runnable rcRunnable = runConfiguration->runnable();
if (rcRunnable.is<StandardRunnable>() QTC_ASSERT(rcRunnable.is<StandardRunnable>(), return 0);
&& device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
auto stdRunnable = runConfiguration->runnable().as<StandardRunnable>(); auto stdRunnable = runConfiguration->runnable().as<StandardRunnable>();
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
environment = stdRunnable.environment; environment = stdRunnable.environment;
workingDirectory = stdRunnable.workingDirectory; workingDirectory = stdRunnable.workingDirectory;
runnable.debuggee = stdRunnable.executable; runnable.debuggee = stdRunnable.executable;
@@ -96,12 +95,10 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration
connection.connParams.host = server.serverAddress().toString(); connection.connParams.host = server.serverAddress().toString();
connection.connParams.port = server.serverPort(); connection.connParams.port = server.serverPort();
localRunMode = stdRunnable.runMode; localRunMode = stdRunnable.runMode;
} else if (auto rc2 = qobject_cast<RemoteLinux::AbstractRemoteLinuxRunConfiguration *>(runConfiguration)) {
runnable.debuggee = rc2->remoteExecutableFilePath();
runnable.debuggeeArgs = rc2->arguments();
connection.connParams = device->sshParameters();
} else { } else {
QTC_ASSERT(false, return 0); runnable.debuggee = stdRunnable.executable;
runnable.debuggeeArgs = stdRunnable.commandLineArguments;
connection.connParams = device->sshParameters();
} }
runControl->setRunnable(runnable); runControl->setRunnable(runnable);