From a9ee4ed5e83cfb383c0a44ca0e4bb20aff7aff9a Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 19 Jul 2024 14:50:13 +0200 Subject: Nim: Hide NimBuildSystem definition in .cpp Change-Id: Ib6fe898ccb0c58725c336819e4a02a441a304c3a Reviewed-by: Jarek Kobus --- src/plugins/nim/project/nimbuildsystem.cpp | 28 ++++++++++++++++++++++++++++ src/plugins/nim/project/nimbuildsystem.h | 27 +-------------------------- src/plugins/nim/project/nimproject.cpp | 2 +- 3 files changed, 30 insertions(+), 27 deletions(-) (limited to 'src/plugins/nim') diff --git a/src/plugins/nim/project/nimbuildsystem.cpp b/src/plugins/nim/project/nimbuildsystem.cpp index 373a263ba27..39acc8635d0 100644 --- a/src/plugins/nim/project/nimbuildsystem.cpp +++ b/src/plugins/nim/project/nimbuildsystem.cpp @@ -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 diff --git a/src/plugins/nim/project/nimbuildsystem.h b/src/plugins/nim/project/nimbuildsystem.h index f38d067bcd6..8eefbee50f2 100644 --- a/src/plugins/nim/project/nimbuildsystem.h +++ b/src/plugins/nim/project/nimbuildsystem.h @@ -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 diff --git a/src/plugins/nim/project/nimproject.cpp b/src/plugins/nim/project/nimproject.cpp index 4c97393dc74..33f09d19328 100644 --- a/src/plugins/nim/project/nimproject.cpp +++ b/src/plugins/nim/project/nimproject.cpp @@ -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(); + setBuildSystemCreator(&createNimBuildSystem); } Tasks NimProject::projectIssues(const Kit *k) const -- cgit v1.2.3