forked from qt-creator/qt-creator
AutoTools: Use aspects in build steps
Less code. And there's more room for consolidation. Change-Id: Iccdaf5570155ec2783b7cf6528d3887f6efd5dbb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -26,22 +26,16 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "autogenstep.h"
|
#include "autogenstep.h"
|
||||||
#include "autotoolsproject.h"
|
|
||||||
#include "autotoolsbuildconfiguration.h"
|
|
||||||
#include "autotoolsprojectconstants.h"
|
#include "autotoolsprojectconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
#include <projectexplorer/gnumakeparser.h>
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <QVariantMap>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QFormLayout>
|
|
||||||
|
|
||||||
using namespace AutotoolsProjectManager;
|
using namespace AutotoolsProjectManager;
|
||||||
using namespace AutotoolsProjectManager::Internal;
|
using namespace AutotoolsProjectManager::Internal;
|
||||||
@@ -67,6 +61,12 @@ AutogenStepFactory::AutogenStepFactory()
|
|||||||
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTOGEN_STEP_ID)
|
AutogenStep::AutogenStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTOGEN_STEP_ID)
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Autogen"));
|
setDefaultDisplayName(tr("Autogen"));
|
||||||
|
|
||||||
|
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||||
|
m_additionalArgumentsAspect->setSettingsKey(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY);
|
||||||
|
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||||
|
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||||
|
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutogenStepArgs");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
|
bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
@@ -79,7 +79,7 @@ bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||||
pp->setWorkingDirectory(projectDir);
|
pp->setWorkingDirectory(projectDir);
|
||||||
pp->setCommand("./autogen.sh");
|
pp->setCommand("./autogen.sh");
|
||||||
pp->setArguments(additionalArguments());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
return AbstractProcessStep::init(earlierSteps);
|
return AbstractProcessStep::init(earlierSteps);
|
||||||
@@ -113,80 +113,33 @@ void AutogenStep::run(QFutureInterface<bool> &fi)
|
|||||||
|
|
||||||
BuildStepConfigWidget *AutogenStep::createConfigWidget()
|
BuildStepConfigWidget *AutogenStep::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new AutogenStepConfigWidget(this);
|
auto widget = AbstractProcessStep::createConfigWidget();
|
||||||
|
|
||||||
|
auto updateDetails = [this, widget] {
|
||||||
|
BuildConfiguration *bc = buildConfiguration();
|
||||||
|
|
||||||
|
ProcessParameters param;
|
||||||
|
param.setMacroExpander(bc->macroExpander());
|
||||||
|
param.setEnvironment(bc->environment());
|
||||||
|
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||||
|
param.setWorkingDirectory(projectDir);
|
||||||
|
param.setCommand("./autogen.sh");
|
||||||
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
|
widget->setSummaryText(param.summary(displayName()));
|
||||||
|
};
|
||||||
|
|
||||||
|
updateDetails();
|
||||||
|
|
||||||
|
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [=] {
|
||||||
|
updateDetails();
|
||||||
|
m_runAutogen = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutogenStep::immutable() const
|
bool AutogenStep::immutable() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutogenStep::setAdditionalArguments(const QString &list)
|
|
||||||
{
|
|
||||||
if (list == m_additionalArguments)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_additionalArguments = list;
|
|
||||||
m_runAutogen = true;
|
|
||||||
|
|
||||||
emit additionalArgumentsChanged(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AutogenStep::additionalArguments() const
|
|
||||||
{
|
|
||||||
return m_additionalArguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AutogenStep::toMap() const
|
|
||||||
{
|
|
||||||
QVariantMap map(AbstractProcessStep::toMap());
|
|
||||||
|
|
||||||
map.insert(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AutogenStep::fromMap(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
m_additionalArguments = map.value(AUTOGEN_ADDITIONAL_ARGUMENTS_KEY).toString();
|
|
||||||
|
|
||||||
return BuildStep::fromMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// AutogenStepConfigWidget class
|
|
||||||
//////////////////////////////////
|
|
||||||
AutogenStepConfigWidget::AutogenStepConfigWidget(AutogenStep *autogenStep) :
|
|
||||||
BuildStepConfigWidget(autogenStep),
|
|
||||||
m_autogenStep(autogenStep),
|
|
||||||
m_additionalArguments(new QLineEdit)
|
|
||||||
{
|
|
||||||
QFormLayout *fl = new QFormLayout(this);
|
|
||||||
fl->setMargin(0);
|
|
||||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
setLayout(fl);
|
|
||||||
|
|
||||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
|
||||||
m_additionalArguments->setText(m_autogenStep->additionalArguments());
|
|
||||||
|
|
||||||
updateDetails();
|
|
||||||
|
|
||||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
|
||||||
autogenStep, &AutogenStep::setAdditionalArguments);
|
|
||||||
connect(autogenStep, &AutogenStep::additionalArgumentsChanged,
|
|
||||||
this, &AutogenStepConfigWidget::updateDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutogenStepConfigWidget::updateDetails()
|
|
||||||
{
|
|
||||||
BuildConfiguration *bc = m_autogenStep->buildConfiguration();
|
|
||||||
|
|
||||||
ProcessParameters param;
|
|
||||||
param.setMacroExpander(bc->macroExpander());
|
|
||||||
param.setEnvironment(bc->environment());
|
|
||||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
|
||||||
param.setWorkingDirectory(projectDir);
|
|
||||||
param.setCommand("./autogen.sh");
|
|
||||||
param.setArguments(m_autogenStep->additionalArguments());
|
|
||||||
|
|
||||||
setSummaryText(param.summary(displayName()));
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -28,18 +28,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/abstractprocessstep.h>
|
#include <projectexplorer/abstractprocessstep.h>
|
||||||
|
#include <projectexplorer/projectconfigurationaspects.h>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QLineEdit;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AutotoolsProject;
|
|
||||||
class AutogenStep;
|
|
||||||
class AutogenStepConfigWidget;
|
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// AutogenStepFactory class
|
// AutogenStepFactory class
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
@@ -63,16 +56,12 @@ public:
|
|||||||
* A autogen step can be configured by selecting the "Projects" button of Qt Creator
|
* A autogen step can be configured by selecting the "Projects" button of Qt Creator
|
||||||
* (in the left hand side menu) and under "Build Settings".
|
* (in the left hand side menu) and under "Build Settings".
|
||||||
*
|
*
|
||||||
* It is possible for the user to specify custom arguments. The corresponding
|
* It is possible for the user to specify custom arguments.
|
||||||
* configuration widget is created by AutogenStep::createConfigWidget and is
|
|
||||||
* represented by an instance of the class AutogenStepConfigWidget.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AutogenStep : public ProjectExplorer::AbstractProcessStep
|
class AutogenStep : public ProjectExplorer::AbstractProcessStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class AutogenStepFactory;
|
|
||||||
friend class AutogenStepConfigWidget;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutogenStep(ProjectExplorer::BuildStepList *bsl);
|
explicit AutogenStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
@@ -81,42 +70,11 @@ public:
|
|||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||||
bool immutable() const override;
|
bool immutable() const override;
|
||||||
QString additionalArguments() const;
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
void setAdditionalArguments(const QString &list);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void additionalArgumentsChanged(const QString &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||||
|
|
||||||
QString m_additionalArguments;
|
|
||||||
bool m_runAutogen = false;
|
bool m_runAutogen = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// AutogenStepConfigWidget class
|
|
||||||
//////////////////////////////////
|
|
||||||
/**
|
|
||||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
|
||||||
*
|
|
||||||
* Allows to configure a autogen step in the GUI.
|
|
||||||
*/
|
|
||||||
class AutogenStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AutogenStepConfigWidget(AutogenStep *autogenStep);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateDetails();
|
|
||||||
|
|
||||||
AutogenStep *m_autogenStep;
|
|
||||||
QLineEdit *m_additionalArguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace AutotoolsProjectManager
|
} // namespace AutotoolsProjectManager
|
||||||
|
|||||||
@@ -26,28 +26,20 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "autoreconfstep.h"
|
#include "autoreconfstep.h"
|
||||||
#include "autotoolsproject.h"
|
|
||||||
#include "autotoolsbuildconfiguration.h"
|
|
||||||
#include "autotoolsprojectconstants.h"
|
#include "autotoolsprojectconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
#include <projectexplorer/gnumakeparser.h>
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <QVariantMap>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QFormLayout>
|
|
||||||
|
|
||||||
using namespace AutotoolsProjectManager;
|
using namespace AutotoolsProjectManager;
|
||||||
using namespace AutotoolsProjectManager::Internal;
|
using namespace AutotoolsProjectManager::Internal;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
|
const char AUTORECONF_STEP_ID[] = "AutotoolsProjectManager.AutoreconfStep";
|
||||||
const char AUTORECONF_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutoreconfStep.AdditionalArguments";
|
|
||||||
|
|
||||||
|
|
||||||
// AutoreconfStepFactory class
|
// AutoreconfStepFactory class
|
||||||
@@ -66,6 +58,13 @@ AutoreconfStepFactory::AutoreconfStepFactory()
|
|||||||
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTORECONF_STEP_ID)
|
AutoreconfStep::AutoreconfStep(BuildStepList *bsl) : AbstractProcessStep(bsl, AUTORECONF_STEP_ID)
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Autoreconf"));
|
setDefaultDisplayName(tr("Autoreconf"));
|
||||||
|
|
||||||
|
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||||
|
m_additionalArgumentsAspect->setSettingsKey("AutotoolsProjectManager.AutoreconfStep.AdditionalArguments");
|
||||||
|
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||||
|
m_additionalArgumentsAspect->setValue("--force --install");
|
||||||
|
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||||
|
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.AutoreconfStepArgs");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
|
bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
@@ -78,7 +77,7 @@ bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||||
pp->setWorkingDirectory(projectDir);
|
pp->setWorkingDirectory(projectDir);
|
||||||
pp->setCommand("autoreconf");
|
pp->setCommand("autoreconf");
|
||||||
pp->setArguments(additionalArguments());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
return AbstractProcessStep::init(earlierSteps);
|
return AbstractProcessStep::init(earlierSteps);
|
||||||
@@ -106,80 +105,33 @@ void AutoreconfStep::run(QFutureInterface<bool> &fi)
|
|||||||
|
|
||||||
BuildStepConfigWidget *AutoreconfStep::createConfigWidget()
|
BuildStepConfigWidget *AutoreconfStep::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new AutoreconfStepConfigWidget(this);
|
auto widget = AbstractProcessStep::createConfigWidget();
|
||||||
|
|
||||||
|
auto updateDetails = [this, widget] {
|
||||||
|
BuildConfiguration *bc = buildConfiguration();
|
||||||
|
|
||||||
|
ProcessParameters param;
|
||||||
|
param.setMacroExpander(bc->macroExpander());
|
||||||
|
param.setEnvironment(bc->environment());
|
||||||
|
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||||
|
param.setWorkingDirectory(projectDir);
|
||||||
|
param.setCommand("autoreconf");
|
||||||
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
|
widget->setSummaryText(param.summary(displayName()));
|
||||||
|
};
|
||||||
|
|
||||||
|
updateDetails();
|
||||||
|
|
||||||
|
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [=] {
|
||||||
|
updateDetails();
|
||||||
|
m_runAutoreconf = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
return widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AutoreconfStep::immutable() const
|
bool AutoreconfStep::immutable() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoreconfStep::setAdditionalArguments(const QString &list)
|
|
||||||
{
|
|
||||||
if (list == m_additionalArguments)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_additionalArguments = list;
|
|
||||||
m_runAutoreconf = true;
|
|
||||||
|
|
||||||
emit additionalArgumentsChanged(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AutoreconfStep::additionalArguments() const
|
|
||||||
{
|
|
||||||
return m_additionalArguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap AutoreconfStep::toMap() const
|
|
||||||
{
|
|
||||||
QVariantMap map = AbstractProcessStep::toMap();
|
|
||||||
|
|
||||||
map.insert(AUTORECONF_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AutoreconfStep::fromMap(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
m_additionalArguments = map.value(AUTORECONF_ADDITIONAL_ARGUMENTS_KEY).toString();
|
|
||||||
|
|
||||||
return BuildStep::fromMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// AutoreconfStepConfigWidget class
|
|
||||||
//////////////////////////////////////
|
|
||||||
AutoreconfStepConfigWidget::AutoreconfStepConfigWidget(AutoreconfStep *autoreconfStep) :
|
|
||||||
BuildStepConfigWidget(autoreconfStep),
|
|
||||||
m_autoreconfStep(autoreconfStep),
|
|
||||||
m_additionalArguments(new QLineEdit(this))
|
|
||||||
{
|
|
||||||
QFormLayout *fl = new QFormLayout(this);
|
|
||||||
fl->setMargin(0);
|
|
||||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
setLayout(fl);
|
|
||||||
|
|
||||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
|
||||||
m_additionalArguments->setText(m_autoreconfStep->additionalArguments());
|
|
||||||
|
|
||||||
updateDetails();
|
|
||||||
|
|
||||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
|
||||||
autoreconfStep, &AutoreconfStep::setAdditionalArguments);
|
|
||||||
connect(autoreconfStep, &AutoreconfStep::additionalArgumentsChanged,
|
|
||||||
this, &AutoreconfStepConfigWidget::updateDetails);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutoreconfStepConfigWidget::updateDetails()
|
|
||||||
{
|
|
||||||
BuildConfiguration *bc = m_autoreconfStep->buildConfiguration();
|
|
||||||
|
|
||||||
ProcessParameters param;
|
|
||||||
param.setMacroExpander(bc->macroExpander());
|
|
||||||
param.setEnvironment(bc->environment());
|
|
||||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
|
||||||
param.setWorkingDirectory(projectDir);
|
|
||||||
param.setCommand("autoreconf");
|
|
||||||
param.setArguments(m_autoreconfStep->additionalArguments());
|
|
||||||
|
|
||||||
setSummaryText(param.summary(displayName()));
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -28,17 +28,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/abstractprocessstep.h>
|
#include <projectexplorer/abstractprocessstep.h>
|
||||||
|
#include <projectexplorer/projectconfigurationaspects.h>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QLineEdit;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AutotoolsProject;
|
|
||||||
class AutoreconfStep;
|
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
// AutoreconfStepFactory class
|
// AutoreconfStepFactory class
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
@@ -62,16 +56,12 @@ public:
|
|||||||
* A autoreconf step can be configured by selecting the "Projects" button
|
* A autoreconf step can be configured by selecting the "Projects" button
|
||||||
* of Qt Creator (in the left hand side menu) and under "Build Settings".
|
* of Qt Creator (in the left hand side menu) and under "Build Settings".
|
||||||
*
|
*
|
||||||
* It is possible for the user to specify custom arguments. The corresponding
|
* It is possible for the user to specify custom arguments.
|
||||||
* configuration widget is created by AutoreconfStep::createConfigWidget and is
|
|
||||||
* represented by an instance of the class AutoreconfStepConfigWidget.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AutoreconfStep : public ProjectExplorer::AbstractProcessStep
|
class AutoreconfStep : public ProjectExplorer::AbstractProcessStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class AutoreconfStepFactory;
|
|
||||||
friend class AutoreconfStepConfigWidget;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AutoreconfStep(ProjectExplorer::BuildStepList *bsl);
|
explicit AutoreconfStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
@@ -80,42 +70,11 @@ public:
|
|||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||||
bool immutable() const override;
|
bool immutable() const override;
|
||||||
QString additionalArguments() const;
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
void setAdditionalArguments(const QString &list);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void additionalArgumentsChanged(const QString &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||||
|
|
||||||
QString m_additionalArguments;
|
|
||||||
bool m_runAutoreconf = false;
|
bool m_runAutoreconf = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////
|
|
||||||
// AutoreconfStepConfigWidget class
|
|
||||||
//////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
|
||||||
*
|
|
||||||
* Allows to configure a autoreconf step in the GUI..
|
|
||||||
*/
|
|
||||||
class AutoreconfStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AutoreconfStepConfigWidget(AutoreconfStep *autoreconfStep);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateDetails();
|
|
||||||
|
|
||||||
AutoreconfStep *m_autoreconfStep;
|
|
||||||
QLineEdit *m_additionalArguments;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace AutotoolsProjectManager
|
} // namespace AutotoolsProjectManager
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo *info)
|
|||||||
buildSteps->insertStep(0, autogenStep);
|
buildSteps->insertStep(0, autogenStep);
|
||||||
} else {
|
} else {
|
||||||
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
|
AutoreconfStep *autoreconfStep = new AutoreconfStep(buildSteps);
|
||||||
autoreconfStep->setAdditionalArguments("--force --install");
|
|
||||||
buildSteps->insertStep(0, autoreconfStep);
|
buildSteps->insertStep(0, autoreconfStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,12 @@ ConfigureStepFactory::ConfigureStepFactory()
|
|||||||
ConfigureStep::ConfigureStep(BuildStepList *bsl) : AbstractProcessStep(bsl, CONFIGURE_STEP_ID)
|
ConfigureStep::ConfigureStep(BuildStepList *bsl) : AbstractProcessStep(bsl, CONFIGURE_STEP_ID)
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(tr("Configure"));
|
setDefaultDisplayName(tr("Configure"));
|
||||||
|
|
||||||
|
m_additionalArgumentsAspect = addAspect<BaseStringAspect>();
|
||||||
|
m_additionalArgumentsAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||||
|
m_additionalArgumentsAspect->setSettingsKey(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY);
|
||||||
|
m_additionalArgumentsAspect->setLabelText(tr("Arguments:"));
|
||||||
|
m_additionalArgumentsAspect->setHistoryCompleter("AutotoolsPM.History.ConfigureArgs");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
|
bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
|
||||||
@@ -92,7 +98,7 @@ bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
pp->setEnvironment(bc->environment());
|
pp->setEnvironment(bc->environment());
|
||||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
pp->setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
pp->setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||||
pp->setArguments(additionalArguments());
|
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
return AbstractProcessStep::init(earlierSteps);
|
return AbstractProcessStep::init(earlierSteps);
|
||||||
@@ -124,7 +130,16 @@ void ConfigureStep::run(QFutureInterface<bool>& fi)
|
|||||||
|
|
||||||
BuildStepConfigWidget *ConfigureStep::createConfigWidget()
|
BuildStepConfigWidget *ConfigureStep::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new ConfigureStepConfigWidget(this);
|
m_widget = AbstractProcessStep::createConfigWidget();
|
||||||
|
|
||||||
|
updateDetails();
|
||||||
|
|
||||||
|
connect(m_additionalArgumentsAspect, &ProjectConfigurationAspect::changed, this, [this] {
|
||||||
|
m_runConfigure = true;
|
||||||
|
updateDetails();
|
||||||
|
});
|
||||||
|
|
||||||
|
return m_widget.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigureStep::immutable() const
|
bool ConfigureStep::immutable() const
|
||||||
@@ -132,78 +147,24 @@ bool ConfigureStep::immutable() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureStep::setAdditionalArguments(const QString &list)
|
|
||||||
{
|
|
||||||
if (list == m_additionalArguments)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_additionalArguments = list;
|
|
||||||
m_runConfigure = true;
|
|
||||||
|
|
||||||
emit additionalArgumentsChanged(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigureStep::notifyBuildDirectoryChanged()
|
void ConfigureStep::notifyBuildDirectoryChanged()
|
||||||
{
|
{
|
||||||
emit buildDirectoryChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ConfigureStep::additionalArguments() const
|
|
||||||
{
|
|
||||||
return m_additionalArguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap ConfigureStep::toMap() const
|
|
||||||
{
|
|
||||||
QVariantMap map = AbstractProcessStep::toMap();
|
|
||||||
|
|
||||||
map.insert(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY, m_additionalArguments);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConfigureStep::fromMap(const QVariantMap &map)
|
|
||||||
{
|
|
||||||
m_additionalArguments = map.value(CONFIGURE_ADDITIONAL_ARGUMENTS_KEY).toString();
|
|
||||||
|
|
||||||
return BuildStep::fromMap(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
|
||||||
// ConfigureStepConfigWidget class
|
|
||||||
/////////////////////////////////////
|
|
||||||
ConfigureStepConfigWidget::ConfigureStepConfigWidget(ConfigureStep *configureStep) :
|
|
||||||
BuildStepConfigWidget(configureStep),
|
|
||||||
m_configureStep(configureStep),
|
|
||||||
m_additionalArguments(new QLineEdit)
|
|
||||||
{
|
|
||||||
QFormLayout *fl = new QFormLayout(this);
|
|
||||||
fl->setMargin(0);
|
|
||||||
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
|
||||||
setLayout(fl);
|
|
||||||
|
|
||||||
fl->addRow(tr("Arguments:"), m_additionalArguments);
|
|
||||||
m_additionalArguments->setText(m_configureStep->additionalArguments());
|
|
||||||
|
|
||||||
updateDetails();
|
updateDetails();
|
||||||
|
|
||||||
connect(m_additionalArguments, &QLineEdit::textChanged,
|
|
||||||
configureStep, &ConfigureStep::setAdditionalArguments);
|
|
||||||
connect(configureStep, &ConfigureStep::additionalArgumentsChanged,
|
|
||||||
this, &ConfigureStepConfigWidget::updateDetails);
|
|
||||||
connect(configureStep, &ConfigureStep::buildDirectoryChanged,
|
|
||||||
this, &ConfigureStepConfigWidget::updateDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureStepConfigWidget::updateDetails()
|
void ConfigureStep::updateDetails()
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = m_configureStep->buildConfiguration();
|
if (!m_widget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BuildConfiguration *bc = buildConfiguration();
|
||||||
|
|
||||||
ProcessParameters param;
|
ProcessParameters param;
|
||||||
param.setMacroExpander(bc->macroExpander());
|
param.setMacroExpander(bc->macroExpander());
|
||||||
param.setEnvironment(bc->environment());
|
param.setEnvironment(bc->environment());
|
||||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||||
param.setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
param.setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||||
param.setArguments(m_configureStep->additionalArguments());
|
param.setArguments(m_additionalArgumentsAspect->value());
|
||||||
|
|
||||||
setSummaryText(param.summaryInWorkdir(displayName()));
|
m_widget->setSummaryText(param.summaryInWorkdir(displayName()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,17 +28,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/abstractprocessstep.h>
|
#include <projectexplorer/abstractprocessstep.h>
|
||||||
|
#include <projectexplorer/projectconfigurationaspects.h>
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QLineEdit;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace AutotoolsProjectManager {
|
namespace AutotoolsProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class AutotoolsProject;
|
|
||||||
class ConfigureStepConfigWidget;
|
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// ConfigureStepFactory Class
|
// ConfigureStepFactory Class
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
@@ -69,8 +63,6 @@ public:
|
|||||||
class ConfigureStep : public ProjectExplorer::AbstractProcessStep
|
class ConfigureStep : public ProjectExplorer::AbstractProcessStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class ConfigureStepFactory;
|
|
||||||
friend class ConfigureStepConfigWidget;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigureStep(ProjectExplorer::BuildStepList *bsl);
|
explicit ConfigureStep(ProjectExplorer::BuildStepList *bsl);
|
||||||
@@ -79,43 +71,16 @@ public:
|
|||||||
void run(QFutureInterface<bool> &fi) override;
|
void run(QFutureInterface<bool> &fi) override;
|
||||||
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||||
bool immutable() const override;
|
bool immutable() const override;
|
||||||
QString additionalArguments() const;
|
|
||||||
QVariantMap toMap() const override;
|
|
||||||
|
|
||||||
void setAdditionalArguments(const QString &list);
|
void setAdditionalArguments(const QString &list);
|
||||||
void notifyBuildDirectoryChanged();
|
void notifyBuildDirectoryChanged();
|
||||||
|
|
||||||
signals:
|
|
||||||
void additionalArgumentsChanged(const QString &);
|
|
||||||
void buildDirectoryChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
|
||||||
|
|
||||||
QString m_additionalArguments;
|
|
||||||
bool m_runConfigure = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////////////
|
|
||||||
// ConfigureStepConfigWidget class
|
|
||||||
/////////////////////////////////////
|
|
||||||
/**
|
|
||||||
* @brief Implementation of the ProjectExplorer::BuildStepConfigWidget interface.
|
|
||||||
*
|
|
||||||
* Allows to configure a configure step in the GUI.
|
|
||||||
*/
|
|
||||||
class ConfigureStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ConfigureStepConfigWidget(ConfigureStep *configureStep);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDetails();
|
void updateDetails();
|
||||||
|
|
||||||
ConfigureStep *m_configureStep;
|
ProjectExplorer::BaseStringAspect *m_additionalArgumentsAspect = nullptr;
|
||||||
QLineEdit *m_additionalArguments;
|
bool m_runConfigure = false;
|
||||||
|
QPointer<ProjectExplorer::BuildStepConfigWidget> m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user