CMake: Fix tree scanner not getting run automatically

This lead to <Headers> entry being missing from the project tree.

Task-number: QTCREATORBUG-19333
Change-Id: Ice3bab6d92aaa3799e66800cbae0bacd57537322
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-11-21 11:06:41 +01:00
committed by Eike Ziller
parent 2abf1f29cc
commit 216e40b3f0
2 changed files with 19 additions and 13 deletions

View File

@@ -88,8 +88,9 @@ public:
REPARSE_URGENT = 1, // Do not wait for more requests, start ASAP REPARSE_URGENT = 1, // Do not wait for more requests, start ASAP
REPARSE_FORCE_CONFIGURATION = 2, // Force configuration arguments to cmake 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_CHECK_CONFIGURATION = 4, // Check and warn if on-disk config and QtC config differ
REPARSE_IGNORE = 8, // Do not reparse:-) REPARSE_SCAN = 8,
REPARSE_FAIL = 16 // Do not reparse and raise a warning REPARSE_IGNORE = 16, // Do not reparse:-)
REPARSE_FAIL = 32 // Do not reparse and raise a warning
}; };
signals: signals:

View File

@@ -390,25 +390,27 @@ bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const
void CMakeProject::runCMake() void CMakeProject::runCMake()
{ {
if (isParsing()) CMakeBuildConfiguration *bc = activeBc(this);
if (isParsing() || !bc)
return; return;
CMakeBuildConfiguration *bc = activeBc(this);
if (bc) {
BuildDirParameters parameters(bc); BuildDirParameters parameters(bc);
m_buildDirManager.setParametersAndRequestParse(parameters, m_buildDirManager.setParametersAndRequestParse(parameters,
BuildDirManager::REPARSE_CHECK_CONFIGURATION, BuildDirManager::REPARSE_CHECK_CONFIGURATION,
BuildDirManager::REPARSE_CHECK_CONFIGURATION); BuildDirManager::REPARSE_CHECK_CONFIGURATION);
} }
}
void CMakeProject::runCMakeAndScanProjectTree() void CMakeProject::runCMakeAndScanProjectTree()
{ {
if (!m_treeScanner.isFinished()) CMakeBuildConfiguration *bc = activeBc(this);
if (isParsing() || !bc)
return; return;
QTC_ASSERT(m_treeScanner.isFinished(), return);
m_waitingForScan = true; BuildDirParameters parameters(bc);
runCMake(); m_buildDirManager.setParametersAndRequestParse(parameters,
BuildDirManager::REPARSE_CHECK_CONFIGURATION | BuildDirManager::REPARSE_SCAN,
BuildDirManager::REPARSE_CHECK_CONFIGURATION | BuildDirManager::REPARSE_SCAN);
} }
void CMakeProject::buildCMakeTarget(const QString &buildTarget) 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.setInterval((reparseParameters & BuildDirManager::REPARSE_URGENT) ? 0 : 1000);
m_delayedParsingTimer.start(); m_delayedParsingTimer.start();
m_delayedParsingParameters = m_delayedParsingParameters | reparseParameters; m_delayedParsingParameters = m_delayedParsingParameters | reparseParameters;
if (m_allFiles.isEmpty())
m_delayedParsingParameters |= BuildDirManager::REPARSE_SCAN;
} }
void CMakeProject::startParsing(int reparseParameters) void CMakeProject::startParsing(int reparseParameters)
@@ -466,6 +470,7 @@ void CMakeProject::startParsing(int reparseParameters)
emitParsingStarted(); emitParsingStarted();
m_waitingForScan = reparseParameters & BuildDirManager::REPARSE_SCAN;
m_waitingForParse = true; m_waitingForParse = true;
m_combinedScanAndParseResult = true; m_combinedScanAndParseResult = true;