From 216e40b3f0fa2e6da85367e8620c8f93f6b3c5b8 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 21 Nov 2017 11:06:41 +0100 Subject: CMake: Fix tree scanner not getting run automatically This lead to entry being missing from the project tree. Task-number: QTCREATORBUG-19333 Change-Id: Ice3bab6d92aaa3799e66800cbae0bacd57537322 Reviewed-by: Eike Ziller --- src/plugins/cmakeprojectmanager/builddirmanager.h | 5 +++-- src/plugins/cmakeprojectmanager/cmakeproject.cpp | 27 ++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/plugins/cmakeprojectmanager/builddirmanager.h b/src/plugins/cmakeprojectmanager/builddirmanager.h index d703aed5ad..58fe11484c 100644 --- a/src/plugins/cmakeprojectmanager/builddirmanager.h +++ b/src/plugins/cmakeprojectmanager/builddirmanager.h @@ -88,8 +88,9 @@ public: REPARSE_URGENT = 1, // Do not wait for more requests, start ASAP REPARSE_FORCE_CONFIGURATION = 2, // Force configuration arguments to cmake REPARSE_CHECK_CONFIGURATION = 4, // Check and warn if on-disk config and QtC config differ - REPARSE_IGNORE = 8, // Do not reparse:-) - REPARSE_FAIL = 16 // Do not reparse and raise a warning + REPARSE_SCAN = 8, + REPARSE_IGNORE = 16, // Do not reparse:-) + REPARSE_FAIL = 32 // Do not reparse and raise a warning }; signals: diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 81345fee8e..a47a7ee91e 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -390,25 +390,27 @@ bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const void CMakeProject::runCMake() { - if (isParsing()) + CMakeBuildConfiguration *bc = activeBc(this); + if (isParsing() || !bc) return; - CMakeBuildConfiguration *bc = activeBc(this); - if (bc) { - BuildDirParameters parameters(bc); - m_buildDirManager.setParametersAndRequestParse(parameters, - BuildDirManager::REPARSE_CHECK_CONFIGURATION, - BuildDirManager::REPARSE_CHECK_CONFIGURATION); - } + BuildDirParameters parameters(bc); + m_buildDirManager.setParametersAndRequestParse(parameters, + BuildDirManager::REPARSE_CHECK_CONFIGURATION, + BuildDirManager::REPARSE_CHECK_CONFIGURATION); } void CMakeProject::runCMakeAndScanProjectTree() { - if (!m_treeScanner.isFinished()) + CMakeBuildConfiguration *bc = activeBc(this); + if (isParsing() || !bc) return; + QTC_ASSERT(m_treeScanner.isFinished(), return); - m_waitingForScan = true; - runCMake(); + BuildDirParameters parameters(bc); + m_buildDirManager.setParametersAndRequestParse(parameters, + BuildDirManager::REPARSE_CHECK_CONFIGURATION | BuildDirManager::REPARSE_SCAN, + BuildDirManager::REPARSE_CHECK_CONFIGURATION | BuildDirManager::REPARSE_SCAN); } void CMakeProject::buildCMakeTarget(const QString &buildTarget) @@ -452,6 +454,8 @@ void CMakeProject::handleReparseRequest(int reparseParameters) m_delayedParsingTimer.setInterval((reparseParameters & BuildDirManager::REPARSE_URGENT) ? 0 : 1000); m_delayedParsingTimer.start(); m_delayedParsingParameters = m_delayedParsingParameters | reparseParameters; + if (m_allFiles.isEmpty()) + m_delayedParsingParameters |= BuildDirManager::REPARSE_SCAN; } void CMakeProject::startParsing(int reparseParameters) @@ -466,6 +470,7 @@ void CMakeProject::startParsing(int reparseParameters) emitParsingStarted(); + m_waitingForScan = reparseParameters & BuildDirManager::REPARSE_SCAN; m_waitingForParse = true; m_combinedScanAndParseResult = true; -- cgit v1.2.3