forked from qt-creator/qt-creator
Qmake: Use aspects more directly in QmakeBuildConfiguration
Change-Id: Ida1f62939242944e25986b71183164cd15c8de94 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -53,18 +53,6 @@ using namespace QmakeProjectManager::Internal;
|
|||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
|
|
||||||
class RunSystemAspect : public TriStateAspect
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
RunSystemAspect()
|
|
||||||
: TriStateAspect(nullptr, Tr::tr("Run"), Tr::tr("Ignore"), Tr::tr("Use global setting"))
|
|
||||||
{
|
|
||||||
setSettingsKey("RunSystemFunction");
|
|
||||||
setDisplayName(Tr::tr("qmake system() behavior when parsing:"));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
|
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
|
||||||
{
|
{
|
||||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||||
@@ -120,9 +108,9 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id)
|
|||||||
if (!additionalArguments.isEmpty())
|
if (!additionalArguments.isEmpty())
|
||||||
qmakeStep->userArguments.setArguments(additionalArguments);
|
qmakeStep->userArguments.setArguments(additionalArguments);
|
||||||
|
|
||||||
aspect<SeparateDebugInfoAspect>()->setValue(qmakeExtra.config.separateDebugInfo);
|
separateDebugInfo.setValue(qmakeExtra.config.separateDebugInfo);
|
||||||
aspect<QmlDebuggingAspect>()->setValue(qmakeExtra.config.linkQmlDebuggingQQ2);
|
qmlDebugging.setValue(qmakeExtra.config.linkQmlDebuggingQQ2);
|
||||||
aspect<QtQuickCompilerAspect>()->setValue(qmakeExtra.config.useQtQuickCompiler);
|
useQtQuickCompiler.setValue(qmakeExtra.config.useQtQuickCompiler);
|
||||||
|
|
||||||
setQMakeBuildConfiguration(config);
|
setQMakeBuildConfiguration(config);
|
||||||
|
|
||||||
@@ -166,30 +154,33 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id)
|
|||||||
connect(target, &Target::parsingFinished, this, &QmakeBuildConfiguration::updateProblemLabel);
|
connect(target, &Target::parsingFinished, this, &QmakeBuildConfiguration::updateProblemLabel);
|
||||||
connect(target, &Target::kitChanged, this, &QmakeBuildConfiguration::updateProblemLabel);
|
connect(target, &Target::kitChanged, this, &QmakeBuildConfiguration::updateProblemLabel);
|
||||||
|
|
||||||
const auto separateDebugInfoAspect = addAspect<SeparateDebugInfoAspect>();
|
connect(&separateDebugInfo, &BaseAspect::changed, this, [this] {
|
||||||
connect(separateDebugInfoAspect, &SeparateDebugInfoAspect::changed, this, [this] {
|
|
||||||
emit separateDebugInfoChanged();
|
emit separateDebugInfoChanged();
|
||||||
emit qmakeBuildConfigurationChanged();
|
emit qmakeBuildConfigurationChanged();
|
||||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto qmlDebuggingAspect = addAspect<QmlDebuggingAspect>();
|
qmlDebugging.setBuildConfiguration(this);
|
||||||
qmlDebuggingAspect->setBuildConfiguration(this);
|
connect(&qmlDebugging, &BaseAspect::changed, this, [this] {
|
||||||
connect(qmlDebuggingAspect, &QmlDebuggingAspect::changed, this, [this] {
|
|
||||||
emit qmlDebuggingChanged();
|
emit qmlDebuggingChanged();
|
||||||
emit qmakeBuildConfigurationChanged();
|
emit qmakeBuildConfigurationChanged();
|
||||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto qtQuickCompilerAspect = addAspect<QtQuickCompilerAspect>();
|
useQtQuickCompiler.setBuildConfiguration(this);
|
||||||
qtQuickCompilerAspect->setBuildConfiguration(this);
|
connect(&useQtQuickCompiler, &QtQuickCompilerAspect::changed, this, [this] {
|
||||||
connect(qtQuickCompilerAspect, &QtQuickCompilerAspect::changed, this, [this] {
|
|
||||||
emit useQtQuickCompilerChanged();
|
emit useQtQuickCompilerChanged();
|
||||||
emit qmakeBuildConfigurationChanged();
|
emit qmakeBuildConfigurationChanged();
|
||||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||||
});
|
});
|
||||||
|
|
||||||
addAspect<RunSystemAspect>();
|
runSystemFunctions.setSettingsKey("RunSystemFunction");
|
||||||
|
runSystemFunctions.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox);
|
||||||
|
runSystemFunctions.setDisplayName(Tr::tr("qmake system() behavior when parsing:"));
|
||||||
|
runSystemFunctions.addOption(Tr::tr("Run"));
|
||||||
|
runSystemFunctions.addOption(Tr::tr("Ignore"));
|
||||||
|
runSystemFunctions.addOption(Tr::tr("Use global setting"));
|
||||||
|
runSystemFunctions.setDefaultValue(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
QmakeBuildConfiguration::~QmakeBuildConfiguration()
|
QmakeBuildConfiguration::~QmakeBuildConfiguration()
|
||||||
@@ -390,44 +381,27 @@ bool QmakeBuildConfiguration::isBuildDirAtSafeLocation() const
|
|||||||
return isBuildDirAtSafeLocation(project()->projectDirectory(), buildDirectory());
|
return isBuildDirAtSafeLocation(project()->projectDirectory(), buildDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
TriState QmakeBuildConfiguration::separateDebugInfo() const
|
|
||||||
{
|
|
||||||
return aspect<SeparateDebugInfoAspect>()->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo)
|
void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo)
|
||||||
{
|
{
|
||||||
aspect<SeparateDebugInfoAspect>()->setValue(sepDebugInfo
|
separateDebugInfo.setValue(sepDebugInfo ? TriState::Enabled : TriState::Disabled);
|
||||||
? TriState::Enabled
|
|
||||||
: TriState::Disabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
TriState QmakeBuildConfiguration::qmlDebugging() const
|
|
||||||
{
|
|
||||||
return aspect<QmlDebuggingAspect>()->value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeBuildConfiguration::forceQmlDebugging(bool enable)
|
void QmakeBuildConfiguration::forceQmlDebugging(bool enable)
|
||||||
{
|
{
|
||||||
aspect<QmlDebuggingAspect>()->setValue(enable ? TriState::Enabled : TriState::Disabled);
|
qmlDebugging.setValue(enable ? TriState::Enabled : TriState::Disabled);
|
||||||
}
|
|
||||||
|
|
||||||
TriState QmakeBuildConfiguration::useQtQuickCompiler() const
|
|
||||||
{
|
|
||||||
return aspect<QtQuickCompilerAspect>()->value();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
|
void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
|
||||||
{
|
{
|
||||||
aspect<QtQuickCompilerAspect>()->setValue(enable ? TriState::Enabled : TriState::Disabled);
|
useQtQuickCompiler.setValue(enable ? TriState::Enabled : TriState::Disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeBuildConfiguration::runSystemFunction() const
|
bool QmakeBuildConfiguration::runQmakeSystemFunctions() const
|
||||||
{
|
{
|
||||||
const TriState runSystem = aspect<RunSystemAspect>()->value();
|
const int sel = runSystemFunctions();
|
||||||
if (runSystem == TriState::Enabled)
|
if (sel == 0)
|
||||||
return true;
|
return true;
|
||||||
if (runSystem == TriState::Disabled)
|
if (sel == 1)
|
||||||
return false;
|
return false;
|
||||||
return settings().runSystemFunction();
|
return settings().runSystemFunction();
|
||||||
}
|
}
|
||||||
@@ -857,5 +831,3 @@ void QmakeBuildConfiguration::restrictNextBuild(const RunConfiguration *rc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmakeProjectManager
|
} // namespace QmakeProjectManager
|
||||||
|
|
||||||
#include <qmakebuildconfiguration.moc>
|
|
||||||
|
@@ -5,8 +5,10 @@
|
|||||||
|
|
||||||
#include "qmakeprojectmanager_global.h"
|
#include "qmakeprojectmanager_global.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/buildaspects.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
|
#include <qtsupport/qtbuildaspects.h>
|
||||||
|
|
||||||
#include <utils/aspects.h>
|
#include <utils/aspects.h>
|
||||||
|
|
||||||
@@ -76,16 +78,16 @@ public:
|
|||||||
const Utils::FilePath &buildDir);
|
const Utils::FilePath &buildDir);
|
||||||
bool isBuildDirAtSafeLocation() const;
|
bool isBuildDirAtSafeLocation() const;
|
||||||
|
|
||||||
Utils::TriState separateDebugInfo() const;
|
|
||||||
void forceSeparateDebugInfo(bool sepDebugInfo);
|
void forceSeparateDebugInfo(bool sepDebugInfo);
|
||||||
|
|
||||||
Utils::TriState qmlDebugging() const;
|
|
||||||
void forceQmlDebugging(bool enable);
|
void forceQmlDebugging(bool enable);
|
||||||
|
|
||||||
Utils::TriState useQtQuickCompiler() const;
|
|
||||||
void forceQtQuickCompiler(bool enable);
|
void forceQtQuickCompiler(bool enable);
|
||||||
|
|
||||||
bool runSystemFunction() const;
|
ProjectExplorer::SeparateDebugInfoAspect separateDebugInfo{this};
|
||||||
|
QtSupport::QmlDebuggingAspect qmlDebugging{this};
|
||||||
|
QtSupport::QtQuickCompilerAspect useQtQuickCompiler{this};
|
||||||
|
Utils::SelectionAspect runSystemFunctions{this};
|
||||||
|
|
||||||
|
bool runQmakeSystemFunctions() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
|
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
|
||||||
|
@@ -872,7 +872,7 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi
|
|||||||
});
|
});
|
||||||
|
|
||||||
m_qmakeGlobals->setCommandLineArguments(rootProFileName, qmakeArgs);
|
m_qmakeGlobals->setCommandLineArguments(rootProFileName, qmakeArgs);
|
||||||
m_qmakeGlobals->runSystemFunction = bc->runSystemFunction();
|
m_qmakeGlobals->runSystemFunction = bc->runQmakeSystemFunctions();
|
||||||
|
|
||||||
QtSupport::ProFileCacheManager::instance()->incRefCount();
|
QtSupport::ProFileCacheManager::instance()->incRefCount();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user