forked from qt-creator/qt-creator
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:
@@ -35,7 +35,7 @@ const QStringList CMAKE_QUERY_FILENAMES = {"cache-v2", "codemodel-v2", "cmakeFil
|
||||
// Helper:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
static FilePath cmakeReplyDirectory(const FilePath &buildDirectory)
|
||||
FilePath FileApiParser::cmakeReplyDirectory(const FilePath &buildDirectory)
|
||||
{
|
||||
return buildDirectory.pathAppended(CMAKE_RELATIVE_REPLY_PATH);
|
||||
}
|
||||
@@ -795,7 +795,7 @@ FilePath FileApiDetails::ReplyFileContents::jsonFile(const QString &kind, const
|
||||
// FileApi:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
bool FileApiParser::setupCMakeFileApi(const FilePath &buildDirectory, Utils::FileSystemWatcher &watcher)
|
||||
bool FileApiParser::setupCMakeFileApi(const FilePath &buildDirectory)
|
||||
{
|
||||
// So that we have a directory to watch.
|
||||
buildDirectory.pathAppended(CMAKE_RELATIVE_REPLY_PATH).ensureWritableDir();
|
||||
@@ -818,7 +818,6 @@ bool FileApiParser::setupCMakeFileApi(const FilePath &buildDirectory, Utils::Fil
|
||||
}
|
||||
}
|
||||
|
||||
watcher.addDirectory(cmakeReplyDirectory(buildDirectory).path(), FileSystemWatcher::WatchAllChanges);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -227,9 +227,9 @@ public:
|
||||
const QString &cmakeBuildType,
|
||||
QString &errorMessage);
|
||||
|
||||
static bool setupCMakeFileApi(const Utils::FilePath &buildDirectory,
|
||||
Utils::FileSystemWatcher &watcher);
|
||||
static bool setupCMakeFileApi(const Utils::FilePath &buildDirectory);
|
||||
|
||||
static Utils::FilePath cmakeReplyDirectory(const Utils::FilePath &buildDirectory);
|
||||
static Utils::FilePaths cmakeQueryFilePaths(const Utils::FilePath &buildDirectory);
|
||||
|
||||
static Utils::FilePath scanForCMakeReplyFile(const Utils::FilePath &buildDirectory);
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user