From e53bc1630a503848236ddc3f26919bd031b848b0 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 29 Jun 2023 18:00:06 +0200 Subject: [PATCH] AutoTools: Use direct aspect registration in AutoreconfStep Task-number: QTCREATORBUG-29168 Change-Id: I886e84a752031cabb8bf235dc4e83c8f78ae88cb Reviewed-by: Christian Stenger --- .../autoreconfstep.cpp | 90 +++++++++---------- 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index a238f41b688..a32191be83b 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include @@ -34,58 +33,55 @@ namespace AutotoolsProjectManager::Internal { class AutoreconfStep final : public AbstractProcessStep { public: - AutoreconfStep(BuildStepList *bsl, Id id); + AutoreconfStep(BuildStepList *bsl, Id id) + : AbstractProcessStep(bsl, id) + { + arguments.setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments"); + arguments.setLabelText(Tr::tr("Arguments:")); + arguments.setValue("--force --install"); + arguments.setDisplayStyle(StringAspect::LineEditDisplay); + arguments.setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs"); - void doRun() override; + connect(&arguments, &BaseAspect::changed, this, [this] { m_runAutoreconf = true; }); + + setCommandLineProvider([this] { + return CommandLine("autoreconf", arguments(), CommandLine::Raw); + }); + + setWorkingDirectoryProvider([this] { + return project()->projectDirectory(); + }); + + setSummaryUpdater([this] { + ProcessParameters param; + setupProcessParameters(¶m); + return param.summary(displayName()); + }); + } + + void doRun() override + { + // Check whether we need to run autoreconf + const FilePath configure = project()->projectDirectory() / "configure"; + if (!configure.exists()) + m_runAutoreconf = true; + + if (!m_runAutoreconf) { + emit addOutput(Tr::tr("Configuration unchanged, skipping autoreconf step."), + OutputFormat::NormalMessage); + emit finished(true); + return; + } + + m_runAutoreconf = false; + AbstractProcessStep::doRun(); + } private: bool m_runAutoreconf = false; + StringAspect arguments{this}; }; -AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Id id) - : AbstractProcessStep(bsl, id) -{ - auto arguments = addAspect(); - arguments->setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments"); - arguments->setLabelText(Tr::tr("Arguments:")); - arguments->setValue("--force --install"); - arguments->setDisplayStyle(StringAspect::LineEditDisplay); - arguments->setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs"); - - connect(arguments, &BaseAspect::changed, this, [this] { - m_runAutoreconf = true; - }); - - setCommandLineProvider([arguments] { - return CommandLine("autoreconf", arguments->value(), CommandLine::Raw); - }); - - setWorkingDirectoryProvider([this] { return project()->projectDirectory(); }); - - setSummaryUpdater([this] { - ProcessParameters param; - setupProcessParameters(¶m); - return param.summary(displayName()); - }); -} - -void AutoreconfStep::doRun() -{ - // Check whether we need to run autoreconf - const FilePath configure = project()->projectDirectory() / "configure"; - if (!configure.exists()) - m_runAutoreconf = true; - - if (!m_runAutoreconf) { - emit addOutput(Tr::tr("Configuration unchanged, skipping autoreconf step."), - OutputFormat::NormalMessage); - emit finished(true); - return; - } - - m_runAutoreconf = false; - AbstractProcessStep::doRun(); -} // AutoreconfStepFactory