diff options
author | hjk <hjk@theqtcompany.com> | 2016-01-26 15:53:26 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2016-01-27 11:20:12 +0000 |
commit | 7be3eb85e1ab84f47bfea61f96e185731be6244f (patch) | |
tree | e6d84af03cb82e2d66a37ff1b8379711790eaf52 | |
parent | bfa292cdc95c3d3a295b4f1c3704f7ca4aeca660 (diff) |
RemoteLinux/Qnx: Use StandardRunnable
Change-Id: I73331985eb68065b5fb123ff4491888d824de766
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
27 files changed, 189 insertions, 346 deletions
diff --git a/src/plugins/qnx/qnxabstractrunsupport.cpp b/src/plugins/qnx/qnxabstractrunsupport.cpp index 812efe30045..7e2e1569831 100644 --- a/src/plugins/qnx/qnxabstractrunsupport.cpp +++ b/src/plugins/qnx/qnxabstractrunsupport.cpp @@ -41,11 +41,8 @@ using namespace Qnx::Internal; QnxAbstractRunSupport::QnxAbstractRunSupport(QnxRunConfiguration *runConfig, QObject *parent) : QObject(parent) - , m_remoteExecutable(runConfig->remoteExecutableFilePath()) , m_device(DeviceKitInformation::device(runConfig->target()->kit())) , m_state(Inactive) - , m_environment(runConfig->environment()) - , m_workingDir(runConfig->workingDirectory()) { m_runner = new DeviceApplicationRunner(this); m_portsGatherer = new DeviceUsedPortsGatherer(this); @@ -127,8 +124,3 @@ bool QnxAbstractRunSupport::setPort(int &port) } return true; } - -QString QnxAbstractRunSupport::executable() const -{ - return m_remoteExecutable; -} diff --git a/src/plugins/qnx/qnxabstractrunsupport.h b/src/plugins/qnx/qnxabstractrunsupport.h index d59b7941e2a..18658712ff7 100644 --- a/src/plugins/qnx/qnxabstractrunsupport.h +++ b/src/plugins/qnx/qnxabstractrunsupport.h @@ -60,10 +60,6 @@ protected: bool setPort(int &port); virtual void startExecution() = 0; - virtual QString executable() const; - Utils::Environment environment() const { return m_environment; } - QString workingDirectory() const { return m_workingDir; } - void setFinished(); State state() const; @@ -87,12 +83,9 @@ private slots: private: ProjectExplorer::DeviceUsedPortsGatherer * m_portsGatherer; Utils::PortList m_portList; - const QString m_remoteExecutable; ProjectExplorer::IDevice::ConstPtr m_device; ProjectExplorer::DeviceApplicationRunner *m_runner; State m_state; - Utils::Environment m_environment; - QString m_workingDir; }; } // namespace Internal diff --git a/src/plugins/qnx/qnxanalyzesupport.cpp b/src/plugins/qnx/qnxanalyzesupport.cpp index 56a9c405788..799d8af89bc 100644 --- a/src/plugins/qnx/qnxanalyzesupport.cpp +++ b/src/plugins/qnx/qnxanalyzesupport.cpp @@ -47,6 +47,7 @@ namespace Internal { QnxAnalyzeSupport::QnxAnalyzeSupport(QnxRunConfiguration *runConfig, Analyzer::AnalyzerRunControl *runControl) : QnxAbstractRunSupport(runConfig, runControl) + , m_runnable(runConfig->runnable().as<StandardRunnable>()) , m_runControl(runControl) , m_qmlPort(-1) { @@ -105,9 +106,9 @@ void QnxAnalyzeSupport::startExecution() << QtcProcess::splitArgs(m_runControl->runnable().debuggeeArgs) << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, m_qmlPort); - appRunner()->setEnvironment(environment()); - appRunner()->setWorkingDirectory(workingDirectory()); - appRunner()->start(device(), executable(), args); + appRunner()->setEnvironment(m_runnable.environment); + appRunner()->setWorkingDirectory(m_runnable.workingDirectory); + appRunner()->start(device(), m_runnable.executable, args); } void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) @@ -116,7 +117,7 @@ void QnxAnalyzeSupport::handleRemoteProcessFinished(bool success) return; if (!success) - showMessage(tr("The %1 process closed unexpectedly.").arg(executable()), + showMessage(tr("The %1 process closed unexpectedly.").arg(m_runnable.executable), NormalMessageFormat); m_runControl->notifyRemoteFinished(); diff --git a/src/plugins/qnx/qnxanalyzesupport.h b/src/plugins/qnx/qnxanalyzesupport.h index cbe26e3178f..6dbb23c0996 100644 --- a/src/plugins/qnx/qnxanalyzesupport.h +++ b/src/plugins/qnx/qnxanalyzesupport.h @@ -28,7 +28,7 @@ #include "qnxabstractrunsupport.h" -#include <projectexplorer/projectexplorerconstants.h> +#include <projectexplorer/runnables.h> #include <utils/outputformat.h> #include <qmldebug/qmloutputparser.h> @@ -65,6 +65,7 @@ private slots: private: void startExecution(); + ProjectExplorer::StandardRunnable m_runnable; Analyzer::AnalyzerRunControl *m_runControl; QmlDebug::QmlOutputParser m_outputParser; int m_qmlPort; diff --git a/src/plugins/qnx/qnxdebugsupport.cpp b/src/plugins/qnx/qnxdebugsupport.cpp index b1575de0754..dc2b81620fa 100644 --- a/src/plugins/qnx/qnxdebugsupport.cpp +++ b/src/plugins/qnx/qnxdebugsupport.cpp @@ -35,6 +35,7 @@ #include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceusedportsgatherer.h> #include <projectexplorer/kitinformation.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> @@ -48,6 +49,7 @@ using namespace Qnx::Internal; QnxDebugSupport::QnxDebugSupport(QnxRunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl) : QnxAbstractRunSupport(runConfig, runControl) + , m_runnable(runConfig->runnable().as<StandardRunnable>()) , m_runControl(runControl) , m_pdebugPort(-1) , m_qmlPort(-1) @@ -106,9 +108,9 @@ void QnxDebugSupport::startExecution() arguments << QString::number(m_pdebugPort); else if (m_useQmlDebugger && !m_useCppDebugger) arguments = Utils::QtcProcess::splitArgs(m_runControl->startParameters().processArgs); - appRunner()->setEnvironment(environment()); - appRunner()->setWorkingDirectory(workingDirectory()); - appRunner()->start(device(), executable(), arguments); + appRunner()->setEnvironment(m_runnable.environment); + appRunner()->setWorkingDirectory(m_runnable.workingDirectory); + appRunner()->start(device(), processExecutable(), arguments); } void QnxDebugSupport::handleRemoteProcessStarted() @@ -135,7 +137,7 @@ void QnxDebugSupport::handleRemoteProcessFinished(bool success) } else { Debugger::RemoteSetupResult result; 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); } } @@ -150,14 +152,14 @@ void QnxDebugSupport::handleDebuggingFinished() 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() { - device()->signalOperation()->killProcess(QnxAbstractRunSupport::executable()); + device()->signalOperation()->killProcess(m_runnable.executable); } void QnxDebugSupport::handleProgressReport(const QString &progressOutput) diff --git a/src/plugins/qnx/qnxdebugsupport.h b/src/plugins/qnx/qnxdebugsupport.h index c681973940f..ad4196d7ee0 100644 --- a/src/plugins/qnx/qnxdebugsupport.h +++ b/src/plugins/qnx/qnxdebugsupport.h @@ -28,6 +28,8 @@ #include "qnxabstractrunsupport.h" +#include <projectexplorer/runnables.h> + #include <utils/outputformat.h> namespace Debugger { class DebuggerRunControl; } @@ -64,10 +66,11 @@ private slots: private: void startExecution(); - QString executable() const; + QString processExecutable() const; void killInferiorProcess(); + ProjectExplorer::StandardRunnable m_runnable; Slog2InfoRunner *m_slog2Info; Debugger::DebuggerRunControl *m_runControl; diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index 5ea048eaff3..2ccedf4df8a 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -26,6 +26,7 @@ #include "qnxrunconfiguration.h" #include "qnxconstants.h" +#include <projectexplorer/runnables.h> #include <remotelinux/remotelinuxrunconfigurationwidget.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()) { - env.appendOrSet(QLatin1String("LD_LIBRARY_PATH"), + r.environment.appendOrSet(QLatin1String("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")); - env.appendOrSet(QLatin1String("QML2_IMPORT_PATH"), + r.environment.appendOrSet(QLatin1String("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")); - env.set(QLatin1String("QT_QPA_FONTDIR"), + r.environment.set(QLatin1String("QT_QPA_FONTDIR"), m_qtLibPath + QLatin1String("/lib/fonts")); } - - return env; + return r; } QWidget *QnxRunConfiguration::createConfigurationWidget() diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index ab7080c6ed5..7eadf342fea 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -28,8 +28,6 @@ #include <remotelinux/remotelinuxrunconfiguration.h> -namespace Utils { class Environment; } - namespace Qnx { namespace Internal { @@ -41,7 +39,8 @@ public: QnxRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &targetName); - Utils::Environment environment() const override; + ProjectExplorer::Runnable runnable() const override; + QWidget *createConfigurationWidget() override; QVariantMap toMap() const override; diff --git a/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.cpp deleted file mode 100644 index 567527fbc0a..00000000000 --- a/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.h b/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.h deleted file mode 100644 index 5931d8e31af..00000000000 --- a/src/plugins/remotelinux/abstractremotelinuxrunconfiguration.h +++ /dev/null @@ -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 diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp index 19189bedd26..ca93f696175 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.cpp @@ -24,12 +24,13 @@ ****************************************************************************/ #include "abstractremotelinuxrunsupport.h" -#include "abstractremotelinuxrunconfiguration.h" -#include <projectexplorer/target.h> -#include <projectexplorer/kitinformation.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceusedportsgatherer.h> +#include <projectexplorer/kitinformation.h> +#include <projectexplorer/runnables.h> +#include <projectexplorer/target.h> + #include <utils/environment.h> #include <utils/portlist.h> @@ -41,32 +42,26 @@ namespace Internal { class AbstractRemoteLinuxRunSupportPrivate { public: - AbstractRemoteLinuxRunSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig) + AbstractRemoteLinuxRunSupportPrivate(const RunConfiguration *runConfig) : state(AbstractRemoteLinuxRunSupport::Inactive), - device(DeviceKitInformation::device(runConfig->target()->kit())), - remoteFilePath(runConfig->remoteExecutableFilePath()), - arguments(runConfig->arguments()), - environment(runConfig->environment()), - workingDir(runConfig->workingDirectory()) + runnable(runConfig->runnable().as<StandardRunnable>()), + device(DeviceKitInformation::device(runConfig->target()->kit())) { } AbstractRemoteLinuxRunSupport::State state; + StandardRunnable runnable; DeviceApplicationRunner appRunner; DeviceUsedPortsGatherer portsGatherer; const IDevice::ConstPtr device; Utils::PortList portList; - const QString remoteFilePath; - const QStringList arguments; - const Utils::Environment environment; - const QString workingDir; }; } // namespace Internal using namespace Internal; -AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig, QObject *parent) +AbstractRemoteLinuxRunSupport::AbstractRemoteLinuxRunSupport(RunConfiguration *runConfig, QObject *parent) : QObject(parent), d(new AbstractRemoteLinuxRunSupportPrivate(runConfig)) { @@ -143,29 +138,14 @@ bool AbstractRemoteLinuxRunSupport::setPort(int &port) 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 +const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const { - return d->workingDir; + return d->device; } -const IDevice::ConstPtr AbstractRemoteLinuxRunSupport::device() const +const StandardRunnable &AbstractRemoteLinuxRunSupport::runnable() const { - return d->device; + return d->runnable; } void AbstractRemoteLinuxRunSupport::reset() diff --git a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h index 6005061eed7..7db1a6f7a15 100644 --- a/src/plugins/remotelinux/abstractremotelinuxrunsupport.h +++ b/src/plugins/remotelinux/abstractremotelinuxrunsupport.h @@ -32,14 +32,14 @@ #include <QObject> -namespace ProjectExplorer { class DeviceApplicationRunner; } - -namespace Utils { class Environment; } +namespace ProjectExplorer { +class DeviceApplicationRunner; +class RunConfiguration; +class StandardRunnable; +} namespace RemoteLinux { -class AbstractRemoteLinuxRunConfiguration; - namespace Internal { class AbstractRemoteLinuxRunSupportPrivate; } class REMOTELINUX_EXPORT AbstractRemoteLinuxRunSupport : public QObject @@ -54,7 +54,7 @@ protected: Running }; public: - AbstractRemoteLinuxRunSupport(AbstractRemoteLinuxRunConfiguration *runConfig, + AbstractRemoteLinuxRunSupport(ProjectExplorer::RunConfiguration *runConfig, QObject *parent = 0); ~AbstractRemoteLinuxRunSupport(); @@ -71,11 +71,8 @@ protected: void setFinished(); 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::StandardRunnable &runnable() const; void reset(); diff --git a/src/plugins/remotelinux/remotelinux.pro b/src/plugins/remotelinux/remotelinux.pro index 12a53819966..794ae05927b 100644 --- a/src/plugins/remotelinux/remotelinux.pro +++ b/src/plugins/remotelinux/remotelinux.pro @@ -10,7 +10,6 @@ HEADERS += \ remotelinuxplugin.h \ remotelinux_export.h \ linuxdevice.h \ - abstractremotelinuxrunconfiguration.h \ remotelinuxrunconfiguration.h \ publickeydeploymentdialog.h \ genericlinuxdeviceconfigurationwizard.h \ @@ -58,7 +57,6 @@ SOURCES += \ remotelinuxenvironmentaspectwidget.cpp \ remotelinuxplugin.cpp \ linuxdevice.cpp \ - abstractremotelinuxrunconfiguration.cpp \ remotelinuxrunconfiguration.cpp \ publickeydeploymentdialog.cpp \ genericlinuxdeviceconfigurationwizard.cpp \ diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index b47aaa83a3d..224c1cfde1f 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -23,8 +23,6 @@ QtcPlugin { "abstractremotelinuxdeploystep.h", "abstractremotelinuxrunsupport.cpp", "abstractremotelinuxrunsupport.h", - "abstractremotelinuxrunconfiguration.h", - "abstractremotelinuxrunconfiguration.cpp", "abstractuploadandinstallpackageservice.cpp", "abstractuploadandinstallpackageservice.h", "embeddedlinuxqtversion.cpp", diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp index 7fc7bee947a..26ff456ede2 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.cpp @@ -35,6 +35,7 @@ #include <projectexplorer/toolchain.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/kitinformation.h> +#include <projectexplorer/runnables.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> @@ -46,6 +47,7 @@ using namespace QSsh; using namespace Analyzer; using namespace ProjectExplorer; +using namespace Utils; namespace RemoteLinux { namespace Internal { @@ -71,7 +73,7 @@ public: using namespace Internal; -RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig, +RemoteLinuxAnalyzeSupport::RemoteLinuxAnalyzeSupport(RunConfiguration *runConfig, AnalyzerRunControl *engine, Core::Id runMode) : AbstractRemoteLinuxRunSupport(runConfig, engine), d(new RemoteLinuxAnalyzeSupportPrivate(engine, runMode)) @@ -130,12 +132,12 @@ void RemoteLinuxAnalyzeSupport::startExecution() connect(runner, &DeviceApplicationRunner::reportError, this, &RemoteLinuxAnalyzeSupport::handleAppRunnerError); - const QStringList args = arguments() - << QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort); + QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux); + args.append(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlProfilerServices, d->qmlPort)); - runner->setWorkingDirectory(workingDirectory()); - runner->setEnvironment(environment()); - runner->start(device(), remoteFilePath(), args); + runner->setWorkingDirectory(runnable().workingDirectory); + runner->setEnvironment(runnable().environment); + runner->start(device(), runnable().executable, args); } void RemoteLinuxAnalyzeSupport::handleAppRunnerError(const QString &error) diff --git a/src/plugins/remotelinux/remotelinuxanalyzesupport.h b/src/plugins/remotelinux/remotelinuxanalyzesupport.h index b77393c49f8..9f69296a16d 100644 --- a/src/plugins/remotelinux/remotelinuxanalyzesupport.h +++ b/src/plugins/remotelinux/remotelinuxanalyzesupport.h @@ -36,7 +36,6 @@ namespace Analyzer { class AnalyzerRunControl; } namespace RemoteLinux { -class AbstractRemoteLinuxRunConfiguration; namespace Internal { class RemoteLinuxAnalyzeSupportPrivate; } @@ -44,7 +43,7 @@ class REMOTELINUX_EXPORT RemoteLinuxAnalyzeSupport : public AbstractRemoteLinuxR { Q_OBJECT public: - RemoteLinuxAnalyzeSupport(AbstractRemoteLinuxRunConfiguration *runConfig, + RemoteLinuxAnalyzeSupport(ProjectExplorer::RunConfiguration *runConfig, Analyzer::AnalyzerRunControl *engine, Core::Id runMode); ~RemoteLinuxAnalyzeSupport(); diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 9782e0ab3d3..1f0b9fc2102 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -28,15 +28,20 @@ #include "remotelinuxenvironmentaspect.h" #include "ui_remotelinuxcustomrunconfigurationwidget.h" +#include <projectexplorer/kitinformation.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> + #include <qtsupport/qtoutputformatter.h> #include <utils/detailswidget.h> #include <utils/qtcprocess.h> +using namespace ProjectExplorer; + namespace RemoteLinux { namespace Internal { -class RemoteLinuxCustomRunConfigWidget : public ProjectExplorer::RunConfigWidget +class RemoteLinuxCustomRunConfigWidget : public RunConfigWidget { Q_OBJECT public: @@ -50,23 +55,24 @@ public: detailsContainer->setState(Utils::DetailsWidget::NoSummary); QWidget * const detailsWidget = new QWidget(this); detailsContainer->setWidget(detailsWidget); + auto const runnable = runConfig->runnable().as<StandardRunnable>(); m_ui.setupUi(detailsWidget); m_ui.localExecutablePathChooser->setExpectedKind(Utils::PathChooser::File); - m_ui.localExecutablePathChooser->setPath(m_runConfig->localExecutableFilePath()); - m_ui.remoteExeLineEdit->setText(m_runConfig->remoteExecutableFilePath()); - m_ui.argsLineEdit->setText(m_runConfig->arguments()); - m_ui.workingDirLineEdit->setText(m_runConfig->workingDirectory()); - connect(m_ui.localExecutablePathChooser, SIGNAL(pathChanged(QString)), - SLOT(handleLocalExecutableChanged(QString))); - connect(m_ui.remoteExeLineEdit, SIGNAL(textEdited(QString)), - SLOT(handleRemoteExecutableChanged(QString))); - connect(m_ui.argsLineEdit, SIGNAL(textEdited(QString)), - SLOT(handleArgumentsChanged(QString))); - connect(m_ui.workingDirLineEdit, SIGNAL(textEdited(QString)), - SLOT(handleWorkingDirChanged(QString))); + m_ui.localExecutablePathChooser->setPath(runConfig->localExecutableFilePath()); + m_ui.remoteExeLineEdit->setText(runnable.executable); + m_ui.argsLineEdit->setText(runnable.commandLineArguments); + m_ui.workingDirLineEdit->setText(runnable.workingDirectory); + connect(m_ui.localExecutablePathChooser, &Utils::PathChooser::pathChanged, + this, &RemoteLinuxCustomRunConfigWidget::handleLocalExecutableChanged); + connect(m_ui.remoteExeLineEdit, &QLineEdit::textEdited, + this, &RemoteLinuxCustomRunConfigWidget::handleRemoteExecutableChanged); + connect(m_ui.argsLineEdit, &QLineEdit::textEdited, + this, &RemoteLinuxCustomRunConfigWidget::handleArgumentsChanged); + connect(m_ui.workingDirLineEdit, &QLineEdit::textEdited, + this, &RemoteLinuxCustomRunConfigWidget::handleWorkingDirChanged); } -private slots: +private: void handleLocalExecutableChanged(const QString &path) { m_runConfig->setLocalExecutableFilePath(path.trimmed()); } @@ -84,7 +90,6 @@ private slots: m_runConfig->setWorkingDirectory(wd.trimmed()); } -private: QString displayName() const { return m_runConfig->displayName(); } RemoteLinuxCustomRunConfiguration * const m_runConfig; @@ -92,14 +97,14 @@ private: }; RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent) - : AbstractRemoteLinuxRunConfiguration(parent, runConfigId()) + : RunConfiguration(parent, runConfigId()) { init(); } RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(ProjectExplorer::Target *parent, RemoteLinuxCustomRunConfiguration *source) - : AbstractRemoteLinuxRunConfiguration(parent, source) + : RunConfiguration(parent, source) , m_localExecutable(source->m_localExecutable) , m_remoteExecutable(source->m_remoteExecutable) , m_arguments(source->m_arguments) @@ -136,11 +141,14 @@ Utils::OutputFormatter *RemoteLinuxCustomRunConfiguration::createOutputFormatter return new QtSupport::QtOutputFormatter(target()->project()); } -Utils::Environment RemoteLinuxCustomRunConfiguration::environment() const +Runnable RemoteLinuxCustomRunConfiguration::runnable() const { - RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>(); - QTC_ASSERT(aspect, return Utils::Environment()); - return aspect->environment(); + StandardRunnable r; + r.environment = extraAspect<RemoteLinuxEnvironmentAspect>()->environment(); + r.executable = m_remoteExecutable; + r.commandLineArguments = m_arguments; + r.workingDirectory = m_workingDirectory; + return r; } void RemoteLinuxCustomRunConfiguration::setRemoteExecutableFilePath(const QString &executable) @@ -187,7 +195,7 @@ static QString workingDirKey() bool RemoteLinuxCustomRunConfiguration::fromMap(const QVariantMap &map) { - if (!AbstractRemoteLinuxRunConfiguration::fromMap(map)) + if (!RunConfiguration::fromMap(map)) return false; setLocalExecutableFilePath(map.value(localExeKey()).toString()); setRemoteExecutableFilePath(map.value(remoteExeKey()).toString()); @@ -202,7 +210,7 @@ bool RemoteLinuxCustomRunConfiguration::fromMap(const QVariantMap &map) QVariantMap RemoteLinuxCustomRunConfiguration::toMap() const { - QVariantMap map = AbstractRemoteLinuxRunConfiguration::toMap(); + QVariantMap map = RunConfiguration::toMap(); map.insert(localExeKey(), m_localExecutable); map.insert(remoteExeKey(), m_remoteExecutable); map.insert(argsKey(), m_arguments); diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h index f65c8bf262b..2bd4ebcbc42 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.h @@ -26,12 +26,12 @@ #ifndef REMOTELINUXCUSTOMRUNCONFIGURATION_H #define REMOTELINUXCUSTOMRUNCONFIGURATION_H -#include "abstractremotelinuxrunconfiguration.h" +#include <projectexplorer/runconfiguration.h> namespace RemoteLinux { namespace Internal { -class RemoteLinuxCustomRunConfiguration : public AbstractRemoteLinuxRunConfiguration +class RemoteLinuxCustomRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT public: @@ -47,12 +47,8 @@ public: ConfigurationState ensureConfigured(QString *errorMessage) override; QWidget *createConfigurationWidget() override; Utils::OutputFormatter *createOutputFormatter() const override; - - QString localExecutableFilePath() const override { 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; + ProjectExplorer::Runnable runnable() const override; + QString localExecutableFilePath() const { return m_localExecutable; } void setLocalExecutableFilePath(const QString &executable) { m_localExecutable = executable; } void setRemoteExecutableFilePath(const QString &executable); @@ -69,7 +65,6 @@ private: QString m_remoteExecutable; QString m_arguments; QString m_workingDirectory; - }; } // namespace Internal diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index d8fed3ab750..02c7c101ac8 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -33,20 +33,23 @@ #include <debugger/debuggerkitinformation.h> #include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/project.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> #include <projectexplorer/toolchain.h> -#include <projectexplorer/devicesupport/deviceapplicationrunner.h> - -#include <utils/qtcassert.h> #include <qmldebug/qmldebugcommandlinearguments.h> +#include <utils/qtcassert.h> +#include <utils/qtcprocess.h> + #include <QPointer> using namespace QSsh; using namespace Debugger; using namespace ProjectExplorer; +using namespace Utils; namespace RemoteLinux { namespace Internal { @@ -54,8 +57,7 @@ namespace Internal { class LinuxDeviceDebugSupportPrivate { public: - LinuxDeviceDebugSupportPrivate(const AbstractRemoteLinuxRunConfiguration *runConfig, - DebuggerRunControl *runControl) + LinuxDeviceDebugSupportPrivate(const RunConfiguration *runConfig, DebuggerRunControl *runControl) : runControl(runControl), qmlDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useQmlDebugger()), cppDebugging(runConfig->extraAspect<DebuggerRunConfigurationAspect>()->useCppDebugger()), @@ -75,45 +77,15 @@ public: using namespace Internal; -DebuggerStartParameters LinuxDeviceDebugSupport::startParameters(const AbstractRemoteLinuxRunConfiguration *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, +LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunConfiguration *runConfig, DebuggerRunControl *runControl) : AbstractRemoteLinuxRunSupport(runConfig, runControl), - d(new LinuxDeviceDebugSupportPrivate(static_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig), runControl)) + d(new LinuxDeviceDebugSupportPrivate(runConfig, runControl)) { connect(runControl, &DebuggerRunControl::requestRemoteSetup, this, &LinuxDeviceDebugSupport::handleRemoteSetupRequested); + connect(runControl, &RunControl::finished, + this, &LinuxDeviceDebugSupport::handleDebuggingFinished); } LinuxDeviceDebugSupport::~LinuxDeviceDebugSupport() @@ -156,14 +128,14 @@ void LinuxDeviceDebugSupport::startExecution() connect(runner, &DeviceApplicationRunner::remoteProcessStarted, this, &LinuxDeviceDebugSupport::handleRemoteProcessStarted); - QStringList args = arguments(); + QStringList args = QtcProcess::splitArgs(runnable().commandLineArguments, OsTypeLinux); QString command; if (d->qmlDebugging) args.prepend(QmlDebug::qmlDebugTcpArguments(QmlDebug::QmlDebuggerServices, d->qmlPort)); if (d->qmlDebugging && !d->cppDebugging) { - command = remoteFilePath(); + command = runnable().executable; } else { command = device()->debugServerPath(); if (command.isEmpty()) @@ -179,8 +151,8 @@ void LinuxDeviceDebugSupport::startExecution() this, &LinuxDeviceDebugSupport::handleProgressReport); connect(runner, &DeviceApplicationRunner::reportError, this, &LinuxDeviceDebugSupport::handleAppRunnerError); - runner->setEnvironment(environment()); - runner->setWorkingDirectory(workingDirectory()); + runner->setEnvironment(runnable().environment); + runner->setWorkingDirectory(runnable().workingDirectory); runner->start(device(), command, args); } diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index 6c3a6eeccb9..390cac3379a 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -28,23 +28,18 @@ #include "abstractremotelinuxrunsupport.h" -namespace Debugger { -class DebuggerRunControl; -class DebuggerStartParameters; -} +namespace Debugger { class DebuggerRunControl; } namespace RemoteLinux { -class AbstractRemoteLinuxRunConfiguration; namespace Internal { class LinuxDeviceDebugSupportPrivate; } class REMOTELINUX_EXPORT LinuxDeviceDebugSupport : public AbstractRemoteLinuxRunSupport { Q_OBJECT -public: - static Debugger::DebuggerStartParameters startParameters(const AbstractRemoteLinuxRunConfiguration *runConfig); - LinuxDeviceDebugSupport(AbstractRemoteLinuxRunConfiguration *runConfig, +public: + LinuxDeviceDebugSupport(ProjectExplorer::RunConfiguration *runConfig, Debugger::DebuggerRunControl *runControl); ~LinuxDeviceDebugSupport(); diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp index 3655ecf6770..41432ba29bf 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.cpp @@ -25,7 +25,6 @@ #include "remotelinuxenvironmentaspect.h" -#include "abstractremotelinuxrunconfiguration.h" #include "remotelinuxenvironmentaspectwidget.h" namespace RemoteLinux { @@ -74,11 +73,6 @@ Utils::Environment RemoteLinuxEnvironmentAspect::baseEnvironment() const return env; } -AbstractRemoteLinuxRunConfiguration *RemoteLinuxEnvironmentAspect::runConfiguration() const -{ - return qobject_cast<AbstractRemoteLinuxRunConfiguration *>(EnvironmentAspect::runConfiguration()); -} - Utils::Environment RemoteLinuxEnvironmentAspect::remoteEnvironment() const { return m_remoteEnvironment; diff --git a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h index 55f752c7465..5e431afec66 100644 --- a/src/plugins/remotelinux/remotelinuxenvironmentaspect.h +++ b/src/plugins/remotelinux/remotelinuxenvironmentaspect.h @@ -32,7 +32,6 @@ namespace RemoteLinux { class RemoteLinuxEnvironmentAspectWidget; -class AbstractRemoteLinuxRunConfiguration; class REMOTELINUX_EXPORT RemoteLinuxEnvironmentAspect : public ProjectExplorer::EnvironmentAspect { @@ -47,8 +46,6 @@ public: QString baseEnvironmentDisplayName(int base) const; Utils::Environment baseEnvironment() const; - AbstractRemoteLinuxRunConfiguration *runConfiguration() const; - Utils::Environment remoteEnvironment() const; void setRemoteEnvironment(const Utils::Environment &env); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index b79066a9173..44f710ec503 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -30,7 +30,9 @@ #include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/deploymentdata.h> +#include <projectexplorer/kitinformation.h> #include <projectexplorer/project.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> #include <qtsupport/qtoutputformatter.h> #include <utils/qtcprocess.h> @@ -79,7 +81,7 @@ using namespace Internal; RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::Id id, const QString &targetName) - : AbstractRemoteLinuxRunConfiguration(parent, id), + : RunConfiguration(parent, id), d(new RemoteLinuxRunConfigurationPrivate(targetName)) { init(); @@ -87,7 +89,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, Core::I RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *parent, RemoteLinuxRunConfiguration *source) - : AbstractRemoteLinuxRunConfiguration(parent, source), + : RunConfiguration(parent, source), d(new RemoteLinuxRunConfigurationPrivate(source->d)) { init(); @@ -125,6 +127,15 @@ OutputFormatter *RemoteLinuxRunConfiguration::createOutputFormatter() const 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 { @@ -171,13 +182,6 @@ QString RemoteLinuxRunConfiguration::arguments() const return d->arguments; } -Environment RemoteLinuxRunConfiguration::environment() const -{ - RemoteLinuxEnvironmentAspect *aspect = extraAspect<RemoteLinuxEnvironmentAspect>(); - QTC_ASSERT(aspect, return Environment()); - return aspect->environment(); -} - QString RemoteLinuxRunConfiguration::localExecutableFilePath() const { return target()->applicationTargets().targetFilePath(d->targetName).toString(); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.h b/src/plugins/remotelinux/remotelinuxrunconfiguration.h index 33245a3d04c..2b161075271 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.h +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.h @@ -27,7 +27,6 @@ #define REMOTELINUXRUNCONFIGURATION_H #include "remotelinux_export.h" -#include "abstractremotelinuxrunconfiguration.h" #include <projectexplorer/runconfiguration.h> @@ -47,7 +46,7 @@ class RemoteLinuxRunConfigurationPrivate; class RemoteLinuxRunConfigurationFactory; } // namespace Internal -class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public AbstractRemoteLinuxRunConfiguration +class REMOTELINUX_EXPORT RemoteLinuxRunConfiguration : public ProjectExplorer::RunConfiguration { Q_OBJECT Q_DISABLE_COPY(RemoteLinuxRunConfiguration) @@ -63,14 +62,14 @@ public: QWidget *createConfigurationWidget() 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 remoteExecutableFilePath() const override; - QString arguments() const override; + QString remoteExecutableFilePath() const; + QString arguments() const; void setArguments(const QString &args); - QString workingDirectory() const override; + QString workingDirectory() const; void setWorkingDirectory(const QString &wd); void setAlternateRemoteExecutable(const QString &exe); QString alternateRemoteExecutable() const; diff --git a/src/plugins/remotelinux/remotelinuxruncontrol.cpp b/src/plugins/remotelinux/remotelinuxruncontrol.cpp index 50da9aeade5..090c87e8fe0 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrol.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrol.cpp @@ -25,14 +25,12 @@ #include "remotelinuxruncontrol.h" -#include "abstractremotelinuxrunconfiguration.h" - #include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/projectexplorericons.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> -#include <utils/environment.h> #include <utils/qtcprocess.h> using namespace ProjectExplorer; @@ -45,10 +43,7 @@ public: bool running; DeviceApplicationRunner runner; IDevice::ConstPtr device; - QString remoteExecutable; - QString arguments; - Utils::Environment environment; - QString workingDir; + StandardRunnable runnable; }; RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc) @@ -57,12 +52,8 @@ RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc) setIcon(ProjectExplorer::Icons::RUN_SMALL); d->running = false; + d->runnable = rc->runnable().as<StandardRunnable>(); 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() @@ -85,10 +76,11 @@ void RemoteLinuxRunControl::start() this, &RemoteLinuxRunControl::handleRunnerFinished); connect(&d->runner, &DeviceApplicationRunner::reportProgress, this, &RemoteLinuxRunControl::handleProgressReport); - d->runner.setEnvironment(d->environment); - d->runner.setWorkingDirectory(d->workingDir); - d->runner.start(d->device, d->remoteExecutable, - Utils::QtcProcess::splitArgs(d->arguments, Utils::OsTypeLinux)); + d->runner.setEnvironment(d->runnable.environment); + d->runner.setWorkingDirectory(d->runnable.workingDirectory); + d->runner.start(d->device, d->runnable.executable, + Utils::QtcProcess::splitArgs(d->runnable.commandLineArguments, + Utils::OsTypeLinux)); } RunControl::StopResult RemoteLinuxRunControl::stop() diff --git a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp index be566019413..f7578676d38 100644 --- a/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp +++ b/src/plugins/remotelinux/remotelinuxruncontrolfactory.cpp @@ -31,14 +31,20 @@ #include "remotelinuxrunconfiguration.h" #include "remotelinuxruncontrol.h" -#include <debugger/debuggerruncontrol.h> -#include <debugger/debuggerrunconfigurationaspect.h> -#include <debugger/debuggerstartparameters.h> #include <analyzerbase/analyzermanager.h> #include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/ianalyzertool.h> + +#include <debugger/debuggerruncontrol.h> +#include <debugger/debuggerrunconfigurationaspect.h> +#include <debugger/debuggerstartparameters.h> + #include <projectexplorer/kitinformation.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> + +#include <qmldebug/qmldebugcommandlinearguments.h> + #include <utils/portlist.h> #include <utils/qtcassert.h> @@ -81,6 +87,10 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co if (mode == ProjectExplorer::Constants::NORMAL_RUN_MODE) 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 || mode == ProjectExplorer::Constants::DEBUG_RUN_MODE_WITH_BREAK_ON_MAIN) { 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."); return 0; } - auto * const rc = qobject_cast<AbstractRemoteLinuxRunConfiguration *>(runConfig); - QTC_ASSERT(rc, return 0); auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>(); 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."); 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."); 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); if (!runControl) return 0; - LinuxDeviceDebugSupport * const debugSupport = - new LinuxDeviceDebugSupport(rc, runControl); - connect(runControl, SIGNAL(finished()), debugSupport, SLOT(handleDebuggingFinished())); + (void) new LinuxDeviceDebugSupport(runConfig, runControl); return runControl; } 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); AnalyzerConnection connection; connection.connParams = DeviceKitInformation::device(runConfig->target()->kit())->sshParameters(); connection.analyzerHost = connection.connParams.host; runControl->setConnection(connection); - (void) new RemoteLinuxAnalyzeSupport(rc, runControl, mode); + (void) new RemoteLinuxAnalyzeSupport(runConfig, runControl, mode); return runControl; } diff --git a/src/plugins/valgrind/valgrindruncontrolfactory.cpp b/src/plugins/valgrind/valgrindruncontrolfactory.cpp index 812b7d5e971..6ef062081fa 100644 --- a/src/plugins/valgrind/valgrindruncontrolfactory.cpp +++ b/src/plugins/valgrind/valgrindruncontrolfactory.cpp @@ -37,13 +37,12 @@ #include <analyzerbase/analyzerruncontrol.h> #include <analyzerbase/analyzerrunconfigwidget.h> -#include <remotelinux/abstractremotelinuxrunconfiguration.h> - #include <debugger/debuggerrunconfigurationaspect.h> + #include <projectexplorer/environmentaspect.h> -#include <projectexplorer/runnables.h> #include <projectexplorer/kitinformation.h> #include <projectexplorer/projectexplorer.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/target.h> #include <utils/qtcassert.h> @@ -81,9 +80,9 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration AnalyzerConnection connection; QString workingDirectory; Runnable rcRunnable = runConfiguration->runnable(); - if (rcRunnable.is<StandardRunnable>() - && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { - auto stdRunnable = runConfiguration->runnable().as<StandardRunnable>(); + QTC_ASSERT(rcRunnable.is<StandardRunnable>(), return 0); + auto stdRunnable = runConfiguration->runnable().as<StandardRunnable>(); + if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) { environment = stdRunnable.environment; workingDirectory = stdRunnable.workingDirectory; runnable.debuggee = stdRunnable.executable; @@ -96,12 +95,10 @@ RunControl *ValgrindRunControlFactory::create(RunConfiguration *runConfiguration connection.connParams.host = server.serverAddress().toString(); connection.connParams.port = server.serverPort(); 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 { - QTC_ASSERT(false, return 0); + runnable.debuggee = stdRunnable.executable; + runnable.debuggeeArgs = stdRunnable.commandLineArguments; + connection.connParams = device->sshParameters(); } runControl->setRunnable(runnable); |