CMakePM: Clear and setup file watcher before and after backup configuration

Qt Creator 4.15 will do a backup of the CMake file-api, but the file watcher
that triggers a reparsing was not cleared up before the backup.

This could lead to unnecesary file-api rescans.

Task-number: QTCREATORBUG-25783
Change-Id: Id91379ea85c8a91e03d952c5c66b0371ebff943f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Cristian Adam
2021-06-08 10:27:53 +02:00
parent f087e70e80
commit 1b3a4e1fc6

View File

@@ -371,6 +371,10 @@ void FileApiReader::startCMakeState(const QStringList &configurationArguments)
connect(m_cmakeProcess.get(), &CMakeProcess::finished, this, &FileApiReader::cmakeFinishedState); connect(m_cmakeProcess.get(), &CMakeProcess::finished, this, &FileApiReader::cmakeFinishedState);
qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments; qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments;
// Reset watcher:
m_watcher.removeFiles(m_watcher.files());
m_watcher.removeDirectories(m_watcher.directories());
makeBackupConfiguration(true); makeBackupConfiguration(true);
writeConfigurationIntoBuildDirectory(configurationArguments); writeConfigurationIntoBuildDirectory(configurationArguments);
m_cmakeProcess->run(m_parameters, configurationArguments); m_cmakeProcess->run(m_parameters, configurationArguments);
@@ -389,6 +393,8 @@ void FileApiReader::cmakeFinishedState(int code, QProcess::ExitStatus status)
if (m_lastCMakeExitCode != 0) if (m_lastCMakeExitCode != 0)
makeBackupConfiguration(false); makeBackupConfiguration(false);
FileApiParser::setupCMakeFileApi(m_parameters.workDirectory, m_watcher);
endState(FileApiParser::scanForCMakeReplyFile(m_parameters.workDirectory)); endState(FileApiParser::scanForCMakeReplyFile(m_parameters.workDirectory));
} }