From 890cc2ba768c31c8b4ef1201317f5c57831b5edc Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 5 Jul 2023 12:20:59 +0200 Subject: [PATCH] Autotools: Streamline plugin setup Change-Id: I1a2ac742a3ac055c313d3af0a7173e380ca6070a Reviewed-by: Reviewed-by: Christian Stenger --- .../autotoolsprojectmanager/CMakeLists.txt | 2 +- .../autotoolsprojectmanager.qbs | 1 - .../autotoolsprojectplugin.cpp | 74 ++++++++++++------- .../autotoolsprojectplugin.h | 51 ------------- 4 files changed, 50 insertions(+), 78 deletions(-) delete mode 100644 src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.h diff --git a/src/plugins/autotoolsprojectmanager/CMakeLists.txt b/src/plugins/autotoolsprojectmanager/CMakeLists.txt index 0536178881e..261403ce8c5 100644 --- a/src/plugins/autotoolsprojectmanager/CMakeLists.txt +++ b/src/plugins/autotoolsprojectmanager/CMakeLists.txt @@ -8,7 +8,7 @@ add_qtc_plugin(AutotoolsProjectManager autotoolsbuildsystem.cpp autotoolsbuildsystem.h autotoolsprojectconstants.h autotoolsprojectmanagertr.h - autotoolsprojectplugin.cpp autotoolsprojectplugin.h + autotoolsprojectplugin.cpp configurestep.cpp configurestep.h makefileparser.cpp makefileparser.h makefileparserthread.cpp makefileparserthread.h diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs index ffe9690a35c..d9da0c1af9d 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs @@ -23,7 +23,6 @@ QtcPlugin { "autotoolsprojectconstants.h", "autotoolsprojectmanagertr.h", "autotoolsprojectplugin.cpp", - "autotoolsprojectplugin.h", "configurestep.cpp", "configurestep.h", "makefileparser.cpp", diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp index 4a338024731..8649236e152 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 Openismus GmbH. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#include "autotoolsprojectplugin.h" - #include "autogenstep.h" #include "autoreconfstep.h" #include "autotoolsbuildconfiguration.h" @@ -18,6 +16,10 @@ #include #include +#include + +using namespace ProjectExplorer; + namespace AutotoolsProjectManager::Internal { /** @@ -28,7 +30,7 @@ namespace AutotoolsProjectManager::Internal { * It is responsible to parse the Makefile.am files and do trigger project * updates if a Makefile.am file or a configure.ac file has been changed. */ -class AutotoolsProject : public ProjectExplorer::Project +class AutotoolsProject : public Project { public: explicit AutotoolsProject(const Utils::FilePath &fileName) @@ -40,33 +42,55 @@ public: setHasMakeInstallEquivalent(true); - setBuildSystemCreator([](ProjectExplorer::Target *t) { return new AutotoolsBuildSystem(t); }); + setBuildSystemCreator([](Target *t) { return new AutotoolsBuildSystem(t); }); } }; +/** + * @brief Implementation of the ExtensionsSystem::IPlugin interface. + * + * The plugin creates the following components: + * + * - AutotoolsManager: Will manage the new autotools project and + * tell QtCreator for which MIME types the autotools project should + * be instantiated. + * + * - MakeStepFactory: This factory is used to create make steps. + * + * - AutogenStepFactory: This factory is used to create autogen steps. + * + * - AutoreconfStepFactory: This factory is used to create autoreconf + * steps. + * + * - ConfigureStepFactory: This factory is used to create configure steps. + * + * - MakefileEditorFactory: Provides a specialized editor with automatic + * syntax highlighting for Makefile.am files. + * + * - AutotoolsTargetFactory: Our current target is desktop. + * + * - AutotoolsBuildConfigurationFactory: Creates build configurations that + * contain the steps (make, autogen, autoreconf or configure) that will + * be executed in the build process) + */ -class AutotoolsProjectPluginPrivate +class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin { -public: - AutotoolsBuildConfigurationFactory buildConfigurationFactory; - MakeStepFactory makeStepFaactory; - AutogenStepFactory autogenStepFactory; - ConfigureStepFactory configureStepFactory; - AutoreconfStepFactory autoreconfStepFactory; + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AutotoolsProjectManager.json") + + void initialize() final + { + ProjectManager::registerProjectType(Constants::MAKEFILE_MIMETYPE); + + addManaged(); + addManaged(); + addManaged(); + addManaged(); + addManaged(); + } }; -AutotoolsProjectPlugin::~AutotoolsProjectPlugin() -{ - delete d; -} - -void AutotoolsProjectPlugin::extensionsInitialized() -{ } - -void AutotoolsProjectPlugin::initialize() -{ - d = new AutotoolsProjectPluginPrivate; - ProjectExplorer::ProjectManager::registerProjectType(Constants::MAKEFILE_MIMETYPE); -} - } // AutotoolsProjectManager::Internal + +#include "autotoolsprojectplugin.moc" diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.h b/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.h deleted file mode 100644 index a705da891d5..00000000000 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectplugin.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2016 Openismus GmbH. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 - -#pragma once - -#include - -namespace AutotoolsProjectManager::Internal { - -/** - * @brief Implementation of the ExtensionsSystem::IPlugin interface. - * - * The plugin creates the following components: - * - * - AutotoolsManager: Will manage the new autotools project and - * tell QtCreator for which MIME types the autotools project should - * be instantiated. - * - * - MakeStepFactory: This factory is used to create make steps. - * - * - AutogenStepFactory: This factory is used to create autogen steps. - * - * - AutoreconfStepFactory: This factory is used to create autoreconf - * steps. - * - * - ConfigureStepFactory: This factory is used to create configure steps. - * - * - MakefileEditorFactory: Provides a specialized editor with automatic - * syntax highlighting for Makefile.am files. - * - * - AutotoolsTargetFactory: Our current target is desktop. - * - * - AutotoolsBuildConfigurationFactory: Creates build configurations that - * contain the steps (make, autogen, autoreconf or configure) that will - * be executed in the build process) - */ - -class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AutotoolsProjectManager.json") - - ~AutotoolsProjectPlugin() final; - - void extensionsInitialized() final; - void initialize() final; - - class AutotoolsProjectPluginPrivate *d; -}; - -} // AutotoolsProjectManager::Internal