forked from qt-creator/qt-creator
Qmake: Use aspects more directly in QmakeStep
Change-Id: I3b9d081d9c7cb918d2a475a9dc7554c67d2e1c13 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -104,7 +104,7 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id)
|
|||||||
appendInitialCleanStep(Constants::MAKESTEP_BS_ID);
|
appendInitialCleanStep(Constants::MAKESTEP_BS_ID);
|
||||||
|
|
||||||
setInitializer([this, target](const BuildInfo &info) {
|
setInitializer([this, target](const BuildInfo &info) {
|
||||||
auto qmakeStep = buildSteps()->firstOfType<QMakeStep>();
|
QMakeStep *qmakeStep = buildSteps()->firstOfType<QMakeStep>();
|
||||||
QTC_ASSERT(qmakeStep, return);
|
QTC_ASSERT(qmakeStep, return);
|
||||||
|
|
||||||
const QmakeExtraBuildInfo qmakeExtra = info.extraInfo.value<QmakeExtraBuildInfo>();
|
const QmakeExtraBuildInfo qmakeExtra = info.extraInfo.value<QmakeExtraBuildInfo>();
|
||||||
@@ -118,7 +118,7 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id)
|
|||||||
|
|
||||||
QString additionalArguments = qmakeExtra.additionalArguments;
|
QString additionalArguments = qmakeExtra.additionalArguments;
|
||||||
if (!additionalArguments.isEmpty())
|
if (!additionalArguments.isEmpty())
|
||||||
qmakeStep->setUserArguments(additionalArguments);
|
qmakeStep->userArguments.setArguments(additionalArguments);
|
||||||
|
|
||||||
aspect<SeparateDebugInfoAspect>()->setValue(qmakeExtra.config.separateDebugInfo);
|
aspect<SeparateDebugInfoAspect>()->setValue(qmakeExtra.config.separateDebugInfo);
|
||||||
aspect<QmlDebuggingAspect>()->setValue(qmakeExtra.config.linkQmlDebuggingQQ2);
|
aspect<QmlDebuggingAspect>()->setValue(qmakeExtra.config.linkQmlDebuggingQQ2);
|
||||||
|
@@ -63,23 +63,20 @@ QMakeStep::QMakeStep(BuildStepList *bsl, Id id)
|
|||||||
{
|
{
|
||||||
setLowPriority();
|
setLowPriority();
|
||||||
|
|
||||||
m_buildType = addAspect<SelectionAspect>();
|
buildType.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
||||||
m_buildType->setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
buildType.setDisplayName(Tr::tr("qmake build configuration:"));
|
||||||
m_buildType->setDisplayName(Tr::tr("qmake build configuration:"));
|
buildType.addOption(Tr::tr("Debug"));
|
||||||
m_buildType->addOption(Tr::tr("Debug"));
|
buildType.addOption(Tr::tr("Release"));
|
||||||
m_buildType->addOption(Tr::tr("Release"));
|
|
||||||
|
|
||||||
m_userArgs = addAspect<ArgumentsAspect>();
|
userArguments.setMacroExpander(macroExpander());
|
||||||
m_userArgs->setMacroExpander(macroExpander());
|
userArguments.setSettingsKey(QMAKE_ARGUMENTS_KEY);
|
||||||
m_userArgs->setSettingsKey(QMAKE_ARGUMENTS_KEY);
|
userArguments.setLabelText(Tr::tr("Additional arguments:"));
|
||||||
m_userArgs->setLabelText(Tr::tr("Additional arguments:"));
|
|
||||||
|
|
||||||
m_effectiveCall = addAspect<StringAspect>();
|
effectiveCall.setDisplayStyle(StringAspect::TextEditDisplay);
|
||||||
m_effectiveCall->setDisplayStyle(StringAspect::TextEditDisplay);
|
effectiveCall.setLabelText(Tr::tr("Effective qmake call:"));
|
||||||
m_effectiveCall->setLabelText(Tr::tr("Effective qmake call:"));
|
effectiveCall.setReadOnly(true);
|
||||||
m_effectiveCall->setReadOnly(true);
|
effectiveCall.setUndoRedoEnabled(false);
|
||||||
m_effectiveCall->setUndoRedoEnabled(false);
|
effectiveCall.setEnabled(true);
|
||||||
m_effectiveCall->setEnabled(true);
|
|
||||||
|
|
||||||
auto updateSummary = [this] {
|
auto updateSummary = [this] {
|
||||||
QtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
QtVersion *qtVersion = QtKitAspect::qtVersion(target()->kit());
|
||||||
@@ -316,11 +313,6 @@ void QMakeStep::setForced(bool b)
|
|||||||
m_forced = b;
|
m_forced = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeStep::setUserArguments(const QString &arguments)
|
|
||||||
{
|
|
||||||
m_userArgs->setArguments(arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList QMakeStep::extraArguments() const
|
QStringList QMakeStep::extraArguments() const
|
||||||
{
|
{
|
||||||
return m_extraArgs;
|
return m_extraArgs;
|
||||||
@@ -397,11 +389,6 @@ QStringList QMakeStep::parserArguments()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QMakeStep::userArguments() const
|
|
||||||
{
|
|
||||||
return m_userArgs->arguments();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QMakeStep::mkspec() const
|
QString QMakeStep::mkspec() const
|
||||||
{
|
{
|
||||||
QString additionalArguments = userArguments();
|
QString additionalArguments = userArguments();
|
||||||
@@ -439,9 +426,9 @@ QWidget *QMakeStep::createConfigWidget()
|
|||||||
abisListWidget = new QListWidget;
|
abisListWidget = new QListWidget;
|
||||||
|
|
||||||
Layouting::Form builder;
|
Layouting::Form builder;
|
||||||
builder.addRow({m_buildType});
|
builder.addRow({buildType});
|
||||||
builder.addRow({m_userArgs});
|
builder.addRow({userArguments});
|
||||||
builder.addRow({m_effectiveCall});
|
builder.addRow({effectiveCall});
|
||||||
builder.addRow({abisLabel, abisListWidget});
|
builder.addRow({abisLabel, abisListWidget});
|
||||||
builder.addItem(Layouting::noMargin);
|
builder.addItem(Layouting::noMargin);
|
||||||
auto widget = builder.emerge();
|
auto widget = builder.emerge();
|
||||||
@@ -452,7 +439,7 @@ QWidget *QMakeStep::createConfigWidget()
|
|||||||
updateAbiWidgets();
|
updateAbiWidgets();
|
||||||
updateEffectiveQMakeCall();
|
updateEffectiveQMakeCall();
|
||||||
|
|
||||||
connect(m_userArgs, &BaseAspect::changed, widget, [this] {
|
connect(&userArguments, &BaseAspect::changed, widget, [this] {
|
||||||
updateAbiWidgets();
|
updateAbiWidgets();
|
||||||
updateEffectiveQMakeCall();
|
updateEffectiveQMakeCall();
|
||||||
|
|
||||||
@@ -460,7 +447,7 @@ QWidget *QMakeStep::createConfigWidget()
|
|||||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_buildType, &BaseAspect::changed,
|
connect(&buildType, &BaseAspect::changed,
|
||||||
widget, [this] { buildConfigurationSelected(); });
|
widget, [this] { buildConfigurationSelected(); });
|
||||||
|
|
||||||
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged,
|
connect(qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged,
|
||||||
@@ -510,7 +497,7 @@ void QMakeStep::qmakeBuildConfigChanged()
|
|||||||
const bool debug = bc->qmakeBuildConfiguration() & QtVersion::DebugBuild;
|
const bool debug = bc->qmakeBuildConfiguration() & QtVersion::DebugBuild;
|
||||||
{
|
{
|
||||||
const GuardLocker locker(m_ignoreChanges);
|
const GuardLocker locker(m_ignoreChanges);
|
||||||
m_buildType->setValue(debug ? 0 : 1);
|
buildType.setValue(debug ? 0 : 1);
|
||||||
}
|
}
|
||||||
updateAbiWidgets();
|
updateAbiWidgets();
|
||||||
updateEffectiveQMakeCall();
|
updateEffectiveQMakeCall();
|
||||||
@@ -599,7 +586,7 @@ void QMakeStep::buildConfigurationSelected()
|
|||||||
return;
|
return;
|
||||||
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
|
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
|
||||||
QtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration();
|
QtVersion::QmakeBuildConfigs buildConfiguration = bc->qmakeBuildConfiguration();
|
||||||
if (m_buildType->value() == 0) { // debug
|
if (buildType() == 0) { // debug
|
||||||
buildConfiguration = buildConfiguration | QtVersion::DebugBuild;
|
buildConfiguration = buildConfiguration | QtVersion::DebugBuild;
|
||||||
} else {
|
} else {
|
||||||
buildConfiguration = buildConfiguration & ~QtVersion::DebugBuild;
|
buildConfiguration = buildConfiguration & ~QtVersion::DebugBuild;
|
||||||
@@ -683,7 +670,7 @@ void QMakeStep::updateAbiWidgets()
|
|||||||
|
|
||||||
void QMakeStep::updateEffectiveQMakeCall()
|
void QMakeStep::updateEffectiveQMakeCall()
|
||||||
{
|
{
|
||||||
m_effectiveCall->setValue(effectiveQMakeCall());
|
effectiveCall.setValue(effectiveQMakeCall());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeStep::handleAbiWidgetChange()
|
void QMakeStep::handleAbiWidgetChange()
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
#include "qmakeprojectmanager_global.h"
|
#include "qmakeprojectmanager_global.h"
|
||||||
|
|
||||||
#include <projectexplorer/abstractprocessstep.h>
|
#include <projectexplorer/abstractprocessstep.h>
|
||||||
|
#include <projectexplorer/runconfigurationaspects.h>
|
||||||
|
|
||||||
#include <utils/aspects.h>
|
#include <utils/aspects.h>
|
||||||
#include <utils/commandline.h>
|
#include <utils/commandline.h>
|
||||||
@@ -16,17 +17,11 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QComboBox;
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QLineEdit;
|
|
||||||
class QPlainTextEdit;
|
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer { class Abi; }
|
||||||
class Abi;
|
|
||||||
class ArgumentsAspect;
|
|
||||||
} // namespace ProjectExplorer
|
|
||||||
|
|
||||||
namespace QtSupport { class QtVersion; }
|
namespace QtSupport { class QtVersion; }
|
||||||
|
|
||||||
@@ -115,9 +110,7 @@ public:
|
|||||||
QMakeStepConfig deducedArguments() const;
|
QMakeStepConfig deducedArguments() const;
|
||||||
// arguments passed to the pro file parser
|
// arguments passed to the pro file parser
|
||||||
QStringList parserArguments();
|
QStringList parserArguments();
|
||||||
// arguments set by the user
|
|
||||||
QString userArguments() const;
|
|
||||||
void setUserArguments(const QString &arguments);
|
|
||||||
// Extra arguments for qmake and pro file parser. Not user editable via UI.
|
// Extra arguments for qmake and pro file parser. Not user editable via UI.
|
||||||
QStringList extraArguments() const;
|
QStringList extraArguments() const;
|
||||||
void setExtraArguments(const QStringList &args);
|
void setExtraArguments(const QStringList &args);
|
||||||
@@ -133,6 +126,10 @@ public:
|
|||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
|
Utils::SelectionAspect buildType{this};
|
||||||
|
ProjectExplorer::ArgumentsAspect userArguments{this};
|
||||||
|
Utils::StringAspect effectiveCall{this};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
@@ -159,7 +156,7 @@ private:
|
|||||||
|
|
||||||
Utils::CommandLine m_qmakeCommand;
|
Utils::CommandLine m_qmakeCommand;
|
||||||
Utils::CommandLine m_makeCommand;
|
Utils::CommandLine m_makeCommand;
|
||||||
ProjectExplorer::ArgumentsAspect *m_userArgs = nullptr;
|
|
||||||
// Extra arguments for qmake and pro file parser
|
// Extra arguments for qmake and pro file parser
|
||||||
QStringList m_extraArgs;
|
QStringList m_extraArgs;
|
||||||
// Extra arguments for pro file parser only
|
// Extra arguments for pro file parser only
|
||||||
@@ -177,8 +174,6 @@ private:
|
|||||||
Utils::Guard m_ignoreChanges;
|
Utils::Guard m_ignoreChanges;
|
||||||
|
|
||||||
QLabel *abisLabel = nullptr;
|
QLabel *abisLabel = nullptr;
|
||||||
Utils::SelectionAspect *m_buildType = nullptr;
|
|
||||||
Utils::StringAspect *m_effectiveCall = nullptr;
|
|
||||||
QListWidget *abisListWidget = nullptr;
|
QListWidget *abisListWidget = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user