CMake: Encapsulate BuildDirManager in CMakeBC

This will make it easier to introduce a new type of BuildDirManager
to accommodate cmake server-mode.

Change-Id: I989aab9df44dff1cfdff226ef97bb30bb092ffdd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2016-10-06 11:31:27 +02:00
parent 5481ca6edb
commit 683b965297
4 changed files with 48 additions and 29 deletions

View File

@@ -159,11 +159,6 @@ void CMakeBuildConfiguration::maybeForceReparse()
m_buildDirManager->maybeForceReparse();
}
BuildDirManager *CMakeBuildConfiguration::buildDirManager() const
{
return m_buildDirManager;
}
bool CMakeBuildConfiguration::isParsing() const
{
return m_buildDirManager && m_buildDirManager->isParsing();
@@ -179,6 +174,37 @@ bool CMakeBuildConfiguration::persistCMakeState()
return m_buildDirManager->persistCMakeState();
}
void CMakeBuildConfiguration::runCMake()
{
if (!m_buildDirManager || m_buildDirManager->isParsing())
return;
m_buildDirManager->checkConfiguration();
m_buildDirManager->forceReparse();
}
void CMakeBuildConfiguration::clearCache()
{
if (m_buildDirManager)
m_buildDirManager->clearCache();
}
QList<CMakeBuildTarget> CMakeBuildConfiguration::buildTargets() const
{
if (!m_buildDirManager || m_buildDirManager->isParsing())
return QList<CMakeBuildTarget>();
return m_buildDirManager->buildTargets();
}
void CMakeBuildConfiguration::generateProjectTree(CMakeProjectNode *root) const
{
if (!m_buildDirManager || m_buildDirManager->isParsing())
return;
return m_buildDirManager->generateProjectTree(root);
}
FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFilePath,
const Kit *k,
const QString &bcName,
@@ -196,7 +222,7 @@ FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFi
QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration() const
{
if (!m_buildDirManager && m_buildDirManager->isParsing())
if (!m_buildDirManager || m_buildDirManager->isParsing())
return QList<ConfigModel::DataItem>();
if (m_completeConfigurationCache.isEmpty())
@@ -234,7 +260,7 @@ QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration
void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items)
{
if (m_buildDirManager->isParsing())
if (!m_buildDirManager || m_buildDirManager->isParsing())
return;
const CMakeConfig newConfig = Utils::transform(items, [](const ConfigModel::DataItem &i) {