Nim: Fix compile

Change-Id: I19753d929dc2ed9594f4d5f0e4daba18b12b868f
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2019-11-05 07:19:45 +01:00
parent c75c4b2d0e
commit deeed3dcd2
4 changed files with 18 additions and 25 deletions

View File

@@ -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());