summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2019-11-05 07:19:45 +0100
committerChristian Stenger <christian.stenger@qt.io>2019-11-05 07:23:06 +0000
commitdeeed3dcd2c9b9abc9997c65cf4d664ece233c2e (patch)
treee82f843f4651b4198a22fd6fa90d93b7c0347c47
parentc75c4b2d0ea37e2902ffcc4742c329d679633974 (diff)
downloadqt-creator-deeed3dcd2c9b9abc9997c65cf4d664ece233c2e.tar.gz
Nim: Fix compile
Change-Id: I19753d929dc2ed9594f4d5f0e4daba18b12b868f Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/nim/project/nimblebuildstep.cpp4
-rw-r--r--src/plugins/nim/project/nimblebuildsystem.cpp29
-rw-r--r--src/plugins/nim/project/nimblebuildsystem.h2
-rw-r--r--src/plugins/nim/project/nimbleproject.cpp8
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);
}