diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp index 351daa025f7..2f706c6e94c 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.cpp @@ -3,30 +3,57 @@ #include "remotelinuxdebugsupport.h" +#include "remotelinux_constants.h" + +#include #include +#include + using namespace Debugger; using namespace ProjectExplorer; namespace RemoteLinux::Internal { -LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) - : DebuggerRunTool(runControl, DebuggerRunTool::DoNotAllowTerminal) +class RemoteLinuxDebugWorker final : public DebuggerRunTool { - setId("LinuxDeviceDebugSupport"); +public: + RemoteLinuxDebugWorker(RunControl *runControl) + : DebuggerRunTool(runControl, DoNotAllowTerminal) + { + setId("RemoteLinuxDebugWorker"); - setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); - addQmlServerInferiorCommandLineArgumentIfNeeded(); + setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); + addQmlServerInferiorCommandLineArgumentIfNeeded(); - auto debugServer = new DebugServerRunner(runControl, portsGatherer()); - debugServer->setEssential(true); + auto debugServer = new DebugServerRunner(runControl, portsGatherer()); + debugServer->setEssential(true); - addStartDependency(debugServer); + addStartDependency(debugServer); - setStartMode(AttachToRemoteServer); - setCloseMode(KillAndExitMonitorAtClose); - setUseExtendedRemote(true); - setLldbPlatform("remote-linux"); + setStartMode(AttachToRemoteServer); + setCloseMode(KillAndExitMonitorAtClose); + setUseExtendedRemote(true); + setLldbPlatform("remote-linux"); + } +}; + +// Factories + +RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory(const QList &runConfigs) +{ + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE); + setSupportedRunConfigs(runConfigs); + addSupportedDeviceType(Constants::GenericLinuxOsType); +} + +RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory(const QList &runConfigs) +{ + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); + setSupportedRunConfigs(runConfigs); + addSupportedDeviceType(Constants::GenericLinuxOsType); } } // Internal::Internal diff --git a/src/plugins/remotelinux/remotelinuxdebugsupport.h b/src/plugins/remotelinux/remotelinuxdebugsupport.h index f6f2c39860d..a8142c79363 100644 --- a/src/plugins/remotelinux/remotelinuxdebugsupport.h +++ b/src/plugins/remotelinux/remotelinuxdebugsupport.h @@ -3,14 +3,20 @@ #pragma once -#include +#include namespace RemoteLinux::Internal { -class LinuxDeviceDebugSupport : public Debugger::DebuggerRunTool +class RemoteLinuxRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - LinuxDeviceDebugSupport(ProjectExplorer::RunControl *runControl); + explicit RemoteLinuxRunWorkerFactory(const QList &runConfigs); +}; + +class RemoteLinuxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory +{ +public: + explicit RemoteLinuxDebugWorkerFactory(const QList &runConfigs); }; } // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp index 884c18fd963..aaf457197ed 100644 --- a/src/plugins/remotelinux/remotelinuxplugin.cpp +++ b/src/plugins/remotelinux/remotelinuxplugin.cpp @@ -68,26 +68,9 @@ public: customRunConfigurationFactory.runConfigurationId(), "QmlProjectManager.QmlRunConfiguration" }; - - RunWorkerFactory runnerFactory{ - RunWorkerFactory::make(), - {ProjectExplorer::Constants::NORMAL_RUN_MODE}, - supportedRunConfigs, - {Constants::GenericLinuxOsType} - }; - RunWorkerFactory debuggerFactory{ - RunWorkerFactory::make(), - {ProjectExplorer::Constants::DEBUG_RUN_MODE}, - supportedRunConfigs, - {Constants::GenericLinuxOsType} - }; - RunWorkerFactory qmlToolingFactory{ - RunWorkerFactory::make(), - {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, - ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE}, - supportedRunConfigs, - {Constants::GenericLinuxOsType} - }; + RemoteLinuxRunWorkerFactory runWorkerFactory{supportedRunConfigs}; + RemoteLinuxDebugWorkerFactory debugWorkerFactory{supportedRunConfigs}; + RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory{supportedRunConfigs}; }; static RemoteLinuxPluginPrivate *dd = nullptr; diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp index eb16014fcb9..cf74a176c8d 100644 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp +++ b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.cpp @@ -3,6 +3,9 @@ #include "remotelinuxqmltoolingsupport.h" +#include "remotelinux_constants.h" + +#include #include #include @@ -10,36 +13,47 @@ using namespace ProjectExplorer; using namespace Utils; -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { -RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runControl) - : SimpleTargetRunner(runControl) +class RemoteLinuxQmlToolingSupport : public SimpleTargetRunner { - setId("RemoteLinuxQmlToolingSupport"); +public: + explicit RemoteLinuxQmlToolingSupport(RunControl *runControl) + : SimpleTargetRunner(runControl) + { + setId("RemoteLinuxQmlToolingSupport"); - auto portsGatherer = new PortsGatherer(runControl); - addStartDependency(portsGatherer); + auto portsGatherer = new PortsGatherer(runControl); + addStartDependency(portsGatherer); - // The ports gatherer can safely be stopped once the process is running, even though it has to - // be started before. - addStopDependency(portsGatherer); + // The ports gatherer can safely be stopped once the process is running, even though it has to + // be started before. + addStopDependency(portsGatherer); - auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); - runworker->addStartDependency(this); - addStopDependency(runworker); + auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); + runworker->addStartDependency(this); + addStopDependency(runworker); - setStartModifier([this, runControl, portsGatherer, runworker] { - const QUrl serverUrl = portsGatherer->findEndPoint(); - runworker->recordData("QmlServerUrl", serverUrl); + setStartModifier([this, runControl, portsGatherer, runworker] { + const QUrl serverUrl = portsGatherer->findEndPoint(); + runworker->recordData("QmlServerUrl", serverUrl); - QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); + QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); - CommandLine cmd = commandLine(); - cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); - setCommandLine(cmd); - }); + CommandLine cmd = commandLine(); + cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); + setCommandLine(cmd); + }); + } +}; + +RemoteLinuxQmlToolingWorkerFactory::RemoteLinuxQmlToolingWorkerFactory(const QList &runConfigs) +{ + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); + addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); + setSupportedRunConfigs(runConfigs); + addSupportedDeviceType(Constants::GenericLinuxOsType); } -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal diff --git a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h index 3a6b3dd13a6..f9dbdf14bbe 100644 --- a/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h +++ b/src/plugins/remotelinux/remotelinuxqmltoolingsupport.h @@ -5,14 +5,12 @@ #include -namespace RemoteLinux { -namespace Internal { +namespace RemoteLinux::Internal { -class RemoteLinuxQmlToolingSupport : public ProjectExplorer::SimpleTargetRunner +class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory { public: - explicit RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl); + explicit RemoteLinuxQmlToolingWorkerFactory(const QList &runConfigs); }; -} // namespace Internal -} // namespace RemoteLinux +} // RemoteLinux::Internal