aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/haskell/haskellproject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/haskell/haskellproject.cpp')
-rw-r--r--src/plugins/haskell/haskellproject.cpp59
1 files changed, 41 insertions, 18 deletions
diff --git a/src/plugins/haskell/haskellproject.cpp b/src/plugins/haskell/haskellproject.cpp
index f19840a67f5..01d652c49ef 100644
--- a/src/plugins/haskell/haskellproject.cpp
+++ b/src/plugins/haskell/haskellproject.cpp
@@ -5,14 +5,16 @@
#include "haskellconstants.h"
-#include <coreplugin/iversioncontrol.h>
-#include <coreplugin/vcsmanager.h>
-
+#include <projectexplorer/buildsystem.h>
#include <projectexplorer/buildtargetinfo.h>
+#include <projectexplorer/project.h>
+#include <projectexplorer/projectmanager.h>
+#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
+#include <projectexplorer/treescanner.h>
#include <utils/algorithm.h>
-#include <utils/fileutils.h>
+#include <utils/filepath.h>
#include <utils/qtcassert.h>
#include <QFile>
@@ -21,8 +23,7 @@
using namespace ProjectExplorer;
using namespace Utils;
-namespace Haskell {
-namespace Internal {
+namespace Haskell::Internal {
static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
{
@@ -42,18 +43,23 @@ static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
return result;
}
-HaskellProject::HaskellProject(const Utils::FilePath &fileName)
- : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName)
+class HaskellBuildSystem final : public BuildSystem
{
- setId(Constants::C_HASKELL_PROJECT_ID);
- setDisplayName(fileName.toFileInfo().completeBaseName());
- setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); });
-}
+public:
+ HaskellBuildSystem(Target *t);
-bool HaskellProject::isHaskellProject(Project *project)
-{
- return project && project->id() == Constants::C_HASKELL_PROJECT_ID;
-}
+ void triggerParsing() final;
+
+ QString name() const final { return QLatin1String("haskell"); }
+
+private:
+ void updateApplicationTargets();
+ void refresh();
+
+private:
+ ParseGuard m_parseGuard;
+ TreeScanner m_scanner;
+};
HaskellBuildSystem::HaskellBuildSystem(Target *t)
: BuildSystem(t)
@@ -108,5 +114,22 @@ void HaskellBuildSystem::updateApplicationTargets()
target()->updateDefaultRunConfigurations();
}
-} // namespace Internal
-} // namespace Haskell
+class HaskellProject final : public Project
+{
+public:
+ explicit HaskellProject(const FilePath &fileName)
+ : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName)
+ {
+ setId(Constants::C_HASKELL_PROJECT_ID);
+ setDisplayName(fileName.toFileInfo().completeBaseName());
+ setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); });
+ }
+};
+
+void setupHaskellProject()
+{
+ ProjectManager::registerProjectType<HaskellProject>(
+ Constants::C_HASKELL_PROJECT_MIMETYPE);
+}
+
+} // Haskell::Internal