Nim: Hide NimBuildSystem definition in .cpp

Change-Id: Ib6fe898ccb0c58725c336819e4a02a441a304c3a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-07-19 14:50:13 +02:00
parent 750e9c3b6b
commit a9ee4ed5e8
3 changed files with 30 additions and 27 deletions

View File

@@ -139,6 +139,29 @@ bool NimProjectScanner::renameFile(const QString &, const QString &to)
return true;
}
// NimBuildSystem
class NimBuildSystem final : public BuildSystem
{
public:
explicit NimBuildSystem(Target *target);
bool supportsAction(Node *, ProjectAction action, const Node *node) const final;
bool addFiles(Node *node, const FilePaths &filePaths, FilePaths *) final;
RemovedFilesFromProject removeFiles(Node *node,
const FilePaths &filePaths,
FilePaths *) final;
bool deleteFiles(Node *, const FilePaths &) final;
bool renameFile(Node *, const FilePath &oldFilePath, const FilePath &newFilePath) final;
QString name() const final { return QLatin1String("nim"); }
void triggerParsing() final;
protected:
ParseGuard m_guard;
NimProjectScanner m_projectScanner;
};
NimBuildSystem::NimBuildSystem(Target *target)
: BuildSystem(target), m_projectScanner(target->project())
{
@@ -219,4 +242,9 @@ bool NimBuildSystem::renameFile(Node *, const FilePath &oldFilePath, const FileP
return m_projectScanner.renameFile(oldFilePath.toString(), newFilePath.toString());
}
BuildSystem *createNimBuildSystem(Target *target)
{
return new NimBuildSystem(target);
}
} // namespace Nim

View File

@@ -47,31 +47,6 @@ private:
Utils::FileSystemWatcher m_directoryWatcher;
};
class NimBuildSystem final : public ProjectExplorer::BuildSystem
{
Q_OBJECT
public:
explicit NimBuildSystem(ProjectExplorer::Target *target);
bool supportsAction(ProjectExplorer::Node *,
ProjectExplorer::ProjectAction action,
const ProjectExplorer::Node *node) const final;
bool addFiles(ProjectExplorer::Node *node,
const Utils::FilePaths &filePaths, Utils::FilePaths *) final;
ProjectExplorer::RemovedFilesFromProject removeFiles(ProjectExplorer::Node *node,
const Utils::FilePaths &filePaths,
Utils::FilePaths *) override;
bool deleteFiles(ProjectExplorer::Node *, const Utils::FilePaths &) final;
bool renameFile(ProjectExplorer::Node *,
const Utils::FilePath &oldFilePath, const Utils::FilePath &newFilePath) final;
QString name() const final { return QLatin1String("nim"); }
void triggerParsing() override;
protected:
ParseGuard m_guard;
NimProjectScanner m_projectScanner;
};
ProjectExplorer::BuildSystem *createNimBuildSystem(ProjectExplorer::Target *target);
} // namespace Nim

View File

@@ -46,7 +46,7 @@ NimProject::NimProject(const FilePath &filePath) : Project(Constants::C_NIM_MIME
// ensure debugging is enabled (Nim plugin translates nim code to C code)
setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
setBuildSystemCreator<NimBuildSystem>();
setBuildSystemCreator(&createNimBuildSystem);
}
Tasks NimProject::projectIssues(const Kit *k) const