forked from qt-creator/qt-creator
QtSupport: Introduce QtQuickCompilerAspect
... and use it in the qbs build configuration Change-Id: I53ef4fb8c267e2b4e033c01604bc5b7770b57777 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -581,6 +581,7 @@ BuildConfiguration *BuildConfigurationFactory::create(Target *parent, const Buil
|
||||
bc->d->m_initialBuildDirectory = info.buildDirectory;
|
||||
bc->d->m_extraInfo = info.extraInfo;
|
||||
|
||||
bc->acquaintAspects();
|
||||
bc->initialize();
|
||||
|
||||
return bc;
|
||||
@@ -596,6 +597,7 @@ BuildConfiguration *BuildConfigurationFactory::restore(Target *parent, const QVa
|
||||
if (!id.name().startsWith(factory->m_buildConfigId.name()))
|
||||
continue;
|
||||
BuildConfiguration *bc = factory->m_creator(parent);
|
||||
bc->acquaintAspects();
|
||||
QTC_ASSERT(bc, return nullptr);
|
||||
if (!bc->fromMap(map)) {
|
||||
delete bc;
|
||||
|
@@ -96,6 +96,11 @@ QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Core::Id id)
|
||||
connect(qmlDebuggingAspect, &QtSupport::QmlDebuggingAspect::changed,
|
||||
this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||
|
||||
const auto qtQuickCompilerAspect = addAspect<QtSupport::QtQuickCompilerAspect>();
|
||||
qtQuickCompilerAspect->setKit(target->kit());
|
||||
connect(qtQuickCompilerAspect, &QtSupport::QtQuickCompilerAspect::changed,
|
||||
this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||
|
||||
connect(this, &BuildConfiguration::environmentChanged,
|
||||
this, &QbsBuildConfiguration::triggerReparseIfActive);
|
||||
connect(this, &BuildConfiguration::buildDirectoryChanged,
|
||||
@@ -386,6 +391,11 @@ BaseTriStateAspect::Value QbsBuildConfiguration::qmlDebuggingSetting() const
|
||||
return aspect<QtSupport::QmlDebuggingAspect>()->setting();
|
||||
}
|
||||
|
||||
BaseTriStateAspect::Value QbsBuildConfiguration::qtQuickCompilerSetting() const
|
||||
{
|
||||
return aspect<QtSupport::QtQuickCompilerAspect>()->setting();
|
||||
}
|
||||
|
||||
BaseTriStateAspect::Value QbsBuildConfiguration::separateDebugInfoSetting() const
|
||||
{
|
||||
return aspect<SeparateDebugInfoAspect>()->setting();
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
bool isQmlDebuggingEnabled() const;
|
||||
QtSupport::QmlDebuggingAspect::Value qmlDebuggingSetting() const;
|
||||
|
||||
QtSupport::QtQuickCompilerAspect::Value qtQuickCompilerSetting() const;
|
||||
ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfoSetting() const;
|
||||
|
||||
signals:
|
||||
|
@@ -236,6 +236,17 @@ QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) co
|
||||
config.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
||||
break;
|
||||
}
|
||||
switch (qbsBuildConfig->qtQuickCompilerSetting()) {
|
||||
case QtSupport::QtQuickCompilerAspect::Value::Enabled:
|
||||
config.insert(Constants::QBS_CONFIG_QUICK_COMPILER_KEY, true);
|
||||
break;
|
||||
case QtSupport::QtQuickCompilerAspect::Value::Disabled:
|
||||
config.insert(Constants::QBS_CONFIG_QUICK_COMPILER_KEY, false);
|
||||
break;
|
||||
default:
|
||||
config.remove(Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
|
||||
break;
|
||||
}
|
||||
if (variableHandling == ExpandVariables) {
|
||||
const MacroExpander * const expander = buildConfiguration()->macroExpander();
|
||||
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
||||
@@ -706,6 +717,16 @@ void QbsBuildStepConfigWidget::updateState()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (qbsBuildConfig->qtQuickCompilerSetting()) {
|
||||
case QtSupport::QtQuickCompilerAspect::Value::Enabled:
|
||||
command.append(' ').append(Constants::QBS_CONFIG_QUICK_COMPILER_KEY).append(":true");
|
||||
break;
|
||||
case QtSupport::QtQuickCompilerAspect::Value::Disabled:
|
||||
command.append(' ').append(Constants::QBS_CONFIG_QUICK_COMPILER_KEY).append(":false");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
commandLineTextEdit->setPlainText(command);
|
||||
|
||||
setSummaryText(tr("<b>Qbs:</b> %1").arg(command));
|
||||
@@ -722,6 +743,7 @@ void QbsBuildStepConfigWidget::updatePropertyEdit(const QVariantMap &data)
|
||||
editable.remove(Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY); // For existing .user files
|
||||
editable.remove(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY);
|
||||
editable.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
||||
editable.remove(Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
|
||||
editable.remove(Constants::QBS_FORCE_PROBES_KEY);
|
||||
editable.remove(Constants::QBS_INSTALL_ROOT_KEY);
|
||||
|
||||
@@ -822,6 +844,7 @@ void QbsBuildStepConfigWidget::applyCachedProperties()
|
||||
tmp.value(Constants::QBS_CONFIG_VARIANT_KEY));
|
||||
const QStringList additionalSpecialKeys({Constants::QBS_CONFIG_DECLARATIVE_DEBUG_KEY,
|
||||
Constants::QBS_CONFIG_QUICK_DEBUG_KEY,
|
||||
Constants::QBS_CONFIG_QUICK_COMPILER_KEY,
|
||||
Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY,
|
||||
Constants::QBS_INSTALL_ROOT_KEY});
|
||||
for (const QString &key : additionalSpecialKeys) {
|
||||
@@ -864,8 +887,8 @@ bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QS
|
||||
const QString propertyName = rawArg.left(pos);
|
||||
static const QStringList specialProperties{
|
||||
Constants::QBS_CONFIG_PROFILE_KEY, Constants::QBS_CONFIG_VARIANT_KEY,
|
||||
Constants::QBS_CONFIG_QUICK_DEBUG_KEY, Constants::QBS_INSTALL_ROOT_KEY,
|
||||
Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY,
|
||||
Constants::QBS_CONFIG_QUICK_DEBUG_KEY, Constants::QBS_CONFIG_QUICK_COMPILER_KEY,
|
||||
Constants::QBS_INSTALL_ROOT_KEY, Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY,
|
||||
};
|
||||
if (specialProperties.contains(propertyName)) {
|
||||
if (errorMessage) {
|
||||
|
@@ -69,6 +69,7 @@ const char QBS_CONFIG_PROFILE_KEY[] = "qbs.profile";
|
||||
const char QBS_INSTALL_ROOT_KEY[] = "qbs.installRoot";
|
||||
const char QBS_CONFIG_DECLARATIVE_DEBUG_KEY[] = "modules.Qt.declarative.qmlDebugging";
|
||||
const char QBS_CONFIG_QUICK_DEBUG_KEY[] = "modules.Qt.quick.qmlDebugging";
|
||||
const char QBS_CONFIG_QUICK_COMPILER_KEY[] = "modules.Qt.quick.useCompiler";
|
||||
const char QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY[] = "modules.cpp.separateDebugInformation";
|
||||
const char QBS_FORCE_PROBES_KEY[] = "qbspm.forceProbes";
|
||||
|
||||
|
@@ -1966,7 +1966,7 @@ bool BaseQtVersion::isQmlDebuggingSupported(QString *reason) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BaseQtVersion::isQtQuickCompilerSupported(Kit *k, QString *reason)
|
||||
bool BaseQtVersion::isQtQuickCompilerSupported(const Kit *k, QString *reason)
|
||||
{
|
||||
QTC_ASSERT(k, return false);
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(k);
|
||||
|
@@ -176,7 +176,7 @@ public:
|
||||
|
||||
static bool isQmlDebuggingSupported(const ProjectExplorer::Kit *k, QString *reason = nullptr);
|
||||
bool isQmlDebuggingSupported(QString *reason = nullptr) const;
|
||||
static bool isQtQuickCompilerSupported(ProjectExplorer::Kit *k, QString *reason = nullptr);
|
||||
static bool isQtQuickCompilerSupported(const ProjectExplorer::Kit *k, QString *reason = nullptr);
|
||||
bool isQtQuickCompilerSupported(QString *reason = nullptr) const;
|
||||
|
||||
QString qmlDumpTool(bool debugVersion) const;
|
||||
|
@@ -72,4 +72,49 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
QtQuickCompilerAspect::QtQuickCompilerAspect()
|
||||
{
|
||||
setSettingsKey("QtQuickCompiler");
|
||||
setDisplayName(tr("Qt Quick Compiler"));
|
||||
}
|
||||
|
||||
void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
||||
{
|
||||
BaseSelectionAspect::addToLayout(builder);
|
||||
const auto warningIconLabel = new QLabel;
|
||||
warningIconLabel->setAlignment(Qt::AlignTop);
|
||||
warningIconLabel->setPixmap(Utils::Icons::WARNING.pixmap());
|
||||
const auto warningTextLabel = new QLabel;
|
||||
warningTextLabel->setAlignment(Qt::AlignTop);
|
||||
builder.startNewRow().addItems(QString(), warningIconLabel, warningTextLabel);
|
||||
const auto changeHandler = [this, warningIconLabel, warningTextLabel] {
|
||||
QString warningText;
|
||||
const bool supported = m_kit
|
||||
&& BaseQtVersion::isQtQuickCompilerSupported(m_kit, &warningText);
|
||||
if (!supported)
|
||||
setSetting(Value::Default);
|
||||
if (setting() == Value::Enabled
|
||||
&& m_qmlDebuggingAspect && m_qmlDebuggingAspect->setting() == Value::Enabled) {
|
||||
warningText = tr("Disables QML debugging. QML profiling will still work.");
|
||||
}
|
||||
warningTextLabel->setText(warningText);
|
||||
setVisibleDynamic(supported);
|
||||
warningIconLabel->setVisible(supported && !warningText.isEmpty());
|
||||
warningTextLabel->setVisible(supported);
|
||||
};
|
||||
connect(KitManager::instance(), &KitManager::kitsChanged, builder.layout(), changeHandler);
|
||||
connect(this, &QmlDebuggingAspect::changed, builder.layout(), changeHandler);
|
||||
connect(this, &QtQuickCompilerAspect::changed, builder.layout(), changeHandler);
|
||||
if (m_qmlDebuggingAspect) {
|
||||
connect(m_qmlDebuggingAspect, &QmlDebuggingAspect::changed, builder.layout(),
|
||||
changeHandler);
|
||||
}
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
void QtQuickCompilerAspect::acquaintSiblings(const ProjectConfigurationAspects &siblings)
|
||||
{
|
||||
m_qmlDebuggingAspect = siblings.aspect<QmlDebuggingAspect>();
|
||||
}
|
||||
|
||||
} // namespace QtSupport
|
||||
|
@@ -45,4 +45,20 @@ private:
|
||||
const ProjectExplorer::Kit *m_kit = nullptr;
|
||||
};
|
||||
|
||||
class QTSUPPORT_EXPORT QtQuickCompilerAspect : public ProjectExplorer::BaseTriStateAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtQuickCompilerAspect();
|
||||
|
||||
void setKit(const ProjectExplorer::Kit *kit) { m_kit = kit; }
|
||||
|
||||
private:
|
||||
void addToLayout(ProjectExplorer::LayoutBuilder &builder) override;
|
||||
void acquaintSiblings(const ProjectExplorer::ProjectConfigurationAspects &siblings) override;
|
||||
|
||||
const ProjectExplorer::Kit *m_kit = nullptr;
|
||||
const QmlDebuggingAspect *m_qmlDebuggingAspect = nullptr;
|
||||
};
|
||||
|
||||
} // namespace QtSupport
|
||||
|
Reference in New Issue
Block a user