Haskell: Use new setup for run related classes

Change-Id: I9c6324aea586838d83bf81098499627c8c6c6d4a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2023-11-20 13:05:52 +01:00
parent cc711d7903
commit e6b052e040
3 changed files with 22 additions and 27 deletions

View File

@@ -26,13 +26,6 @@
namespace Haskell::Internal {
class HaskellPluginPrivate
{
public:
HaskellRunConfigurationFactory runConfigFactory;
ProjectExplorer::SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}};
};
static void registerGhciAction(QObject *guard)
{
QAction *action = new QAction(Tr::tr("Run GHCi"), guard);
@@ -49,15 +42,13 @@ class HaskellPlugin final : public ExtensionSystem::IPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Haskell.json")
public:
~HaskellPlugin() final { delete d; }
private:
void initialize() final
{
d = new HaskellPluginPrivate;
setupHaskellStackBuildStep();
setupHaskellBuildConfiguration();
setupHaskellRunSupport();
setupHaskellEditor();
ProjectExplorer::ProjectManager::registerProjectType<HaskellProject>(
@@ -69,8 +60,6 @@ private:
ProjectExplorer::JsonWizardFactory::addWizardPath(":/haskell/share/wizards/");
}
HaskellPluginPrivate *d = nullptr;
};
} // Haskell::Internal

View File

@@ -11,7 +11,9 @@
#include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
#include <utils/processinterface.h>
@@ -21,7 +23,7 @@ using namespace Utils;
namespace Haskell::Internal {
class HaskellRunConfiguration : public RunConfiguration
class HaskellRunConfiguration final : public RunConfiguration
{
public:
HaskellRunConfiguration(Target *target, Id id)
@@ -46,7 +48,7 @@ public:
}
private:
Utils::ProcessRunData runnable() const final
ProcessRunData runnable() const final
{
const FilePath projectDirectory = project()->projectDirectory();
ProcessRunData r;
@@ -75,11 +77,21 @@ private:
// Factory
HaskellRunConfigurationFactory::HaskellRunConfigurationFactory()
class HaskellRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
{
public:
HaskellRunConfigurationFactory()
{
registerRunConfiguration<HaskellRunConfiguration>(Constants::C_HASKELL_RUNCONFIG_ID);
addSupportedProjectType(Constants::C_HASKELL_PROJECT_ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
}
};
void setupHaskellRunSupport()
{
static HaskellRunConfigurationFactory runConfigFactory;
static SimpleTargetRunnerFactory runWorkerFactory{{Constants::C_HASKELL_RUNCONFIG_ID}};
}
} // Haskell::Internal

View File

@@ -3,14 +3,8 @@
#pragma once
#include <projectexplorer/runconfiguration.h>
namespace Haskell::Internal {
class HaskellRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
{
public:
HaskellRunConfigurationFactory();
};
void setupHaskellRunSupport();
} // Haskell::Internal