forked from qt-creator/qt-creator
Nim: workaround to project parsing loops
Nimble creates temporaries files when querying the task list for the project files. For this reason we simply exclude requesting a project reparse when the root directory changes Change-Id: I6f1af3f073b056ecb2a7273fcb3df0cb44a1b53b Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -109,11 +109,6 @@ static NimbleMetadata parseMetadata(const QString &nimblePath, const QString &wo
|
|||||||
NimbleBuildSystem::NimbleBuildSystem(Target *target)
|
NimbleBuildSystem::NimbleBuildSystem(Target *target)
|
||||||
: BuildSystem(target), m_projectScanner(target->project())
|
: BuildSystem(target), m_projectScanner(target->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_projectScanner.watchProjectFilePath();
|
m_projectScanner.watchProjectFilePath();
|
||||||
|
|
||||||
connect(&m_projectScanner, &NimProjectScanner::fileChanged, this, [this](const QString &path) {
|
connect(&m_projectScanner, &NimProjectScanner::fileChanged, this, [this](const QString &path) {
|
||||||
@@ -126,8 +121,11 @@ NimbleBuildSystem::NimbleBuildSystem(Target *target)
|
|||||||
|
|
||||||
connect(&m_projectScanner, &NimProjectScanner::finished, this, &NimbleBuildSystem::updateProject);
|
connect(&m_projectScanner, &NimProjectScanner::finished, this, &NimbleBuildSystem::updateProject);
|
||||||
|
|
||||||
connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] {
|
connect(&m_projectScanner, &NimProjectScanner::directoryChanged, this, [this] (const QString &directory){
|
||||||
if (!isWaitingForParse())
|
// Workaround for nimble creating temporary files in project root directory
|
||||||
|
// when querying the list of tasks.
|
||||||
|
// See https://github.com/nim-lang/nimble/issues/720
|
||||||
|
if (directory != projectDirectory().toString())
|
||||||
requestDelayedParse();
|
requestDelayedParse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -53,7 +53,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished();
|
||||||
void requestReparse();
|
void requestReparse();
|
||||||
void directoryChanged();
|
void directoryChanged(const QString &path);
|
||||||
void fileChanged(const QString &path);
|
void fileChanged(const QString &path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user