RemoteLinux: Use dedicated classes for run worker factories

I put the normal run in the debugsupport file for now, I plan
to squash all three afterwards.

Change-Id: I855772f7dff8c8ccce07193733c26468fec40b85
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-01-06 16:08:14 +01:00
parent 44a9f5a63a
commit ccff024a66
5 changed files with 92 additions and 64 deletions

View File

@@ -3,30 +3,57 @@
#include "remotelinuxdebugsupport.h" #include "remotelinuxdebugsupport.h"
#include "remotelinux_constants.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfigurationaspects.h> #include <projectexplorer/runconfigurationaspects.h>
#include <debugger/debuggerruncontrol.h>
using namespace Debugger; using namespace Debugger;
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {
LinuxDeviceDebugSupport::LinuxDeviceDebugSupport(RunControl *runControl) class RemoteLinuxDebugWorker final : public DebuggerRunTool
: DebuggerRunTool(runControl, DebuggerRunTool::DoNotAllowTerminal)
{ {
setId("LinuxDeviceDebugSupport"); public:
RemoteLinuxDebugWorker(RunControl *runControl)
: DebuggerRunTool(runControl, DoNotAllowTerminal)
{
setId("RemoteLinuxDebugWorker");
setUsePortsGatherer(isCppDebugging(), isQmlDebugging()); setUsePortsGatherer(isCppDebugging(), isQmlDebugging());
addQmlServerInferiorCommandLineArgumentIfNeeded(); addQmlServerInferiorCommandLineArgumentIfNeeded();
auto debugServer = new DebugServerRunner(runControl, portsGatherer()); auto debugServer = new DebugServerRunner(runControl, portsGatherer());
debugServer->setEssential(true); debugServer->setEssential(true);
addStartDependency(debugServer); addStartDependency(debugServer);
setStartMode(AttachToRemoteServer); setStartMode(AttachToRemoteServer);
setCloseMode(KillAndExitMonitorAtClose); setCloseMode(KillAndExitMonitorAtClose);
setUseExtendedRemote(true); setUseExtendedRemote(true);
setLldbPlatform("remote-linux"); setLldbPlatform("remote-linux");
}
};
// Factories
RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory(const QList<Utils::Id> &runConfigs)
{
setProduct<SimpleTargetRunner>();
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
setSupportedRunConfigs(runConfigs);
addSupportedDeviceType(Constants::GenericLinuxOsType);
}
RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory(const QList<Utils::Id> &runConfigs)
{
setProduct<RemoteLinuxDebugWorker>();
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
setSupportedRunConfigs(runConfigs);
addSupportedDeviceType(Constants::GenericLinuxOsType);
} }
} // Internal::Internal } // Internal::Internal

View File

@@ -3,14 +3,20 @@
#pragma once #pragma once
#include <debugger/debuggerruncontrol.h> #include <projectexplorer/runcontrol.h>
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {
class LinuxDeviceDebugSupport : public Debugger::DebuggerRunTool class RemoteLinuxRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
LinuxDeviceDebugSupport(ProjectExplorer::RunControl *runControl); explicit RemoteLinuxRunWorkerFactory(const QList<Utils::Id> &runConfigs);
};
class RemoteLinuxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
explicit RemoteLinuxDebugWorkerFactory(const QList<Utils::Id> &runConfigs);
}; };
} // RemoteLinux::Internal } // RemoteLinux::Internal

View File

@@ -68,26 +68,9 @@ public:
customRunConfigurationFactory.runConfigurationId(), customRunConfigurationFactory.runConfigurationId(),
"QmlProjectManager.QmlRunConfiguration" "QmlProjectManager.QmlRunConfiguration"
}; };
RemoteLinuxRunWorkerFactory runWorkerFactory{supportedRunConfigs};
RunWorkerFactory runnerFactory{ RemoteLinuxDebugWorkerFactory debugWorkerFactory{supportedRunConfigs};
RunWorkerFactory::make<SimpleTargetRunner>(), RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory{supportedRunConfigs};
{ProjectExplorer::Constants::NORMAL_RUN_MODE},
supportedRunConfigs,
{Constants::GenericLinuxOsType}
};
RunWorkerFactory debuggerFactory{
RunWorkerFactory::make<LinuxDeviceDebugSupport>(),
{ProjectExplorer::Constants::DEBUG_RUN_MODE},
supportedRunConfigs,
{Constants::GenericLinuxOsType}
};
RunWorkerFactory qmlToolingFactory{
RunWorkerFactory::make<RemoteLinuxQmlToolingSupport>(),
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
supportedRunConfigs,
{Constants::GenericLinuxOsType}
};
}; };
static RemoteLinuxPluginPrivate *dd = nullptr; static RemoteLinuxPluginPrivate *dd = nullptr;

View File

@@ -3,6 +3,9 @@
#include "remotelinuxqmltoolingsupport.h" #include "remotelinuxqmltoolingsupport.h"
#include "remotelinux_constants.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h> #include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <qmldebug/qmldebugcommandlinearguments.h> #include <qmldebug/qmldebugcommandlinearguments.h>
@@ -10,36 +13,47 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux::Internal {
namespace Internal {
RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runControl) class RemoteLinuxQmlToolingSupport : public SimpleTargetRunner
: SimpleTargetRunner(runControl)
{ {
setId("RemoteLinuxQmlToolingSupport"); public:
explicit RemoteLinuxQmlToolingSupport(RunControl *runControl)
: SimpleTargetRunner(runControl)
{
setId("RemoteLinuxQmlToolingSupport");
auto portsGatherer = new PortsGatherer(runControl); auto portsGatherer = new PortsGatherer(runControl);
addStartDependency(portsGatherer); addStartDependency(portsGatherer);
// The ports gatherer can safely be stopped once the process is running, even though it has to // The ports gatherer can safely be stopped once the process is running, even though it has to
// be started before. // be started before.
addStopDependency(portsGatherer); addStopDependency(portsGatherer);
auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode())); auto runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
runworker->addStartDependency(this); runworker->addStartDependency(this);
addStopDependency(runworker); addStopDependency(runworker);
setStartModifier([this, runControl, portsGatherer, runworker] { setStartModifier([this, runControl, portsGatherer, runworker] {
const QUrl serverUrl = portsGatherer->findEndPoint(); const QUrl serverUrl = portsGatherer->findEndPoint();
runworker->recordData("QmlServerUrl", serverUrl); runworker->recordData("QmlServerUrl", serverUrl);
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode()); QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
CommandLine cmd = commandLine(); CommandLine cmd = commandLine();
cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl)); cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl));
setCommandLine(cmd); setCommandLine(cmd);
}); });
}
};
RemoteLinuxQmlToolingWorkerFactory::RemoteLinuxQmlToolingWorkerFactory(const QList<Utils::Id> &runConfigs)
{
setProduct<RemoteLinuxQmlToolingSupport>();
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
setSupportedRunConfigs(runConfigs);
addSupportedDeviceType(Constants::GenericLinuxOsType);
} }
} // namespace Internal } // RemoteLinux::Internal
} // namespace RemoteLinux

View File

@@ -5,14 +5,12 @@
#include <projectexplorer/runcontrol.h> #include <projectexplorer/runcontrol.h>
namespace RemoteLinux { namespace RemoteLinux::Internal {
namespace Internal {
class RemoteLinuxQmlToolingSupport : public ProjectExplorer::SimpleTargetRunner class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
explicit RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl); explicit RemoteLinuxQmlToolingWorkerFactory(const QList<Utils::Id> &runConfigs);
}; };
} // namespace Internal } // RemoteLinux::Internal
} // namespace RemoteLinux