PE: Rename SimpleTargetRunner into ProcessRunner

Change-Id: Ie666fe0811aa63c54edf12934c6db4e17b26c252
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2025-01-02 14:18:31 +01:00
parent 638874edfb
commit ab27988186
22 changed files with 74 additions and 80 deletions

View File

@@ -172,7 +172,7 @@ RunWorker *GdbServerProvider::targetRunner(RunControl *runControl) const
// Command arguments are in host OS style as the bare metal's GDB servers are launched
// on the host, not on that target.
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("BareMetalGdbServer");
// Baremetal's GDB servers are launched on the host, not on the target.
worker->setStartModifier([worker, cmd = command()] {

View File

@@ -204,7 +204,7 @@ bool UvscServerProvider::aboutToRun(DebuggerRunTool *runTool, QString &errorMess
ProjectExplorer::RunWorker *UvscServerProvider::targetRunner(RunControl *runControl) const
{
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("BareMetalUvscServer");
worker->setCommandLine({DebuggerKitAspect::runnable(runControl->kit()).command.executable(),
{"-j0", QStringLiteral("-s%1").arg(m_channel.port())}});

View File

@@ -29,7 +29,7 @@ namespace Qdb::Internal {
static RunWorker *createQdbDeviceInferiorWorker(RunControl *runControl,
QmlDebugServicesPreset qmlServices)
{
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("QdbDeviceInferiorWorker");
worker->setStartModifier([worker, runControl, qmlServices] {
@@ -90,7 +90,7 @@ public:
QdbRunWorkerFactory()
{
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setStartModifier([worker] {
const CommandLine remoteCommand = worker->commandLine();
const FilePath remoteExe = remoteCommand.executable();

View File

@@ -91,7 +91,7 @@ public:
void setupHaskellRunSupport()
{
static HaskellRunConfigurationFactory runConfigFactory;
static SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}};
static ProcessRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}};
static SimpleDebugRunnerFactory debugWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}};
}

View File

@@ -84,7 +84,7 @@ McuSupportRunConfigurationFactory::McuSupportRunConfigurationFactory()
FlashRunWorkerFactory::FlashRunWorkerFactory()
{
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setStartModifier([worker, runControl] {
const Target *target = runControl->target();
worker->setCommandLine({cmakeFilePath(target),

View File

@@ -97,7 +97,7 @@ void setupMesonRunConfiguration()
void setupMesonRunAndDebugWorkers()
{
using namespace Debugger;
static SimpleTargetRunnerFactory theMesonRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
static ProcessRunnerFactory theMesonRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
static SimpleDebugRunnerFactory theMesonDebugRunWorkerFactory({Constants::MESON_RUNCONFIG_ID});
}

View File

@@ -49,11 +49,11 @@ public:
NimRunConfigurationFactory nimRunConfigFactory;
NimbleRunConfigurationFactory nimbleRunConfigFactory;
NimbleTestConfigurationFactory nimbleTestConfigFactory;
SimpleTargetRunnerFactory nimRunWorkerFactory{{nimRunConfigFactory.runConfigurationId()}};
SimpleTargetRunnerFactory nimbleRunWorkerFactory{{nimbleRunConfigFactory.runConfigurationId()}};
ProcessRunnerFactory nimRunWorkerFactory{{nimRunConfigFactory.runConfigurationId()}};
ProcessRunnerFactory nimbleRunWorkerFactory{{nimbleRunConfigFactory.runConfigurationId()}};
SimpleDebugRunnerFactory nimDebugWorkerFactory{{nimRunConfigFactory.runConfigurationId()}};
SimpleDebugRunnerFactory nimbleDebugWorkerFactory{{nimbleRunConfigFactory.runConfigurationId()}};
SimpleTargetRunnerFactory nimbleTestWorkerFactory{{nimbleTestConfigFactory.runConfigurationId()}};
ProcessRunnerFactory nimbleTestWorkerFactory{{nimbleTestConfigFactory.runConfigurationId()}};
NimbleBuildStepFactory nimbleBuildStepFactory;
NimbleTaskStepFactory nimbleTaskStepFactory;
NimCompilerBuildStepFactory buildStepFactory;

View File

@@ -75,7 +75,7 @@ CustomExecutableRunConfigurationFactory::CustomExecutableRunConfigurationFactory
CustomExecutableRunWorkerFactory::CustomExecutableRunWorkerFactory()
{
setProduct<SimpleTargetRunner>();
setProduct<ProcessRunner>();
addSupportedRunMode(Constants::NORMAL_RUN_MODE);
addSupportedRunConfig(Constants::CUSTOM_EXECUTABLE_RUNCONFIG_ID);
}

View File

@@ -3,7 +3,7 @@
#include "desktoprunconfiguration.h"
#include "buildsystem.h"
#include "deploymentdata.h"
#include "projectexplorerconstants.h"
#include "projectexplorertr.h"
#include "runconfigurationaspects.h"
@@ -237,7 +237,7 @@ void setupDesktopRunConfigurations()
void setupDesktopRunWorker()
{
static SimpleTargetRunnerFactory theDesktopRunWorkerFactory({
static ProcessRunnerFactory theDesktopRunWorkerFactory({
Constants::CMAKE_RUNCONFIG_ID,
Constants::QBS_RUNCONFIG_ID,
Constants::QMAKE_RUNCONFIG_ID

View File

@@ -1366,15 +1366,15 @@ void RunControlPrivate::debugMessage(const QString &msg) const
}
// SimpleTargetRunnerPrivate
// ProcessRunnerPrivate
namespace Internal {
class SimpleTargetRunnerPrivate : public QObject
class ProcessRunnerPrivate : public QObject
{
public:
explicit SimpleTargetRunnerPrivate(SimpleTargetRunner *parent);
~SimpleTargetRunnerPrivate() override;
explicit ProcessRunnerPrivate(ProcessRunner *parent);
~ProcessRunnerPrivate() override;
void start();
void stop();
@@ -1391,7 +1391,7 @@ public:
qint64 privateApplicationPID() const;
bool isRunning() const;
SimpleTargetRunner *q = nullptr;
ProcessRunner *q = nullptr;
bool m_runAsRoot = false;
@@ -1425,16 +1425,16 @@ static QProcess::ProcessChannelMode defaultProcessChannelMode()
? QProcess::MergedChannels : QProcess::SeparateChannels;
}
SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent)
ProcessRunnerPrivate::ProcessRunnerPrivate(ProcessRunner *parent)
: q(parent)
{
m_process.setProcessChannelMode(defaultProcessChannelMode());
connect(&m_process, &Process::started, this, &SimpleTargetRunnerPrivate::forwardStarted);
connect(&m_process, &Process::done, this, &SimpleTargetRunnerPrivate::handleDone);
connect(&m_process, &Process::started, this, &ProcessRunnerPrivate::forwardStarted);
connect(&m_process, &Process::done, this, &ProcessRunnerPrivate::handleDone);
connect(&m_process, &Process::readyReadStandardError,
this, &SimpleTargetRunnerPrivate::handleStandardError);
this, &ProcessRunnerPrivate::handleStandardError);
connect(&m_process, &Process::readyReadStandardOutput,
this, &SimpleTargetRunnerPrivate::handleStandardOutput);
this, &ProcessRunnerPrivate::handleStandardOutput);
connect(&m_process, &Process::requestingStop, this, [this] {
q->appendMessage(Tr::tr("Requesting process to stop ...."), NormalMessageFormat);
});
@@ -1471,13 +1471,13 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent)
}
}
SimpleTargetRunnerPrivate::~SimpleTargetRunnerPrivate()
ProcessRunnerPrivate::~ProcessRunnerPrivate()
{
if (m_state == Run)
forwardDone();
}
void SimpleTargetRunnerPrivate::stop()
void ProcessRunnerPrivate::stop()
{
if (m_stopRequested || m_state != Run)
return;
@@ -1489,12 +1489,12 @@ void SimpleTargetRunnerPrivate::stop()
m_process.stop();
}
bool SimpleTargetRunnerPrivate::isRunning() const
bool ProcessRunnerPrivate::isRunning() const
{
return m_process.state() != QProcess::NotRunning;
}
qint64 SimpleTargetRunnerPrivate::privateApplicationPID() const
qint64 ProcessRunnerPrivate::privateApplicationPID() const
{
if (!isRunning())
return 0;
@@ -1502,14 +1502,14 @@ qint64 SimpleTargetRunnerPrivate::privateApplicationPID() const
return m_process.processId();
}
void SimpleTargetRunnerPrivate::handleDone()
void ProcessRunnerPrivate::handleDone()
{
m_resultData = m_process.resultData();
QTC_CHECK(m_state == Run);
forwardDone();
}
void SimpleTargetRunnerPrivate::handleStandardOutput()
void ProcessRunnerPrivate::handleStandardOutput()
{
if (m_suppressDefaultStdOutHandling)
return;
@@ -1518,7 +1518,7 @@ void SimpleTargetRunnerPrivate::handleStandardOutput()
q->appendMessage(msg, StdOutFormat, false);
}
void SimpleTargetRunnerPrivate::handleStandardError()
void ProcessRunnerPrivate::handleStandardError()
{
if (m_suppressDefaultStdOutHandling)
return;
@@ -1527,7 +1527,7 @@ void SimpleTargetRunnerPrivate::handleStandardError()
q->appendMessage(msg, StdErrFormat, false);
}
void SimpleTargetRunnerPrivate::start()
void ProcessRunnerPrivate::start()
{
CommandLine cmdLine = m_command;
Environment env = m_environment;
@@ -1576,9 +1576,9 @@ void SimpleTargetRunnerPrivate::start()
}
/*!
\class ProjectExplorer::SimpleTargetRunner
\class ProjectExplorer::ProcessRunner
\brief The SimpleTargetRunner class is the application launcher of the
\brief The ProcessRunner class is the application launcher of the
ProjectExplorer plugin.
Encapsulates processes running in a console or as GUI processes,
@@ -1586,15 +1586,15 @@ void SimpleTargetRunnerPrivate::start()
\sa Utils::Process
*/
SimpleTargetRunner::SimpleTargetRunner(RunControl *runControl)
: RunWorker(runControl), d(new Internal::SimpleTargetRunnerPrivate(this))
ProcessRunner::ProcessRunner(RunControl *runControl)
: RunWorker(runControl), d(new Internal::ProcessRunnerPrivate(this))
{
setId("SimpleTargetRunner");
setId("ProcessRunner");
}
SimpleTargetRunner::~SimpleTargetRunner() = default;
ProcessRunner::~ProcessRunner() = default;
void SimpleTargetRunnerPrivate::forwardDone()
void ProcessRunnerPrivate::forwardDone()
{
if (m_stopReported)
return;
@@ -1615,7 +1615,7 @@ void SimpleTargetRunnerPrivate::forwardDone()
q->reportStopped();
}
void SimpleTargetRunnerPrivate::forwardStarted()
void ProcessRunnerPrivate::forwardStarted()
{
const bool isDesktop = m_command.executable().isLocal();
if (isDesktop) {
@@ -1628,7 +1628,7 @@ void SimpleTargetRunnerPrivate::forwardStarted()
q->reportStarted();
}
void SimpleTargetRunner::start()
void ProcessRunner::start()
{
d->m_command = runControl()->commandLine();
d->m_workingDirectory = runControl()->workingDirectory();
@@ -1673,53 +1673,53 @@ void SimpleTargetRunner::start()
d->start();
}
void SimpleTargetRunner::stop()
void ProcessRunner::stop()
{
d->m_stopForced = true;
d->stop();
}
void SimpleTargetRunner::setStartModifier(const std::function<void ()> &startModifier)
void ProcessRunner::setStartModifier(const std::function<void ()> &startModifier)
{
d->m_startModifier = startModifier;
}
CommandLine SimpleTargetRunner::commandLine() const
CommandLine ProcessRunner::commandLine() const
{
return d->m_command;
}
void SimpleTargetRunner::setCommandLine(const Utils::CommandLine &commandLine)
void ProcessRunner::setCommandLine(const Utils::CommandLine &commandLine)
{
d->m_command = commandLine;
}
void SimpleTargetRunner::setEnvironment(const Environment &environment)
void ProcessRunner::setEnvironment(const Environment &environment)
{
d->m_environment = environment;
}
void SimpleTargetRunner::setWorkingDirectory(const FilePath &workingDirectory)
void ProcessRunner::setWorkingDirectory(const FilePath &workingDirectory)
{
d->m_workingDirectory = workingDirectory;
}
void SimpleTargetRunner::setProcessMode(Utils::ProcessMode processMode)
void ProcessRunner::setProcessMode(Utils::ProcessMode processMode)
{
d->m_process.setProcessMode(processMode);
}
Process *SimpleTargetRunner::process() const
Process *ProcessRunner::process() const
{
return &d->m_process;
}
void SimpleTargetRunner::suppressDefaultStdOutHandling()
void ProcessRunner::suppressDefaultStdOutHandling()
{
d->m_suppressDefaultStdOutHandling = true;
}
void SimpleTargetRunner::forceRunOnHost()
void ProcessRunner::forceRunOnHost()
{
const FilePath executable = d->m_command.executable();
if (!executable.isLocal()) {
@@ -2031,11 +2031,11 @@ void addOutputParserFactory(const std::function<Utils::OutputLineParser *(Target
g_outputParserFactories.append(factory);
}
// SimpleTargetRunnerFactory
// ProcessRunnerFactory
SimpleTargetRunnerFactory::SimpleTargetRunnerFactory(const QList<Id> &runConfigs)
ProcessRunnerFactory::ProcessRunnerFactory(const QList<Id> &runConfigs)
{
setProduct<SimpleTargetRunner>();
setProduct<ProcessRunner>();
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
setSupportedRunConfigs(runConfigs);
}

View File

@@ -38,7 +38,7 @@ class Target;
namespace Internal {
class RunControlPrivate;
class RunWorkerPrivate;
class SimpleTargetRunnerPrivate;
class ProcessRunnerPrivate;
} // Internal
class PROJECTEXPLORER_EXPORT RunWorker : public QObject
@@ -277,17 +277,11 @@ private:
const std::unique_ptr<Internal::RunControlPrivate> d;
};
/**
* A simple TargetRunner for cases where a plain ApplicationLauncher is
* sufficient for running purposes.
*/
class PROJECTEXPLORER_EXPORT SimpleTargetRunner final : public RunWorker
class PROJECTEXPLORER_EXPORT ProcessRunner final : public RunWorker
{
public:
explicit SimpleTargetRunner(RunControl *runControl);
~SimpleTargetRunner() override;
explicit ProcessRunner(RunControl *runControl);
~ProcessRunner() override;
void setStartModifier(const std::function<void()> &startModifier);
@@ -309,13 +303,13 @@ private:
const Utils::ProcessRunData &runnable() const = delete;
void setRunnable(const Utils::ProcessRunData &) = delete;
const std::unique_ptr<Internal::SimpleTargetRunnerPrivate> d;
const std::unique_ptr<Internal::ProcessRunnerPrivate> d;
};
class PROJECTEXPLORER_EXPORT SimpleTargetRunnerFactory : public RunWorkerFactory
class PROJECTEXPLORER_EXPORT ProcessRunnerFactory : public RunWorkerFactory
{
public:
explicit SimpleTargetRunnerFactory(const QList<Utils::Id> &runConfig);
explicit ProcessRunnerFactory(const QList<Utils::Id> &runConfig);
};

View File

@@ -437,7 +437,7 @@ class WorkspaceProjectRunWorkerFactory : public RunWorkerFactory
public:
WorkspaceProjectRunWorkerFactory()
{
setProduct<SimpleTargetRunner>();
setProduct<ProcessRunner>();
addSupportedRunMode(Constants::NORMAL_RUN_MODE);
addSupportedRunConfig(WORKSPACE_PROJECT_RUNCONFIG_ID);
}

View File

@@ -178,7 +178,7 @@ void setupPythonRunConfiguration()
void setupPythonRunWorker()
{
static SimpleTargetRunnerFactory thePythonRunWorkerFactory(
static ProcessRunnerFactory thePythonRunWorkerFactory(
{Constants::C_PYTHONRUNCONFIGURATION_ID}
);
}

View File

@@ -178,7 +178,7 @@ LocalQmlPreviewSupportFactory::LocalQmlPreviewSupportFactory()
{
setId(ProjectExplorer::Constants::QML_PREVIEW_RUN_FACTORY);
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("LocalQmlPreviewSupport");
runControl->setQmlChannel(Utils::urlFromLocalSocket());

View File

@@ -144,7 +144,7 @@ void QmlProfilerRunner::profilerStateChanged()
RunWorker *createLocalQmlProfilerWorker(RunControl *runControl)
{
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("LocalQmlProfilerSupport");

View File

@@ -272,7 +272,7 @@ private:
void extensionsInitialized() final
{
// These rely on the base tool factories being present:
static SimpleTargetRunnerFactory runWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
static ProcessRunnerFactory runWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
static SimpleQmlProfilerRunnerFactory qmlProfilerRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
static SimpleDebugRunnerFactory debugRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
static SimplePreviewRunnerFactory previewRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};

View File

@@ -21,7 +21,7 @@ public:
QnxQmlProfilerWorkerFactory()
{
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("QnxQmlProfilerSupport");
worker->appendMessage(Tr::tr("Preparing remote side..."), LogMessageFormat);

View File

@@ -136,7 +136,7 @@ void showAttachToProcessDialog()
debugger->setupPortsGatherer();
debugger->setUseCtrlCStub(true);
if (debugger->isCppDebugging()) {
auto pdebugRunner = new SimpleTargetRunner(runControl);
auto pdebugRunner = new ProcessRunner(runControl);
pdebugRunner->setId("PDebugRunner");
pdebugRunner->setStartModifier([pdebugRunner, debugger] {
const int pdebugPort = debugger->debugChannel().port();
@@ -175,7 +175,7 @@ public:
debugger->setupPortsGatherer();
auto debuggeeRunner = new SimpleTargetRunner(runControl);
auto debuggeeRunner = new ProcessRunner(runControl);
debuggeeRunner->setId("QnxDebuggeeRunner");
debuggeeRunner->setStartModifier([debuggeeRunner] {

View File

@@ -95,7 +95,7 @@ public:
void setupQnxRunnning()
{
static QnxRunConfigurationFactory theQnxRunConfigurationFactory;
static SimpleTargetRunnerFactory theQnxRunWorkerFactory({Constants::QNX_RUNCONFIG_ID});
static ProcessRunnerFactory theQnxRunWorkerFactory({Constants::QNX_RUNCONFIG_ID});
}
} // Qnx::Internal

View File

@@ -43,7 +43,7 @@ namespace AppManager::Internal {
static RunWorker *createInferiorRunner(RunControl *runControl, QmlDebugServicesPreset qmlServices)
{
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId(AppManager::Constants::DEBUG_LAUNCHER_ID);
worker->setEssential(true);
@@ -193,7 +193,7 @@ public:
AppManagerRunWorkerFactory()
{
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("ApplicationManagerPlugin.Run.TargetRunner");
QObject::connect(worker, &RunWorker::stopped, worker, [worker, runControl] {
worker->appendMessage(

View File

@@ -32,7 +32,7 @@ class RemoteLinuxRunWorkerFactory final : public RunWorkerFactory
public:
RemoteLinuxRunWorkerFactory()
{
setProduct<SimpleTargetRunner>();
setProduct<ProcessRunner>();
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
addSupportedDeviceType(Constants::GenericLinuxOsType);
setSupportedRunConfigs(supportedRunConfigs());
@@ -76,7 +76,7 @@ public:
setProducer([](RunControl *runControl) {
runControl->requestQmlChannel();
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
worker->setId("RemoteLinuxQmlToolingSupport");
auto runworker = runControl->createWorker(runnerIdForRunMode(runControl->runMode()));

View File

@@ -216,7 +216,7 @@ public:
EmrunRunWorkerFactory()
{
setProducer([](RunControl *runControl) {
auto worker = new SimpleTargetRunner(runControl);
auto worker = new ProcessRunner(runControl);
runControl->requestWorkerChannel();
worker->setStartModifier([worker, runControl] {