RemoteLinux: Merge tooling runworker related files

... and move definition of supported runconfig to worker factories

This might not be final, but is closer to the other device setups.

Change-Id: If68d4e9d1bfb281879ff8cd46ed6ed6356da8d57
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-01-06 17:52:03 +01:00
parent fa7dd2fd3b
commit 1db9135d6d
10 changed files with 75 additions and 98 deletions

View File

@@ -25,7 +25,6 @@ add_qtc_plugin(RemoteLinux
remotelinuxdeployconfiguration.cpp remotelinuxdeployconfiguration.h remotelinuxdeployconfiguration.cpp remotelinuxdeployconfiguration.h
remotelinuxenvironmentaspect.cpp remotelinuxenvironmentaspect.h remotelinuxenvironmentaspect.cpp remotelinuxenvironmentaspect.h
remotelinuxplugin.cpp remotelinuxplugin.h remotelinuxplugin.cpp remotelinuxplugin.h
remotelinuxqmltoolingsupport.cpp remotelinuxqmltoolingsupport.h
remotelinuxrunconfiguration.cpp remotelinuxrunconfiguration.h remotelinuxrunconfiguration.cpp remotelinuxrunconfiguration.h
remotelinuxsignaloperation.cpp remotelinuxsignaloperation.h remotelinuxsignaloperation.cpp remotelinuxsignaloperation.h
rsyncdeploystep.cpp rsyncdeploystep.h rsyncdeploystep.cpp rsyncdeploystep.h

View File

@@ -55,8 +55,6 @@ Project {
"remotelinuxenvironmentaspect.h", "remotelinuxenvironmentaspect.h",
"remotelinuxplugin.cpp", "remotelinuxplugin.cpp",
"remotelinuxplugin.h", "remotelinuxplugin.h",
"remotelinuxqmltoolingsupport.cpp",
"remotelinuxqmltoolingsupport.h",
"remotelinuxrunconfiguration.cpp", "remotelinuxrunconfiguration.cpp",
"remotelinuxrunconfiguration.h", "remotelinuxrunconfiguration.h",
"remotelinuxsignaloperation.cpp", "remotelinuxsignaloperation.cpp",

View File

@@ -21,5 +21,8 @@ const char KillAppStepId[] = "RemoteLinux.KillAppStep";
const char SupportsRSync[] = "RemoteLinux.SupportsRSync"; const char SupportsRSync[] = "RemoteLinux.SupportsRSync";
const char RunConfigId[] = "RemoteLinuxRunConfiguration:";
const char CustomRunConfigId[] = "RemoteLinux.CustomRunConfig";
} // Constants } // Constants
} // RemoteLinux } // RemoteLinux

View File

@@ -84,7 +84,7 @@ Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const
RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFactory() RemoteLinuxCustomRunConfigurationFactory::RemoteLinuxCustomRunConfigurationFactory()
: FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true) : FixedRunConfigurationFactory(Tr::tr("Custom Executable"), true)
{ {
registerRunConfiguration<RemoteLinuxCustomRunConfiguration>("RemoteLinux.CustomRunConfig"); registerRunConfiguration<RemoteLinuxCustomRunConfiguration>(Constants::CustomRunConfigId);
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
} }

View File

@@ -10,15 +10,18 @@
#include <debugger/debuggerruncontrol.h> #include <debugger/debuggerruncontrol.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
using namespace Debugger; using namespace Debugger;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux::Internal { namespace RemoteLinux::Internal {
class RemoteLinuxDebugWorker final : public DebuggerRunTool class RemoteLinuxDebugWorker final : public DebuggerRunTool
{ {
public: public:
RemoteLinuxDebugWorker(RunControl *runControl) explicit RemoteLinuxDebugWorker(RunControl *runControl)
: DebuggerRunTool(runControl, DoNotAllowTerminal) : DebuggerRunTool(runControl, DoNotAllowTerminal)
{ {
setId("RemoteLinuxDebugWorker"); setId("RemoteLinuxDebugWorker");
@@ -38,22 +41,72 @@ public:
} }
}; };
class RemoteLinuxQmlToolingSupport final : public SimpleTargetRunner
{
public:
explicit RemoteLinuxQmlToolingSupport(RunControl *runControl)
: SimpleTargetRunner(runControl)
{
setId("RemoteLinuxQmlToolingSupport");
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);
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);
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
CommandLine cmd = commandLine();
cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl));
setCommandLine(cmd);
});
}
};
// Factories // Factories
RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory(const QList<Utils::Id> &runConfigs) static const QList<Id> supportedRunConfigs()
{
return {
Constants::RunConfigId,
Constants::CustomRunConfigId,
"QmlProjectManager.QmlRunConfiguration"
};
}
RemoteLinuxRunWorkerFactory::RemoteLinuxRunWorkerFactory()
{ {
setProduct<SimpleTargetRunner>(); setProduct<SimpleTargetRunner>();
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
setSupportedRunConfigs(runConfigs);
addSupportedDeviceType(Constants::GenericLinuxOsType); addSupportedDeviceType(Constants::GenericLinuxOsType);
setSupportedRunConfigs(supportedRunConfigs());
} }
RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory(const QList<Utils::Id> &runConfigs) RemoteLinuxDebugWorkerFactory::RemoteLinuxDebugWorkerFactory()
{ {
setProduct<RemoteLinuxDebugWorker>(); setProduct<RemoteLinuxDebugWorker>();
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
setSupportedRunConfigs(runConfigs);
addSupportedDeviceType(Constants::GenericLinuxOsType); addSupportedDeviceType(Constants::GenericLinuxOsType);
setSupportedRunConfigs(supportedRunConfigs());
} }
} // Internal::Internal RemoteLinuxQmlToolingWorkerFactory::RemoteLinuxQmlToolingWorkerFactory()
{
setProduct<RemoteLinuxQmlToolingSupport>();
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
addSupportedDeviceType(Constants::GenericLinuxOsType);
setSupportedRunConfigs(supportedRunConfigs());
}
} // RemoteLinux::Internal

