CMakePM: Only set cmake reply fileWatcher after CMake has run

This avoids the case when CMake would trigger the file watcher when
generating totally different json files.

For example switching branches and doing a build on a big project, like
Qt Creator for example.

The filewatcher would be triggered and the UI would freeze for quite a
while.

Task-number: QTCREATORBUG-29416
Change-Id: I6ff47d8c2553f7718e82d92daae99036f37aca7d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Cristian Adam
2023-08-18 17:24:09 +02:00
parent 5f8fdc4e9e
commit 6a30ebd01e
3 changed files with 9 additions and 7 deletions

View File

@@ -59,7 +59,7 @@ void FileApiReader::setParameters(const BuildDirParameters &p)
// Reset watcher:
m_watcher.clear();
FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory, m_watcher);
FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory);
resetData();
}
@@ -361,7 +361,10 @@ void FileApiReader::cmakeFinishedState(int exitCode)
if (m_lastCMakeExitCode != 0)
makeBackupConfiguration(false);
FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory, m_watcher);
FileApiParser::setupCMakeFileApi(m_parameters.buildDirectory);
m_watcher.addDirectory(FileApiParser::cmakeReplyDirectory(m_parameters.buildDirectory).path(),
FileSystemWatcher::WatchAllChanges);
endState(FileApiParser::scanForCMakeReplyFile(m_parameters.buildDirectory),
m_lastCMakeExitCode != 0);