Commit 2d8d90bc authored by Tobias Hunger's avatar Tobias Hunger

CMake: Cache buildtargets in builddirmanager

No need to have the builddirreaders to so.

Change-Id: Ia7e38f6483b29d6a4f4b65baacc17bf184a3cb34
Task-number: QTCREATORBUG-17359
Reviewed-by: default avatarFlorian Apolloner <florian@apolloner.eu>
Reviewed-by: Tobias Hunger's avatarTobias Hunger <tobias.hunger@qt.io>
parent c9be75fe
......@@ -142,6 +142,8 @@ void BuildDirManager::updateReaderData()
void BuildDirManager::parseOnceReaderReady(bool force)
{
m_buildTargets.clear();
auto fi = new QFutureInterface<QList<ProjectExplorer::FileNode *>>();
m_scanFuture = fi->future();
m_futureWatcher.setFuture(m_scanFuture);
......@@ -302,6 +304,8 @@ void BuildDirManager::resetData()
m_cmakeCache.clear();
m_futureWatcher.setFuture(QFuture<QList<FileNode *>>());
m_reader.reset();
m_buildTargets.clear();
}
bool BuildDirManager::updateCMakeStateBeforeBuild()
......@@ -395,7 +399,9 @@ QList<CMakeBuildTarget> BuildDirManager::buildTargets() const
{
if (!m_reader)
return QList<CMakeBuildTarget>();
return m_reader->buildTargets();
if (m_buildTargets.isEmpty())
m_buildTargets = m_reader->buildTargets();
return m_buildTargets;
}
CMakeConfig BuildDirManager::parsedConfiguration() const
......
......@@ -114,6 +114,8 @@ private:
std::unique_ptr<BuildDirReader> m_reader;
QFutureWatcher<QList<ProjectExplorer::FileNode*>> m_futureWatcher;
QFuture<QList<ProjectExplorer::FileNode*>> m_scanFuture;
mutable QList<CMakeBuildTarget> m_buildTargets;
};
} // namespace Internal
......
......@@ -186,7 +186,7 @@ bool ServerModeReader::hasData() const
QList<CMakeBuildTarget> ServerModeReader::buildTargets() const
{
return transform(m_targets, [](const Target *t) -> CMakeBuildTarget {
const QList<CMakeBuildTarget> result = transform(m_targets, [](const Target *t) -> CMakeBuildTarget {
CMakeBuildTarget ct;
ct.title = t->name;
ct.executable = t->artifacts.isEmpty() ? FileName() : t->artifacts.at(0);
......@@ -207,6 +207,8 @@ QList<CMakeBuildTarget> ServerModeReader::buildTargets() const
ct.sourceDirectory = t->sourceDirectory;
return ct;
});
m_targets.clear();
return result;
}
CMakeConfig ServerModeReader::parsedConfiguration() const
......
......@@ -147,7 +147,7 @@ private:
QList<ProjectExplorer::FileNode *> m_cmakeInputsFileNodes;
QList<Project *> m_projects;
QList<Target *> m_targets;
mutable QList<Target *> m_targets;
QList<FileGroup *> m_fileGroups;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment