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

@@ -3,8 +3,6 @@
#include "genericproject.h"
#include "genericbuildconfiguration.h"
#include "genericmakestep.h"
#include "genericprojectconstants.h"
#include "genericprojectmanagertr.h"
@@ -13,10 +11,6 @@
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
#include <cppeditor/cppprojectupdaterinterface.h>
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/abi.h>
#include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildsteplist.h>
@@ -27,6 +21,8 @@
#include <projectexplorer/kitaspects.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/projectupdater.h>
#include <projectexplorer/selectablefilesmodel.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
@@ -156,7 +152,7 @@ private:
QStringList m_cxxflags;
QStringList m_cflags;
CppEditor::CppProjectUpdaterInterface *m_cppCodeModelUpdater = nullptr;
ProjectUpdater *m_cppCodeModelUpdater = nullptr;
FileSystemWatcher m_deployFileWatcher;
};
@@ -186,16 +182,7 @@ GenericProject::GenericProject(const Utils::FilePath &fileName)
GenericBuildSystem::GenericBuildSystem(Target *target)
: BuildSystem(target)
{
QObject *projectUpdaterFactory = ExtensionSystem::PluginManager::getObjectByName(
"CppProjectUpdaterFactory");
if (projectUpdaterFactory) {
const bool successFullyCreatedProjectUpdater
= QMetaObject::invokeMethod(projectUpdaterFactory,
"create",
Q_RETURN_ARG(CppEditor::CppProjectUpdaterInterface *,
m_cppCodeModelUpdater));
QTC_CHECK(successFullyCreatedProjectUpdater);
}
m_cppCodeModelUpdater = ProjectUpdaterFactory::createCppProjectUpdater();
connect(target->project(), &Project::projectFileIsDirty, this, [this](const FilePath &p) {
if (p.endsWith(".files"))