forked from qt-creator/qt-creator
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:
@@ -5,9 +5,11 @@
|
||||
|
||||
#include "makefileparserthread.h"
|
||||
|
||||
#include <cppeditor/cppprojectupdater.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtcppkitinfo.h>
|
||||
|
||||
#include <utils/filesystemwatcher.h>
|
||||
@@ -20,7 +22,7 @@ namespace AutotoolsProjectManager::Internal {
|
||||
|
||||
AutotoolsBuildSystem::AutotoolsBuildSystem(Target *target)
|
||||
: BuildSystem(target)
|
||||
, m_cppCodeModelUpdater(new CppEditor::CppProjectUpdater)
|
||||
, m_cppCodeModelUpdater(ProjectUpdaterFactory::createCppProjectUpdater())
|
||||
{
|
||||
connect(target, &Target::activeBuildConfigurationChanged, this, [this] { requestParse(); });
|
||||
connect(target->project(), &Project::projectFileIsDirty, this, [this] { requestParse(); });
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace CppEditor { class CppProjectUpdater; }
|
||||
namespace ProjectExplorer { class ProjectUpdater; }
|
||||
|
||||
namespace AutotoolsProjectManager::Internal {
|
||||
|
||||
@@ -42,7 +42,7 @@ private:
|
||||
/// Responsible for parsing the makefiles asynchronously in a thread
|
||||
std::unique_ptr<MakefileParserThread> m_makefileParserThread;
|
||||
|
||||
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
ProjectExplorer::ProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
};
|
||||
|
||||
} // AutotoolsProjectManager::Internal
|
||||
|
@@ -24,12 +24,12 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
#include <cppeditor/cppprojectupdater.h>
|
||||
|
||||
#include <projectexplorer/extracompiler.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
@@ -71,7 +71,7 @@ static Q_LOGGING_CATEGORY(cmakeBuildSystemLog, "qtc.cmake.buildsystem", QtWarnin
|
||||
|
||||
CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
|
||||
: BuildSystem(bc)
|
||||
, m_cppCodeModelUpdater(new CppEditor::CppProjectUpdater)
|
||||
, m_cppCodeModelUpdater(ProjectUpdaterFactory::createCppProjectUpdater())
|
||||
{
|
||||
// TreeScanner:
|
||||
connect(&m_treeScanner, &TreeScanner::finished,
|
||||
|
@@ -10,14 +10,14 @@
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
namespace CppEditor { class CppProjectUpdater; }
|
||||
namespace ProjectExplorer {
|
||||
class ExtraCompiler;
|
||||
class FolderNode;
|
||||
class ProjectUpdater;
|
||||
}
|
||||
|
||||
namespace Utils {
|
||||
class Process;
|
||||
class Link;
|
||||
@@ -225,7 +225,7 @@ private:
|
||||
|
||||
ParseGuard m_currentGuard;
|
||||
|
||||
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
ProjectExplorer::ProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
||||
QList<CMakeBuildTarget> m_buildTargets;
|
||||
QSet<CMakeFileInfo> m_cmakeFiles;
|
||||
|
@@ -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,
|
||||
|
@@ -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
|
||||
|
@@ -69,7 +69,6 @@ add_qtc_plugin(CppEditor
|
||||
cppprojectinfogenerator.cpp cppprojectinfogenerator.h
|
||||
cppprojectpartchooser.cpp cppprojectpartchooser.h
|
||||
cppprojectupdater.cpp cppprojectupdater.h
|
||||
cppprojectupdaterinterface.h
|
||||
cppqtstyleindenter.cpp cppqtstyleindenter.h
|
||||
cppquickfix.cpp cppquickfix.h
|
||||
cppquickfixassistant.cpp cppquickfixassistant.h
|
||||
|
@@ -150,7 +150,6 @@ QtcPlugin {
|
||||
"cppprojectinfogenerator.h",
|
||||
"cppprojectupdater.cpp",
|
||||
"cppprojectupdater.h",
|
||||
"cppprojectupdaterinterface.h",
|
||||
"cppquickfix.cpp",
|
||||
"cppquickfix.h",
|
||||
"cppquickfixassistant.cpp",
|
||||
|
@@ -68,8 +68,6 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -165,7 +163,6 @@ class CppEditorPluginPrivate : public QObject
|
||||
public:
|
||||
~CppEditorPluginPrivate()
|
||||
{
|
||||
ExtensionSystem::PluginManager::removeObject(&m_cppProjectUpdaterFactory);
|
||||
delete m_clangdSettingsPage;
|
||||
}
|
||||
|
||||
@@ -231,7 +228,6 @@ void CppEditorPlugin::initialize()
|
||||
d->m_codeModelSettings.fromSettings(ICore::settings());
|
||||
|
||||
CppModelManager::registerJsExtension();
|
||||
ExtensionSystem::PluginManager::addObject(&d->m_cppProjectUpdaterFactory);
|
||||
|
||||
setupMenus();
|
||||
registerVariables();
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <coreplugin/progressmanager/taskprogress.h>
|
||||
|
||||
#include <projectexplorer/extracompiler.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/async.h>
|
||||
@@ -24,11 +25,6 @@ namespace CppEditor {
|
||||
CppProjectUpdater::CppProjectUpdater() = default;
|
||||
CppProjectUpdater::~CppProjectUpdater() = default;
|
||||
|
||||
void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo)
|
||||
{
|
||||
update(projectUpdateInfo, {});
|
||||
}
|
||||
|
||||
void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo,
|
||||
const QList<ProjectExplorer::ExtraCompiler *> &extraCompilers)
|
||||
{
|
||||
@@ -108,15 +104,13 @@ void CppProjectUpdater::cancel()
|
||||
}
|
||||
|
||||
namespace Internal {
|
||||
|
||||
CppProjectUpdaterFactory::CppProjectUpdaterFactory()
|
||||
{
|
||||
setObjectName("CppProjectUpdaterFactory");
|
||||
setLanguage(Constants::CXX_LANGUAGE_ID);
|
||||
setCreator([] { return new CppProjectUpdater; });
|
||||
}
|
||||
|
||||
CppProjectUpdaterInterface *CppProjectUpdaterFactory::create()
|
||||
{
|
||||
return new CppProjectUpdater;
|
||||
}
|
||||
} // namespace Internal
|
||||
|
||||
} // namespace CppEditor
|
||||
|
@@ -5,7 +5,8 @@
|
||||
|
||||
#include "cppeditor_global.h"
|
||||
|
||||
#include "cppprojectupdaterinterface.h"
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
|
||||
#include <utils/futuresynchronizer.h>
|
||||
|
||||
@@ -17,19 +18,17 @@ namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
// registered in extensionsystem's object pool for plugins with weak dependency to CppEditor
|
||||
class CppProjectUpdaterFactory : public QObject
|
||||
class CppProjectUpdaterFactory final
|
||||
: public ProjectExplorer::ProjectUpdaterFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CppProjectUpdaterFactory();
|
||||
|
||||
// keep the namespace, for the type name in the invokeMethod call
|
||||
Q_INVOKABLE CppEditor::CppProjectUpdaterInterface *create();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
class CPPEDITOR_EXPORT CppProjectUpdater final : public QObject, public CppProjectUpdaterInterface
|
||||
class CPPEDITOR_EXPORT CppProjectUpdater final
|
||||
: public QObject, public ProjectExplorer::ProjectUpdater
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -37,9 +36,8 @@ public:
|
||||
CppProjectUpdater();
|
||||
~CppProjectUpdater() override;
|
||||
|
||||
void update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo) override;
|
||||
void update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo,
|
||||
const QList<ProjectExplorer::ExtraCompiler *> &extraCompilers);
|
||||
const QList<ProjectExplorer::ExtraCompiler *> &extraCompilers) override;
|
||||
void cancel() override;
|
||||
|
||||
private:
|
||||
|
@@ -1,20 +0,0 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
|
||||
namespace CppEditor {
|
||||
|
||||
// FIXME: Remove
|
||||
class CppProjectUpdaterInterface
|
||||
{
|
||||
public:
|
||||
virtual ~CppProjectUpdaterInterface() = default;
|
||||
|
||||
virtual void update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo) = 0;
|
||||
virtual void cancel() = 0;
|
||||
};
|
||||
|
||||
} // namespace CppEditor
|
@@ -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"))
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
@@ -177,6 +177,7 @@ void MachineFileManager::cleanupMachineFiles()
|
||||
MesonBuildSystem::MesonBuildSystem(MesonBuildConfiguration *bc)
|
||||
: BuildSystem(bc)
|
||||
, m_parser(MesonToolKitAspect::mesonToolId(bc->kit()), bc->environment(), project())
|
||||
, m_cppCodeModelUpdater(ProjectUpdaterFactory::createCppProjectUpdater())
|
||||
{
|
||||
qCDebug(mesonBuildSystemLog) << "Init";
|
||||
connect(bc->target(), &ProjectExplorer::Target::kitChanged, this, [this] {
|
||||
@@ -239,8 +240,8 @@ void MesonBuildSystem::parsingCompleted(bool success)
|
||||
if (success) {
|
||||
setRootProjectNode(m_parser.takeProjectNode());
|
||||
if (kit() && buildConfiguration()) {
|
||||
ProjectExplorer::KitInfo kitInfo{kit()};
|
||||
m_cppCodeModelUpdater.update(
|
||||
KitInfo kitInfo{kit()};
|
||||
m_cppCodeModelUpdater->update(
|
||||
{project(),
|
||||
QtSupport::CppKitInfo(kit()),
|
||||
buildConfiguration()->environment(),
|
||||
|
@@ -6,13 +6,13 @@
|
||||
#include "mesonprojectparser.h"
|
||||
#include "kitdata.h"
|
||||
|
||||
#include <cppeditor/cppprojectupdater.h>
|
||||
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/filesystemwatcher.h>
|
||||
|
||||
namespace ProjectExplorer { class ProjectUpdater; }
|
||||
|
||||
namespace MesonProjectManager::Internal {
|
||||
|
||||
class MesonBuildConfiguration;
|
||||
@@ -62,7 +62,7 @@ private:
|
||||
|
||||
ProjectExplorer::BuildSystem::ParseGuard m_parseGuard;
|
||||
MesonProjectParser m_parser;
|
||||
CppEditor::CppProjectUpdater m_cppCodeModelUpdater;
|
||||
std::unique_ptr<ProjectExplorer::ProjectUpdater> m_cppCodeModelUpdater;
|
||||
QStringList m_pendingConfigArgs;
|
||||
Utils::FileSystemWatcher m_IntroWatcher;
|
||||
KitData m_kitData;
|
||||
|
@@ -144,6 +144,7 @@ add_qtc_plugin(ProjectExplorer
|
||||
projectsettingswidget.cpp projectsettingswidget.h
|
||||
projecttree.cpp projecttree.h
|
||||
projecttreewidget.cpp projecttreewidget.h
|
||||
projectupdater.cpp projectupdater.h
|
||||
projectwelcomepage.cpp projectwelcomepage.h
|
||||
projectwindow.cpp projectwindow.h
|
||||
projectwizardpage.cpp projectwizardpage.h
|
||||
|
@@ -119,6 +119,7 @@ QtcPlugin {
|
||||
"projecttree.cpp",
|
||||
"projecttree.h",
|
||||
"projecttreewidget.cpp", "projecttreewidget.h",
|
||||
"projectupdater.cpp", "projectupdater.h",
|
||||
"projectwindow.cpp", "projectwindow.h",
|
||||
"projectwizardpage.cpp", "projectwizardpage.h",
|
||||
"rawprojectpart.cpp", "rawprojectpart.h",
|
||||
|
58
src/plugins/projectexplorer/projectupdater.cpp
Normal file
58
src/plugins/projectexplorer/projectupdater.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "projectupdater.h"
|
||||
|
||||
#include "projectexplorerconstants.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/predicates.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QList>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
static QList<ProjectUpdaterFactory *> &projectUpdaterFactories()
|
||||
{
|
||||
static QList<ProjectUpdaterFactory *> theProjectUpdaterFactories;
|
||||
return theProjectUpdaterFactories;
|
||||
}
|
||||
|
||||
ProjectUpdaterFactory::ProjectUpdaterFactory()
|
||||
{
|
||||
projectUpdaterFactories().append(this);
|
||||
}
|
||||
|
||||
ProjectUpdaterFactory::~ProjectUpdaterFactory()
|
||||
{
|
||||
projectUpdaterFactories().removeOne(this);
|
||||
}
|
||||
|
||||
void ProjectUpdaterFactory::setLanguage(Id language)
|
||||
{
|
||||
m_language = language;
|
||||
}
|
||||
|
||||
void ProjectUpdaterFactory::setCreator(const std::function<ProjectUpdater *()> &creator)
|
||||
{
|
||||
m_creator = creator;
|
||||
}
|
||||
|
||||
ProjectUpdater *ProjectUpdaterFactory::createProjectUpdater(Id language)
|
||||
{
|
||||
const QList<ProjectUpdaterFactory *> &factories = projectUpdaterFactories();
|
||||
ProjectUpdaterFactory *factory =
|
||||
findOrDefault(factories, equal(&ProjectUpdaterFactory::m_language, language));
|
||||
QTC_ASSERT(factory, return nullptr);
|
||||
return factory->m_creator();
|
||||
}
|
||||
|
||||
ProjectUpdater *ProjectUpdaterFactory::createCppProjectUpdater()
|
||||
{
|
||||
return createProjectUpdater(Constants::CXX_LANGUAGE_ID);
|
||||
}
|
||||
|
||||
} // ProjectExplorer
|
45
src/plugins/projectexplorer/projectupdater.h
Normal file
45
src/plugins/projectexplorer/projectupdater.h
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <utils/id.h>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class ProjectUpdateInfo;
|
||||
class ExtraCompiler;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ProjectUpdater
|
||||
{
|
||||
public:
|
||||
virtual ~ProjectUpdater() = default;
|
||||
|
||||
virtual void update(const ProjectUpdateInfo &projectUpdateInfo,
|
||||
const QList<ExtraCompiler *> &extraCompilers = {}) = 0;
|
||||
virtual void cancel() = 0;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ProjectUpdaterFactory
|
||||
{
|
||||
public:
|
||||
ProjectUpdaterFactory();
|
||||
~ProjectUpdaterFactory();
|
||||
|
||||
static ProjectUpdater *createProjectUpdater(Utils::Id language);
|
||||
static ProjectUpdater *createCppProjectUpdater(); // Convenience for C++.
|
||||
|
||||
protected:
|
||||
void setLanguage(Utils::Id language);
|
||||
void setCreator(const std::function<ProjectUpdater *()> &creator);
|
||||
|
||||
private:
|
||||
std::function<ProjectUpdater *()> m_creator;
|
||||
Utils::Id m_language;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
@@ -26,7 +26,6 @@
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/cppprojectupdater.h>
|
||||
#include <cppeditor/generatedcodemodelsupport.h>
|
||||
#include <projectexplorer/buildinfo.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
@@ -38,6 +37,7 @@
|
||||
#include <projectexplorer/kitaspects.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
@@ -151,7 +151,8 @@ static bool supportsNodeAction(ProjectAction action, const Node *node)
|
||||
QbsBuildSystem::QbsBuildSystem(QbsBuildConfiguration *bc)
|
||||
: BuildSystem(bc->target()),
|
||||
m_session(new QbsSession(this)),
|
||||
m_cppCodeModelUpdater(new CppEditor::CppProjectUpdater),
|
||||
m_cppCodeModelUpdater(
|
||||
ProjectUpdaterFactory::createProjectUpdater(ProjectExplorer::Constants::CXX_LANGUAGE_ID)),
|
||||
m_buildConfiguration(bc)
|
||||
{
|
||||
connect(m_session, &QbsSession::newGeneratedFilesForSources, this,
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace CppEditor { class CppProjectUpdater; }
|
||||
namespace ProjectExplorer { class ProjectUpdater; }
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
Utils::Environment m_lastParseEnv;
|
||||
std::unique_ptr<QbsRequest> m_parseRequest;
|
||||
|
||||
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
ProjectExplorer::ProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
|
||||
QHash<ProjectExplorer::ExtraCompilerFactory *, QStringList> m_sourcesForGeneratedFiles;
|
||||
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/cppprojectupdater.h>
|
||||
#include <cppeditor/generatedcodemodelsupport.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
@@ -31,6 +30,7 @@
|
||||
#include <projectexplorer/headerpath.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectupdater.h>
|
||||
#include <projectexplorer/rawprojectpart.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -202,7 +202,7 @@ DeploymentKnowledge QmakeProject::deploymentKnowledge() const
|
||||
QmakeBuildSystem::QmakeBuildSystem(QmakeBuildConfiguration *bc)
|
||||
: BuildSystem(bc)
|
||||
, m_qmakeVfs(new QMakeVfs)
|
||||
, m_cppCodeModelUpdater(new CppEditor::CppProjectUpdater)
|
||||
, m_cppCodeModelUpdater(ProjectUpdaterFactory::createCppProjectUpdater())
|
||||
{
|
||||
setParseDelay(0);
|
||||
|
||||
|
@@ -20,8 +20,11 @@ class QMakeGlobals;
|
||||
class QMakeVfs;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CppEditor { class CppProjectUpdater; }
|
||||
namespace ProjectExplorer { class DeploymentData; }
|
||||
namespace ProjectExplorer {
|
||||
class DeploymentData;
|
||||
class ProjectUpdater;
|
||||
} // ProjectExplorer
|
||||
|
||||
namespace QtSupport { class ProFileReader; }
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
@@ -193,7 +196,7 @@ private:
|
||||
bool m_cancelEvaluate = false;
|
||||
QList<QmakeProFile *> m_partialEvaluate;
|
||||
|
||||
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
ProjectExplorer::ProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||
|
||||
Internal::CentralizedFolderWatcher *m_centralizedFolderWatcher = nullptr;
|
||||
|
||||
|
Reference in New Issue
Block a user