Python: Use setup functions for run related items

Change-Id: Iefbeda433b0f7eaaf3c429dbc853e0c8578ceb3a
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2024-02-01 14:50:06 +01:00
parent f94ff4e524
commit 2288637668
3 changed files with 37 additions and 18 deletions

View File

@@ -43,9 +43,6 @@ QObject *pluginInstance()
class PythonPluginPrivate
{
public:
PythonRunConfigurationFactory runConfigFactory;
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
SimpleDebugRunnerFactory debugRunWorkerFactory{{runConfigFactory.runConfigurationId()}, {ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE}};
PythonSettings settings;
PythonWizardPageFactory pythonWizardPageFactory;
};
@@ -77,6 +74,9 @@ private:
setupPySideBuildStep();
setupPythonBuildConfiguration();
setupPythonRunConfiguration();
setupPythonRunWorker();
setupPythonDebugWorker();
setupPythonOutputParser();
KitManager::setIrrelevantAspects(KitManager::irrelevantAspects()

View File

@@ -16,13 +16,17 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <debugger/debuggerruncontrol.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
@@ -183,10 +187,34 @@ public:
// Factories
PythonRunConfigurationFactory::PythonRunConfigurationFactory()
class PythonRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
{
registerRunConfiguration<PythonRunConfiguration>(Constants::C_PYTHONRUNCONFIGURATION_ID);
addSupportedProjectType(PythonProjectId);
public:
PythonRunConfigurationFactory()
{
registerRunConfiguration<PythonRunConfiguration>(Constants::C_PYTHONRUNCONFIGURATION_ID);
addSupportedProjectType(PythonProjectId);
}
};
void setupPythonRunConfiguration()
{
static PythonRunConfigurationFactory thePythonRunConfigurationFactory;
}
void setupPythonRunWorker()
{
static SimpleTargetRunnerFactory thePythonRunWorkerFactory(
{Constants::C_PYTHONRUNCONFIGURATION_ID}
);
}
void setupPythonDebugWorker()
{
static Debugger::SimpleDebugRunnerFactory thePythonDebugRunWorkerFactory(
{Constants::C_PYTHONRUNCONFIGURATION_ID},
{ProjectExplorer::Constants::DAP_PY_DEBUG_RUN_MODE}
);
}
void setupPythonOutputParser()

View File

@@ -3,20 +3,11 @@
#pragma once
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
namespace Python::Internal {
class PySideUicExtraCompiler;
class PythonRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
{
public:
PythonRunConfigurationFactory();
};
void setupPythonRunConfiguration();
void setupPythonRunWorker();
void setupPythonDebugWorker();
void setupPythonOutputParser();
} // Python::Internal