CompilationDB: Reparse only on actual project file change

Fixes: QTCREATORBUG-22574
Change-Id: I39fe58f96c1ff9118405be225f39e5348304222e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Christian Kandeler
2019-10-22 09:43:24 +02:00
parent 70e8954402
commit 61bb28cdc0
4 changed files with 49 additions and 24 deletions

View File

@@ -406,10 +406,11 @@ CompilationDatabaseProject::CompilationDatabaseProject(const Utils::FilePath &pr
m_kit.reset(KitManager::defaultKit()->clone());
addTargetForKit(m_kit.get());
connect(this,
&CompilationDatabaseProject::rootProjectDirectoryChanged,
m_parseDelay,
QOverload<>::of(&QTimer::start));
connect(this, &CompilationDatabaseProject::rootProjectDirectoryChanged,
this, [this] {
m_projectFileHash.clear();
m_parseDelay->start();
});
setExtraProjectFiles(
{projectFile.stringAppended(Constants::COMPILATIONDATABASEPROJECT_FILES_SUFFIX)});
@@ -458,11 +459,13 @@ void CompilationDatabaseProject::reparseProject()
m_mimeBinaryCache,
guardParsingRun(),
this);
connect(m_parser, &CompilationDbParser::finished, this, [this](bool success) {
if (success)
connect(m_parser, &CompilationDbParser::finished, this, [this](ParseResult result) {
m_projectFileHash = m_parser->projectFileHash();
if (result == ParseResult::Success)
buildTreeAndProjectParts();
m_parser = nullptr;
});
m_parser->setPreviousProjectFileHash(m_projectFileHash);
m_parser->start();
}