Autotools: Use new setup scheme for build steps

Change-Id: I4c228a1324e5d426ea2c288f105df2c097a972c7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2024-07-19 14:16:08 +02:00
parent 715240257d
commit e230acbb23
11 changed files with 102 additions and 93 deletions

View File

@@ -8,6 +8,7 @@
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -16,8 +17,6 @@
#include <utils/aspects.h> #include <utils/aspects.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QDateTime>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -109,12 +108,21 @@ Tasking::GroupItem AutogenStep::runRecipe()
* This factory is used to create instances of AutogenStep. * This factory is used to create instances of AutogenStep.
*/ */
AutogenStepFactory::AutogenStepFactory() class AutogenStepFactory final : public BuildStepFactory
{ {
public:
AutogenStepFactory()
{
registerStep<AutogenStep>(Constants::AUTOGEN_STEP_ID); registerStep<AutogenStep>(Constants::AUTOGEN_STEP_ID);
setDisplayName(Tr::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id.")); setDisplayName(Tr::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
};
void setupAutogenStep()
{
static AutogenStepFactory theAutogenStepFactory;
} }
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
class AutogenStepFactory final : public ProjectExplorer::BuildStepFactory void setupAutogenStep();
{
public:
AutogenStepFactory();
};
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -8,6 +8,7 @@
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -99,12 +100,21 @@ private:
* The factory is used to create instances of AutoreconfStep. * The factory is used to create instances of AutoreconfStep.
*/ */
AutoreconfStepFactory::AutoreconfStepFactory() class AutoreconfStepFactory final : public ProjectExplorer::BuildStepFactory
{ {
public:
AutoreconfStepFactory()
{
registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID); registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID);
setDisplayName(Tr::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id.")); setDisplayName(Tr::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
};
void setupAutoreconfStep()
{
static AutoreconfStepFactory theAutoreconfStepFactory;
} }
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
class AutoreconfStepFactory final : public ProjectExplorer::BuildStepFactory void setupAutoreconfStep();
{
public:
AutoreconfStepFactory();
};
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -7,6 +7,7 @@
#include "autotoolsprojectmanagertr.h" #include "autotoolsprojectmanagertr.h"
#include <projectexplorer/buildinfo.h> #include <projectexplorer/buildinfo.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -22,7 +23,7 @@ namespace AutotoolsProjectManager::Internal {
// AutotoolsBuildConfiguration // AutotoolsBuildConfiguration
class AutotoolsBuildConfiguration : public BuildConfiguration class AutotoolsBuildConfiguration final : public BuildConfiguration
{ {
public: public:
AutotoolsBuildConfiguration(Target *target, Id id) AutotoolsBuildConfiguration(Target *target, Id id)
@@ -49,8 +50,11 @@ public:
} }
}; };
AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory() class AutotoolsBuildConfigurationFactory final : public BuildConfigurationFactory
{ {
public:
AutotoolsBuildConfigurationFactory()
{
registerBuildConfiguration<AutotoolsBuildConfiguration> registerBuildConfiguration<AutotoolsBuildConfiguration>
("AutotoolsProjectManager.AutotoolsBuildConfiguration"); ("AutotoolsProjectManager.AutotoolsBuildConfiguration");
@@ -68,6 +72,12 @@ AutotoolsBuildConfigurationFactory::AutotoolsBuildConfigurationFactory()
} }
return QList<BuildInfo>{info}; return QList<BuildInfo>{info};
}); });
}
};
void setupAutotoolsBuildConfiguration()
{
static AutotoolsBuildConfigurationFactory theAutotoolsBuildConfigurationFactory;
} }
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <projectexplorer/buildconfiguration.h>
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
class AutotoolsBuildConfigurationFactory final : public ProjectExplorer::BuildConfigurationFactory void setupAutotoolsBuildConfiguration();
{
public:
AutotoolsBuildConfigurationFactory();
};
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -69,23 +69,11 @@ public:
* - MakefileEditorFactory: Provides a specialized editor with automatic * - MakefileEditorFactory: Provides a specialized editor with automatic
* syntax highlighting for Makefile.am files. * syntax highlighting for Makefile.am files.
* *
* - AutotoolsTargetFactory: Our current target is desktop.
*
* - AutotoolsBuildConfigurationFactory: Creates build configurations that * - AutotoolsBuildConfigurationFactory: Creates build configurations that
* contain the steps (make, autogen, autoreconf or configure) that will * contain the steps (make, autogen, autoreconf or configure) that will
* be executed in the build process) * be executed in the build process)
*/ */
class AutotoolsProjectPluginPrivate
{
public:
AutotoolsBuildConfigurationFactory buildConfigFactory;
MakeStepFactory makeStepFactory;
AutogenStepFactory autogenStepFactory;
ConfigureStepFactory configureStepFactory;
AutoreconfStepFactory autoreconfStepFactory;
};
class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
@@ -94,10 +82,13 @@ class AutotoolsProjectPlugin final : public ExtensionSystem::IPlugin
void initialize() final void initialize() final
{ {
ProjectManager::registerProjectType<AutotoolsProject>(Utils::Constants::MAKEFILE_MIMETYPE); ProjectManager::registerProjectType<AutotoolsProject>(Utils::Constants::MAKEFILE_MIMETYPE);
d = std::make_unique<AutotoolsProjectPluginPrivate>();
}
std::unique_ptr<AutotoolsProjectPluginPrivate> d; setupAutogenStep();
setupConfigureStep();
setupAutoreconfStep();
setupAutotoolsMakeStep();
setupAutotoolsBuildConfiguration();
}
}; };
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -7,6 +7,7 @@
#include "autotoolsprojectmanagertr.h" #include "autotoolsprojectmanagertr.h"
#include <projectexplorer/abstractprocessstep.h> #include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/processparameters.h> #include <projectexplorer/processparameters.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -15,8 +16,6 @@
#include <utils/aspects.h> #include <utils/aspects.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <QDateTime>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -111,12 +110,21 @@ Tasking::GroupItem ConfigureStep::runRecipe()
* The factory is used to create instances of ConfigureStep. * The factory is used to create instances of ConfigureStep.
*/ */
ConfigureStepFactory::ConfigureStepFactory() class ConfigureStepFactory final : public BuildStepFactory
{ {
public:
ConfigureStepFactory()
{
registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID); registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID);
setDisplayName(Tr::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id.")); setDisplayName(Tr::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
}
};
void setupConfigureStep()
{
static ConfigureStepFactory theConfigureStepFactory;
} }
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <projectexplorer/buildstep.h>
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
class ConfigureStepFactory final : public ProjectExplorer::BuildStepFactory void setupConfigureStep();
{
public:
ConfigureStepFactory();
};
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -5,17 +5,20 @@
#include "autotoolsprojectconstants.h" #include "autotoolsprojectconstants.h"
#include <projectexplorer/buildsteplist.h> #include <projectexplorer/buildsteplist.h>
#include <projectexplorer/makestep.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
using namespace ProjectExplorer;
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
// MakeStep // MakeStep
class MakeStep : public ProjectExplorer::MakeStep class AutotoolsMakeStep final : public MakeStep
{ {
public: public:
MakeStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id) AutotoolsMakeStep(BuildStepList *bsl, Utils::Id id)
: ProjectExplorer::MakeStep(bsl, id) : MakeStep(bsl, id)
{ {
setAvailableBuildTargets({"all", "clean"}); setAvailableBuildTargets({"all", "clean"});
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) { if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
@@ -29,11 +32,20 @@ public:
// MakeStepFactory // MakeStepFactory
MakeStepFactory::MakeStepFactory() class MakeStepFactory final : public BuildStepFactory
{ {
registerStep<MakeStep>(Constants::MAKE_STEP_ID); public:
MakeStepFactory()
{
registerStep<AutotoolsMakeStep>(Constants::MAKE_STEP_ID);
setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName()); setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName());
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID); setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
}
};
void setupAutotoolsMakeStep()
{
static MakeStepFactory theAutotoolsMakestepFactory;
} }
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal

View File

@@ -3,14 +3,8 @@
#pragma once #pragma once
#include <projectexplorer/makestep.h>
namespace AutotoolsProjectManager::Internal { namespace AutotoolsProjectManager::Internal {
class MakeStepFactory final : public ProjectExplorer::BuildStepFactory void setupAutotoolsMakeStep();
{
public:
MakeStepFactory();
};
} // AutotoolsProjectManager::Internal } // AutotoolsProjectManager::Internal