diff options
-rw-r--r-- | src/plugins/nim/project/nimblebuildstep.cpp | 4 | ||||
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.cpp | 29 | ||||
-rw-r--r-- | src/plugins/nim/project/nimblebuildsystem.h | 2 | ||||
-rw-r--r-- | src/plugins/nim/project/nimbleproject.cpp | 8 |
4 files changed, 18 insertions, 25 deletions
diff --git a/src/plugins/nim/project/nimblebuildstep.cpp b/src/plugins/nim/project/nimblebuildstep.cpp index 940c3e91eb..33b686bd4b 100644 --- a/src/plugins/nim/project/nimblebuildstep.cpp +++ b/src/plugins/nim/project/nimblebuildstep.cpp @@ -164,12 +164,12 @@ QString NimbleBuildStep::defaultArguments() const QTC_ASSERT(buildConfiguration(), return {}; ); switch (buildConfiguration()->buildType()) { case ProjectExplorer::BuildConfiguration::Debug: - return "--debugger:native"; + return {"--debugger:native"}; case ProjectExplorer::BuildConfiguration::Unknown: case ProjectExplorer::BuildConfiguration::Profile: case ProjectExplorer::BuildConfiguration::Release: default: - return ""; + return {}; } } diff --git a/src/plugins/nim/project/nimblebuildsystem.cpp b/src/plugins/nim/project/nimblebuildsystem.cpp index c8d0e81d9a..d968b50391 100644 --- a/src/plugins/nim/project/nimblebuildsystem.cpp +++ b/src/plugins/nim/project/nimblebuildsystem.cpp @@ -105,6 +105,19 @@ NimbleMetadata parseMetadata(const QString &nimblePath, const QString &workingDi NimbleBuildSystem::NimbleBuildSystem(Project *project) : NimBuildSystem(project) { + // Not called in parseProject due to nimble behavior to create temporary + // files in project directory. This creation in turn stimulate the fs watcher + // that in turn causes project parsing (thus a loop if invoke in parseProject). + // For this reason we call this function manually during project creation + // See https://github.com/nim-lang/nimble/issues/720 + m_directoryWatcher.addFile(this->project()->projectFilePath().toString(), + FileSystemWatcher::WatchModifiedDate); + connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) { + if (path == this->project()->projectFilePath().toString()) { + updateProject(); + } + }); + updateProject(); } void NimbleBuildSystem::parseProject(BuildSystem::ParsingContext &&ctx) @@ -118,22 +131,6 @@ void NimbleBuildSystem::updateProject() updateProjectTasks(); } -void NimbleBuildSystem::init() -{ - // Not called in parseProject due to nimble behavior to create temporary - // files in project directory. This creation in turn stimulate the fs watcher - // that in turn causes project parsing (thus a loop if invoke in parseProject). - // For this reason we call this function manually during project creation - // See https://github.com/nim-lang/nimble/issues/720 - m_directoryWatcher.addFile(project()->projectFilePath().toString(), FileSystemWatcher::WatchModifiedDate); - connect(&m_directoryWatcher, &FileSystemWatcher::fileChanged, this, [this](const QString &path) { - if (path == project()->projectFilePath().toString()) { - updateProject(); - } - }); - updateProject(); -} - void NimbleBuildSystem::updateProjectTasks() { auto prj = dynamic_cast<NimbleProject*>(project()); diff --git a/src/plugins/nim/project/nimblebuildsystem.h b/src/plugins/nim/project/nimblebuildsystem.h index 4ffd9185e7..45c540598e 100644 --- a/src/plugins/nim/project/nimblebuildsystem.h +++ b/src/plugins/nim/project/nimblebuildsystem.h @@ -36,8 +36,6 @@ class NimbleBuildSystem : public NimBuildSystem public: NimbleBuildSystem(ProjectExplorer::Project *project); - void init(); - protected: void parseProject(ParsingContext &&ctx) override; diff --git a/src/plugins/nim/project/nimbleproject.cpp b/src/plugins/nim/project/nimbleproject.cpp index 067c647e97..9003e55a93 100644 --- a/src/plugins/nim/project/nimbleproject.cpp +++ b/src/plugins/nim/project/nimbleproject.cpp @@ -41,9 +41,7 @@ NimbleProject::NimbleProject(const Utils::FilePath &fileName) setDisplayName(fileName.toFileInfo().completeBaseName()); // ensure debugging is enabled (Nim plugin translates nim code to C code) setProjectLanguages(Core::Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID)); - auto bs = std::make_unique<NimbleBuildSystem>(this); - bs->init(); - setBuildSystem(std::move(bs)); + setBuildSystemCreator([] (Project *p) { return new NimbleBuildSystem(p); }); } std::vector<NimbleTask> NimbleProject::tasks() const @@ -103,10 +101,10 @@ QStringList NimbleProject::toStringList(const std::vector<NimbleTask> &tasks) std::tuple<Project::RestoreResult, std::vector<NimbleTask>> NimbleProject::fromStringList(const QStringList &list) { if (list.size() % 2 != 0) - return {Project::RestoreResult::Error, {}}; + return std::make_tuple(Project::RestoreResult::Error, std::vector<NimbleTask>()); std::vector<NimbleTask> result; for (int i = 0; i < list.size(); i += 2) result.push_back({list[i], list[i + 1]}); - return {Project::RestoreResult::Ok, std::move(result)}; + return std::make_tuple(Project::RestoreResult::Ok, result); } |