Autotools: Streamline plugin setup

Change-Id: I1a2ac742a3ac055c313d3af0a7173e380ca6070a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-07-05 12:20:59 +02:00
parent 10d96d8e22
commit 890cc2ba76
4 changed files with 50 additions and 78 deletions

View File

@@ -8,7 +8,7 @@ add_qtc_plugin(AutotoolsProjectManager
autotoolsbuildsystem.cpp autotoolsbuildsystem.h autotoolsbuildsystem.cpp autotoolsbuildsystem.h
autotoolsprojectconstants.h autotoolsprojectconstants.h
autotoolsprojectmanagertr.h autotoolsprojectmanagertr.h
autotoolsprojectplugin.cpp autotoolsprojectplugin.h autotoolsprojectplugin.cpp
configurestep.cpp configurestep.h configurestep.cpp configurestep.h
makefileparser.cpp makefileparser.h makefileparser.cpp makefileparser.h
makefileparserthread.cpp makefileparserthread.h makefileparserthread.cpp makefileparserthread.h

View File

@@ -23,7 +23,6 @@ QtcPlugin {
"autotoolsprojectconstants.h", "autotoolsprojectconstants.h",
"autotoolsprojectmanagertr.h", "autotoolsprojectmanagertr.h",
"autotoolsprojectplugin.cpp", "autotoolsprojectplugin.cpp",
"autotoolsprojectplugin.h",
"configurestep.cpp", "configurestep.cpp",
"configurestep.h", "configurestep.h",
"makefileparser.cpp", "makefileparser.cpp",

View File

@@ -1,8 +1,6 @@
// Copyright (C) 2016 Openismus GmbH. // Copyright (C) 2016 Openismus GmbH.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "autotoolsprojectplugin.h"
#include "autogenstep.h" #include "autogenstep.h"
#include "autoreconfstep.h" #include "autoreconfstep.h"
#include "autotoolsbuildconfiguration.h" #include "autotoolsbuildconfiguration.h"
@@ -18,6 +16,10 @@
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <extensionsystem/iplugin.h>
using namespace ProjectExplorer;
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
/** /**
@@ -28,7 +30,7 @@ namespace AutotoolsProjectManager::Internal {
* It is responsible to parse the Makefile.am files and do trigger project * 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. * updates if a Makefile.am file or a configure.ac file has been changed.
*/ */
class AutotoolsProject : public ProjectExplorer::Project class AutotoolsProject : public Project
{ {
public: public:
explicit AutotoolsProject(const Utils::FilePath &fileName) explicit AutotoolsProject(const Utils::FilePath &fileName)
@@ -40,33 +42,55 @@ public:
setHasMakeInstallEquivalent(true); 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: Q_OBJECT
AutotoolsBuildConfigurationFactory buildConfigurationFactory; Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AutotoolsProjectManager.json")
MakeStepFactory makeStepFaactory;
AutogenStepFactory autogenStepFactory; void initialize() final
ConfigureStepFactory configureStepFactory; {
AutoreconfStepFactory autoreconfStepFactory; ProjectManager::registerProjectType<AutotoolsProject>(Constants::MAKEFILE_MIMETYPE);
addManaged<AutotoolsBuildConfigurationFactory>();
addManaged<MakeStepFactory>();
addManaged<AutogenStepFactory>();
addManaged<ConfigureStepFactory>();
addManaged<AutoreconfStepFactory>();
}
}; };
AutotoolsProjectPlugin::~AutotoolsProjectPlugin()
{
delete d;
}
void AutotoolsProjectPlugin::extensionsInitialized()
{ }
void AutotoolsProjectPlugin::initialize()
{
d = new AutotoolsProjectPluginPrivate;
ProjectExplorer::ProjectManager::registerProjectType<AutotoolsProject>(Constants::MAKEFILE_MIMETYPE);
}
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal
#include "autotoolsprojectplugin.moc"

View File

@@ -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 <extensionsystem/iplugin.h>
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