ProjectExplorer: Promote CppProjectUpdaterInterface

... to ProjectExplorer::ProjectUpdaterInterface and generalize it
regarding language, but create a convience function for the C++
case, as that's the only user right now.

Also add the self-registering factory boilerplate and adapt all
buildsystems.

Change-Id: If928512609d41c25fad2aa58633c8bffabc4c48f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2023-10-19 10:42:45 +02:00
parent 0fa16f8489
commit b89baec2c1
23 changed files with 165 additions and 96 deletions

View File

@@ -8,8 +8,9 @@
#include <coreplugin/coreplugintr.h>
#include <coreplugin/icontext.h>
#include <cppeditor/cppprojectupdater.h>
#include <cppeditor/projectinfo.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/buildtargetinfo.h>
@@ -21,8 +22,10 @@
#include <projectexplorer/namedwidget.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projectupdater.h>
#include <projectexplorer/target.h>
#include <projectexplorer/toolchainmanager.h>
#include <texteditor/textdocument.h>
#include <utils/algorithm.h>
@@ -43,7 +46,6 @@ namespace Internal {
namespace {
bool isGccCompiler(const QString &compilerName)
{
return compilerName.contains("gcc")
@@ -312,7 +314,7 @@ void createTree(std::unique_ptr<ProjectNode> &root,
CompilationDatabaseBuildSystem::CompilationDatabaseBuildSystem(Target *target)
: BuildSystem(target)
, m_cppCodeModelUpdater(std::make_unique<CppEditor::CppProjectUpdater>())
, m_cppCodeModelUpdater(ProjectUpdaterFactory::createCppProjectUpdater())
, m_deployFileWatcher(new FileSystemWatcher(this))
{
connect(target->project(), &CompilationDatabaseProject::rootProjectDirectoryChanged,

View File

@@ -15,12 +15,15 @@
#include <QFutureWatcher>
namespace CppEditor { class CppProjectUpdater; }
namespace ProjectExplorer { class Kit; }
namespace ProjectExplorer {
class Kit;
class ProjectUpdater;
} // ProjectExplorer
namespace Utils { class FileSystemWatcher; }
namespace CompilationDatabaseProjectManager {
namespace Internal {
namespace CompilationDatabaseProjectManager::Internal {
class CompilationDbParser;
class CompilationDatabaseProject : public ProjectExplorer::Project
@@ -49,7 +52,7 @@ public:
void buildTreeAndProjectParts();
QFutureWatcher<void> m_parserWatcher;
std::unique_ptr<CppEditor::CppProjectUpdater> m_cppCodeModelUpdater;
std::unique_ptr<ProjectExplorer::ProjectUpdater> m_cppCodeModelUpdater;
MimeBinaryCache m_mimeBinaryCache;
QByteArray m_projectFileHash;
CompilationDbParser *m_parser = nullptr;
@@ -68,5 +71,4 @@ public:
CompilationDatabaseBuildConfigurationFactory();
};
} // namespace Internal
} // namespace CompilationDatabaseProjectManager
} // CompilationDatabaseProjectManager::Internal