CMake: More logging of cmake parsing flags

Add more logging of cmake parsing flags as cmake runs are requested
in the plugin.

Change-Id: I5231bd29dfeb6521218dc28c26a5b658ccb4059b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2019-08-09 12:20:49 +02:00
parent 39b66f0557
commit 87f496d091
4 changed files with 58 additions and 14 deletions

View File

@@ -45,6 +45,7 @@
#include <utils/qtcassert.h>
#include <QDir>
#include <QLoggingCategory>
#include <QMessageBox>
#include <QPushButton>
#include <QSet>
@@ -55,6 +56,8 @@ using namespace Utils;
namespace CMakeProjectManager {
namespace Internal {
Q_LOGGING_CATEGORY(cmakeBuildDirManagerLog, "qtc.cmake.builddirmanager", QtWarningMsg);
// --------------------------------------------------------------------
// BuildDirManager:
// --------------------------------------------------------------------
@@ -283,7 +286,10 @@ bool BuildDirManager::persistCMakeState()
void BuildDirManager::parse(int reparseParameters)
{
QTC_ASSERT(m_parameters.isValid(), return);
qCDebug(cmakeBuildDirManagerLog)
<< "Parse called with flags:" << flagsString(reparseParameters);
QTC_ASSERT(m_parameters.isValid(), return );
QTC_ASSERT(m_reader, return);
QTC_ASSERT((reparseParameters & REPARSE_FAIL) == 0, return);
QTC_ASSERT((reparseParameters & REPARSE_IGNORE) == 0, return);
@@ -294,9 +300,14 @@ void BuildDirManager::parse(int reparseParameters)
if (!m_parameters.workDirectory.toFileInfo().exists("CMakeCache.txt")) {
reparseParameters |= REPARSE_FORCE_CONFIGURATION | REPARSE_FORCE_CMAKE_RUN;
qCDebug(cmakeBuildDirManagerLog)
<< "No CMakeCache.txt file found, new flags:" << flagsString(reparseParameters);
} else if (reparseParameters & REPARSE_CHECK_CONFIGURATION) {
if (checkConfiguration())
if (checkConfiguration()) {
reparseParameters |= REPARSE_FORCE_CONFIGURATION | REPARSE_FORCE_CMAKE_RUN;
qCDebug(cmakeBuildDirManagerLog)
<< "Config check triggered flags change:" << flagsString(reparseParameters);
}
}
m_reader->parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN,
@@ -406,6 +417,30 @@ CMakeConfig BuildDirManager::parseCMakeConfiguration(const Utils::FilePath &cach
return result;
}
QString BuildDirManager::flagsString(int reparseFlags)
{
QString result;
if (reparseFlags == REPARSE_DEFAULT) {
result = "<NONE>";
} else {
if (reparseFlags & REPARSE_URGENT)
result += " URGENT";
if (reparseFlags & REPARSE_FORCE_CMAKE_RUN)
result += " FORCE_CMAKE_RUN";
if (reparseFlags & REPARSE_FORCE_CONFIGURATION)
result += " FORCE_CONFIG";
if (reparseFlags & REPARSE_CHECK_CONFIGURATION)
result += " CHECK_CONFIG";
if (reparseFlags & REPARSE_SCAN)
result += " SCAN";
if (reparseFlags & REPARSE_IGNORE)
result += " IGNORE";
if (reparseFlags & REPARSE_FAIL)
result += " FAIL";
}
return result.trimmed();
}
bool BuildDirManager::checkConfiguration()
{
CMakeBuildConfiguration *bc = buildConfiguration();