diff --git a/src/plugins/python/pythonplugin.cpp b/src/plugins/python/pythonplugin.cpp index db914afc083..8410d31f9fb 100644 --- a/src/plugins/python/pythonplugin.cpp +++ b/src/plugins/python/pythonplugin.cpp @@ -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() diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 3c8c600b0aa..d01f4bc9bb7 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -16,13 +16,17 @@ #include #include +#include + #include #include #include #include #include +#include #include +#include #include #include @@ -183,10 +187,34 @@ public: // Factories -PythonRunConfigurationFactory::PythonRunConfigurationFactory() +class PythonRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory { - registerRunConfiguration(Constants::C_PYTHONRUNCONFIGURATION_ID); - addSupportedProjectType(PythonProjectId); +public: + PythonRunConfigurationFactory() + { + registerRunConfiguration(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() diff --git a/src/plugins/python/pythonrunconfiguration.h b/src/plugins/python/pythonrunconfiguration.h index db5fe71cc03..a2ccaeffc51 100644 --- a/src/plugins/python/pythonrunconfiguration.h +++ b/src/plugins/python/pythonrunconfiguration.h @@ -3,20 +3,11 @@ #pragma once -#include -#include -#include - namespace Python::Internal { -class PySideUicExtraCompiler; - -class PythonRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory -{ -public: - PythonRunConfigurationFactory(); -}; - +void setupPythonRunConfiguration(); +void setupPythonRunWorker(); +void setupPythonDebugWorker(); void setupPythonOutputParser(); } // Python::Internal