forked from qt-creator/qt-creator
Haskell: Move haskell project setup closer to new setup pattern
Change-Id: I3c6e6ad1a6f4b0a8d0a5598ad970c7539d1643e3 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -17,8 +17,6 @@
|
|||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
|
||||||
#include <projectexplorer/projectmanager.h>
|
|
||||||
#include <projectexplorer/runcontrol.h>
|
|
||||||
|
|
||||||
#include <texteditor/snippets/snippetprovider.h>
|
#include <texteditor/snippets/snippetprovider.h>
|
||||||
|
|
||||||
@@ -51,8 +49,8 @@ public:
|
|||||||
|
|
||||||
setupHaskellEditor();
|
setupHaskellEditor();
|
||||||
|
|
||||||
ProjectExplorer::ProjectManager::registerProjectType<HaskellProject>(
|
setupHaskellProject();
|
||||||
Constants::C_HASKELL_PROJECT_MIMETYPE);
|
|
||||||
TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID,
|
TextEditor::SnippetProvider::registerGroup(Constants::C_HASKELLSNIPPETSGROUP_ID,
|
||||||
Tr::tr("Haskell", "SnippetProvider"));
|
Tr::tr("Haskell", "SnippetProvider"));
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,16 @@
|
|||||||
|
|
||||||
#include "haskellconstants.h"
|
#include "haskellconstants.h"
|
||||||
|
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <projectexplorer/buildsystem.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
|
||||||
|
|
||||||
#include <projectexplorer/buildtargetinfo.h>
|
#include <projectexplorer/buildtargetinfo.h>
|
||||||
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectmanager.h>
|
||||||
|
#include <projectexplorer/projectnodes.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
#include <projectexplorer/treescanner.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/filepath.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@@ -21,8 +23,7 @@
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Haskell {
|
namespace Haskell::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
|
static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
|
||||||
{
|
{
|
||||||
@@ -42,18 +43,23 @@ static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HaskellProject::HaskellProject(const Utils::FilePath &fileName)
|
class HaskellBuildSystem final : public BuildSystem
|
||||||
: Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName)
|
|
||||||
{
|
{
|
||||||
setId(Constants::C_HASKELL_PROJECT_ID);
|
public:
|
||||||
setDisplayName(fileName.toFileInfo().completeBaseName());
|
HaskellBuildSystem(Target *t);
|
||||||
setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); });
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HaskellProject::isHaskellProject(Project *project)
|
void triggerParsing() final;
|
||||||
{
|
|
||||||
return project && project->id() == Constants::C_HASKELL_PROJECT_ID;
|
QString name() const final { return QLatin1String("haskell"); }
|
||||||
}
|
|
||||||
|
private:
|
||||||
|
void updateApplicationTargets();
|
||||||
|
void refresh();
|
||||||
|
|
||||||
|
private:
|
||||||
|
ParseGuard m_parseGuard;
|
||||||
|
TreeScanner m_scanner;
|
||||||
|
};
|
||||||
|
|
||||||
HaskellBuildSystem::HaskellBuildSystem(Target *t)
|
HaskellBuildSystem::HaskellBuildSystem(Target *t)
|
||||||
: BuildSystem(t)
|
: BuildSystem(t)
|
||||||
@@ -108,5 +114,22 @@ void HaskellBuildSystem::updateApplicationTargets()
|
|||||||
target()->updateDefaultRunConfigurations();
|
target()->updateDefaultRunConfigurations();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
class HaskellProject final : public Project
|
||||||
} // namespace Haskell
|
{
|
||||||
|
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
|
||||||
|
|||||||
@@ -3,42 +3,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/buildsystem.h>
|
namespace Haskell::Internal {
|
||||||
#include <projectexplorer/project.h>
|
|
||||||
#include <projectexplorer/projectnodes.h>
|
|
||||||
#include <projectexplorer/treescanner.h>
|
|
||||||
|
|
||||||
namespace Haskell {
|
void setupHaskellProject();
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class HaskellProject : public ProjectExplorer::Project
|
} // Haskell::Internal
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit HaskellProject(const Utils::FilePath &fileName);
|
|
||||||
|
|
||||||
static bool isHaskellProject(Project *project);
|
|
||||||
};
|
|
||||||
|
|
||||||
class HaskellBuildSystem : public ProjectExplorer::BuildSystem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
HaskellBuildSystem(ProjectExplorer::Target *t);
|
|
||||||
|
|
||||||
void triggerParsing() override;
|
|
||||||
QString name() const final { return QLatin1String("haskell"); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateApplicationTargets();
|
|
||||||
void refresh();
|
|
||||||
|
|
||||||
private:
|
|
||||||
ParseGuard m_parseGuard;
|
|
||||||
ProjectExplorer::TreeScanner m_scanner;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Haskell
|
|
||||||
|
|||||||
Reference in New Issue
Block a user