AutoTools: Prefer build step ids for setting up the build configuration

Essentially a proof-of-concept that knowing the actual classes is
not needed.

Change-Id: I82b1664c93a25e418860bda77f66ec77144cf658
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-26 12:48:53 +02:00
parent 7ebfa87dc2
commit 5d6c84777a
6 changed files with 30 additions and 38 deletions

View File

@@ -43,15 +43,12 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
using namespace Utils;
const char AUTOGEN_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutogenStep.AdditionalArguments";
const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
// AutogenStepFactory
AutogenStepFactory::AutogenStepFactory()
{
registerStep<AutogenStep>(AUTOGEN_STEP_ID);
registerStep<AutogenStep>(Constants::AUTOGEN_STEP_ID);
setDisplayName(AutogenStep::tr("Autogen", "Display name for AutotoolsProjectManager::AutogenStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -60,12 +57,13 @@ AutogenStepFactory::AutogenStepFactory()
// AutogenStep
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTOGEN_STEP_ID)
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Constants::AUTOGEN_STEP_ID)
{
setDefaultDisplayName(tr("Autogen"));
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
m_additionalArgumentsAspect->setSettingsKey(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY);
m_additionalArgumentsAspect->setSettingsKey(
"AutotoolsProjectManager.AutogenStep.AdditionalArguments");
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");

View File

@@ -40,14 +40,11 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
// AutoreconfStepFactory class
AutoreconfStepFactory::AutoreconfStepFactory()
{
registerStep<AutoreconfStep>(AUTORECONF_STEP_ID);
registerStep<AutoreconfStep>(Constants::AUTORECONF_STEP_ID);
setDisplayName(AutoreconfStep::tr("Autoreconf", "Display name for AutotoolsProjectManager::AutoreconfStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -56,7 +53,8 @@ AutoreconfStepFactory::AutoreconfStepFactory()
// AutoreconfStep class
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTORECONF_STEP_ID)
AutoreconfStep::AutoreconfStep(BuildStepList *bsl)
: AbstractProcessStep(bsl, Constants::AUTORECONF_STEP_ID)
{
setDefaultDisplayName(tr("Autoreconf"));

View File

@@ -26,12 +26,9 @@
****************************************************************************/
#include "autotoolsbuildconfiguration.h"
#include "makestep.h"
#include "autotoolsproject.h"
#include "autotoolsprojectconstants.h"
#include "autogenstep.h"
#include "autoreconfstep.h"
#include "configurestep.h"
#include <coreplugin/icore.h>
#include <projectexplorer/buildinfo.h>
@@ -72,26 +69,20 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo &info)
// ### Build Steps Build ###
// autogen.sh or autoreconf
QFile autogenFile(target()->project()->projectDirectory().toString() + "/autogen.sh");
if (autogenFile.exists()) {
auto autogenStep = new AutogenStep(buildSteps);
buildSteps->appendStep(autogenStep);
} else {
auto autoreconfStep = new AutoreconfStep(buildSteps);
buildSteps->appendStep(autoreconfStep);
}
if (autogenFile.exists())
buildSteps->appendStep(Constants::AUTOGEN_STEP_ID);
else
buildSteps->appendStep(Constants::AUTORECONF_STEP_ID);
// ./configure.
auto configureStep = new ConfigureStep(buildSteps);
buildSteps->appendStep(configureStep);
buildSteps->appendStep(Constants::CONFIGURE_STEP_ID);
// make
auto makeStep = new MakeStep(buildSteps);
buildSteps->appendStep(makeStep);
buildSteps->appendStep(Constants::MAKE_STEP_ID);
// ### Build Steps Clean ###
BuildStepList *cleanSteps = stepList(BUILDSTEPS_CLEAN);
auto cleanMakeStep = new MakeStep(cleanSteps);
cleanSteps->appendStep(cleanMakeStep);
cleanSteps->appendStep(Constants::MAKE_STEP_ID);
}

View File

@@ -32,9 +32,17 @@ namespace AutotoolsProjectManager {
* Collects project constants, that are shared between several classes.
*/
namespace Constants {
const char MAKEFILE_MIMETYPE[] = "text/x-makefile";
const char MAKEFILE_MIMETYPE[] = "text/x-makefile";
// Steps
const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep";
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
const char CONFIGURE_STEP_ID[] = "AutotoolsProjectManager.ConfigureStep";
const char MAKE_STEP_ID[] = "AutotoolsProjectManager.MakeStep";
//Project
const char AUTOTOOLS_PROJECT_ID[] = "AutotoolsProjectManager.AutotoolsProject";
const char AUTOTOOLS_PROJECT_ID[] = "AutotoolsProjectManager.AutotoolsProject";
} // namespace Constants
} // namespace AutotoolsProjectManager

View File

@@ -49,9 +49,6 @@ using namespace AutotoolsProjectManager::Internal;
using namespace ProjectExplorer;
using namespace Utils;
const char CONFIGURE_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.ConfigureStep.AdditionalArguments";
const char CONFIGURE_STEP_ID[] = "AutotoolsProjectManager.ConfigureStep";
/////////////////////
// Helper Function
/////////////////////
@@ -71,7 +68,7 @@ static QString projectDirRelativeToBuildDir(BuildConfiguration *bc) {
ConfigureStepFactory::ConfigureStepFactory()
{
registerStep<ConfigureStep>(CONFIGURE_STEP_ID);
registerStep<ConfigureStep>(Constants::CONFIGURE_STEP_ID);
setDisplayName(ConfigureStep::tr("Configure", "Display name for AutotoolsProjectManager::ConfigureStep id."));
setSupportedProjectType(Constants::AUTOTOOLS_PROJECT_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -80,13 +77,15 @@ ConfigureStepFactory::ConfigureStepFactory()
// ConfigureStep
ConfigureStep::ConfigureStep(BuildStepList *bsl) : AbstractProcessStep(bsl, CONFIGURE_STEP_ID)
ConfigureStep::ConfigureStep(BuildStepList *bsl)
: AbstractProcessStep(bsl, Constants::CONFIGURE_STEP_ID)
{
setDefaultDisplayName(tr("Configure"));
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
m_additionalArgumentsAspect->setSettingsKey(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY);
m_additionalArgumentsAspect->setSettingsKey(
"AutotoolsProjectManager.ConfigureStep.AdditionalArguments");
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");

View File

@@ -37,8 +37,6 @@ using namespace AutotoolsProjectManager;
using namespace AutotoolsProjectManager::Internal;
using namespace AutotoolsProjectManager::Constants;
const char MAKE_STEP_ID[] = "AutotoolsProjectManager.MakeStep";
// MakeStepFactory
MakeStepFactory::MakeStepFactory()