From 8471ce4331ec06e7dc6060014e0d6c35e34a78bc Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 22 Oct 2018 18:09:56 +0200 Subject: [PATCH] Autotools: Simplify make step setup The extra inheritance level is not needed (and used nowhere else), and all special default arguments can be determined from the kind of build list. Change-Id: I5ab9987d7b1fd8e5999b7c4c8796c2c24db03821 Reviewed-by: Christian Stenger --- .../autotoolsbuildconfiguration.cpp | 5 ++-- .../autotoolsprojectmanager/makestep.cpp | 25 +++++++------------ .../autotoolsprojectmanager/makestep.h | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp index 64d026f9d16..e303da1c9d8 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp @@ -88,13 +88,12 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo *info) configureStep, &ConfigureStep::notifyBuildDirectoryChanged); // make - MakeStep *makeStep = new MakeStep(buildSteps, "all"); + MakeStep *makeStep = new MakeStep(buildSteps); buildSteps->appendStep(makeStep); // ### Build Steps Clean ### BuildStepList *cleanSteps = stepList(BUILDSTEPS_CLEAN); - MakeStep *cleanMakeStep = new MakeStep(cleanSteps, "clean"); - cleanMakeStep->setClean(true); + MakeStep *cleanMakeStep = new MakeStep(cleanSteps); cleanSteps->appendStep(cleanMakeStep); } diff --git a/src/plugins/autotoolsprojectmanager/makestep.cpp b/src/plugins/autotoolsprojectmanager/makestep.cpp index 315d235c9bb..f8f3fb2596f 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.cpp +++ b/src/plugins/autotoolsprojectmanager/makestep.cpp @@ -43,27 +43,20 @@ const char MAKE_STEP_ID[] = "AutotoolsProjectManager.MakeStep"; MakeStepFactory::MakeStepFactory() { - struct Step : public MakeStep - { - Step(ProjectExplorer::BuildStepList *bsl) : MakeStep(bsl) - { - if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) { - setBuildTarget("clean", true); - setClean(true); - } else { - setBuildTarget("all", true); - } - } - }; - - registerStep(MAKE_STEP_ID); + registerStep(MAKE_STEP_ID); setDisplayName(ProjectExplorer::MakeStep::defaultDisplayName()); setSupportedProjectType(AUTOTOOLS_PROJECT_ID); } // MakeStep -MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl, const QString &buildTarget) - : ProjectExplorer::MakeStep(bsl, MAKE_STEP_ID, buildTarget, {"all", "clean"}) +MakeStep::MakeStep(ProjectExplorer::BuildStepList *bsl) + : ProjectExplorer::MakeStep(bsl, MAKE_STEP_ID, QString(), {"all", "clean"}) { + if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) { + setBuildTarget("clean", true); + setClean(true); + } else { + setBuildTarget("all", true); + } } diff --git a/src/plugins/autotoolsprojectmanager/makestep.h b/src/plugins/autotoolsprojectmanager/makestep.h index f738fd10576..77bc2c0be23 100644 --- a/src/plugins/autotoolsprojectmanager/makestep.h +++ b/src/plugins/autotoolsprojectmanager/makestep.h @@ -49,7 +49,7 @@ class MakeStep : public ProjectExplorer::MakeStep Q_OBJECT public: - explicit MakeStep(ProjectExplorer::BuildStepList *bsl, const QString &buildTarget = QString()); + explicit MakeStep(ProjectExplorer::BuildStepList *bsl); }; } // namespace Internal