View File

@@ -10,13 +10,19 @@ namespace RemoteLinux::Internal {
class RemoteLinuxRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory class RemoteLinuxRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
explicit RemoteLinuxRunWorkerFactory(const QList<Utils::Id> &runConfigs); explicit RemoteLinuxRunWorkerFactory();
}; };
class RemoteLinuxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory class RemoteLinuxDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{ {
public: public:
explicit RemoteLinuxDebugWorkerFactory(const QList<Utils::Id> &runConfigs); explicit RemoteLinuxDebugWorkerFactory();
};
class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
explicit RemoteLinuxQmlToolingWorkerFactory();
}; };
} // RemoteLinux::Internal } // RemoteLinux::Internal

View File

@@ -10,7 +10,6 @@
#include "makeinstallstep.h" #include "makeinstallstep.h"
#include "remotelinux_constants.h" #include "remotelinux_constants.h"
#include "remotelinuxdeployconfiguration.h" #include "remotelinuxdeployconfiguration.h"
#include "remotelinuxqmltoolingsupport.h"
#include "remotelinuxcustomrunconfiguration.h" #include "remotelinuxcustomrunconfiguration.h"
#include "remotelinuxdebugsupport.h" #include "remotelinuxdebugsupport.h"
#include "remotelinuxdeployconfiguration.h" #include "remotelinuxdeployconfiguration.h"
@@ -62,15 +61,9 @@ public:
CustomCommandDeployStepFactory customCommandDeployStepFactory; CustomCommandDeployStepFactory customCommandDeployStepFactory;
KillAppStepFactory killAppStepFactory; KillAppStepFactory killAppStepFactory;
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory; GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;
RemoteLinuxRunWorkerFactory runWorkerFactory;
const QList<Utils::Id> supportedRunConfigs { RemoteLinuxDebugWorkerFactory debugWorkerFactory;
runConfigurationFactory.runConfigurationId(), RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory;
customRunConfigurationFactory.runConfigurationId(),
"QmlProjectManager.QmlRunConfiguration"
};
RemoteLinuxRunWorkerFactory runWorkerFactory{supportedRunConfigs};
RemoteLinuxDebugWorkerFactory debugWorkerFactory{supportedRunConfigs};
RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory{supportedRunConfigs};
}; };
static RemoteLinuxPluginPrivate *dd = nullptr; static RemoteLinuxPluginPrivate *dd = nullptr;

View File

@@ -1,59 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "remotelinuxqmltoolingsupport.h"
#include "remotelinux_constants.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
#include <qmldebug/qmldebugcommandlinearguments.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux::Internal {
class RemoteLinuxQmlToolingSupport : public SimpleTargetRunner
{
public:
explicit RemoteLinuxQmlToolingSupport(RunControl *runControl)
: SimpleTargetRunner(runControl)
{
setId("RemoteLinuxQmlToolingSupport");
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);
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);
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
CommandLine cmd = commandLine();
cmd.addArg(QmlDebug::qmlDebugTcpArguments(services, serverUrl));
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);
}
} // RemoteLinux::Internal

View File

@@ -1,16 +0,0 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <projectexplorer/runcontrol.h>
namespace RemoteLinux::Internal {
class RemoteLinuxQmlToolingWorkerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
explicit RemoteLinuxQmlToolingWorkerFactory(const QList<Utils::Id> &runConfigs);
};
} // RemoteLinux::Internal

View File

@@ -90,7 +90,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory() RemoteLinuxRunConfigurationFactory::RemoteLinuxRunConfigurationFactory()
{ {
registerRunConfiguration<RemoteLinuxRunConfiguration>("RemoteLinuxRunConfiguration:"); registerRunConfiguration<RemoteLinuxRunConfiguration>(Constants::RunConfigId);
setDecorateDisplayNames(true); setDecorateDisplayNames(true);
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
} }