forked from qt-creator/qt-creator
QmakeProjectManager: Make "system" execution opt-in
It has too many side effects.
Amends fcd6384f4d.
T_SYSTEM and E_SYSTEM are now treated the same.
Fixes: QTCREATORBUG-24551
Change-Id: Ib6df2762d329f2ddc0dd66190454159d446a9ac9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -75,6 +75,17 @@ using namespace QmakeProjectManager::Internal;
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
|
||||
class RunSystemAspect : public TriStateAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RunSystemAspect() : TriStateAspect(tr("Run"), tr("Ignore"), tr("Use global setting"))
|
||||
{
|
||||
setSettingsKey("RunSystemFunction");
|
||||
setDisplayName(tr("qmake system() behavior when parsing:"));
|
||||
}
|
||||
};
|
||||
|
||||
QmakeExtraBuildInfo::QmakeExtraBuildInfo()
|
||||
{
|
||||
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
|
||||
@@ -198,6 +209,8 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Utils::Id id)
|
||||
emit qmakeBuildConfigurationChanged();
|
||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||
});
|
||||
|
||||
addAspect<RunSystemAspect>();
|
||||
}
|
||||
|
||||
QmakeBuildConfiguration::~QmakeBuildConfiguration()
|
||||
@@ -439,6 +452,17 @@ void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
|
||||
aspect<QtQuickCompilerAspect>()->setSetting(enable ? TriState::Enabled : TriState::Disabled);
|
||||
}
|
||||
|
||||
bool QmakeBuildConfiguration::runSystemFunction() const
|
||||
{
|
||||
switch (aspect<RunSystemAspect>()->value()) {
|
||||
case 0:
|
||||
return true;
|
||||
case 1:
|
||||
return false;
|
||||
}
|
||||
return QmakeSettings::runSystemFunction();
|
||||
}
|
||||
|
||||
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
|
||||
{
|
||||
QStringList result;
|
||||
@@ -875,3 +899,5 @@ void QmakeBuildConfiguration::restrictNextBuild(const RunConfiguration *rc)
|
||||
}
|
||||
|
||||
} // namespace QmakeProjectManager
|
||||
|
||||
#include <qmakebuildconfiguration.moc>
|
||||
|
||||
@@ -106,6 +106,8 @@ public:
|
||||
Utils::TriState useQtQuickCompiler() const;
|
||||
void forceQtQuickCompiler(bool enable);
|
||||
|
||||
bool runSystemFunction() const;
|
||||
|
||||
signals:
|
||||
/// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even
|
||||
/// if those change the qmakebuildconfig
|
||||
|
||||
@@ -797,6 +797,7 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi
|
||||
m_qmakeGlobals->environment.insert(env.key(eit), env.expandedValueForKey(env.key(eit)));
|
||||
|
||||
m_qmakeGlobals->setCommandLineArguments(buildDir(rootProFile()->filePath()).toString(), qmakeArgs);
|
||||
m_qmakeGlobals->runSystemFunction = bc->runSystemFunction();
|
||||
|
||||
QtSupport::ProFileCacheManager::instance()->incRefCount();
|
||||
|
||||
|
||||
@@ -38,11 +38,13 @@ namespace Internal {
|
||||
|
||||
const char BUILD_DIR_WARNING_KEY[] = "QmakeProjectManager/WarnAgainstUnalignedBuildDir";
|
||||
const char ALWAYS_RUN_QMAKE_KEY[] = "QmakeProjectManager/AlwaysRunQmake";
|
||||
const char RUN_SYSTEM_KEY[] = "QmakeProjectManager/RunSystemFunction";
|
||||
|
||||
static bool operator==(const QmakeSettingsData &s1, const QmakeSettingsData &s2)
|
||||
{
|
||||
return s1.warnAgainstUnalignedBuildDir == s2.warnAgainstUnalignedBuildDir
|
||||
&& s1.alwaysRunQmake == s2.alwaysRunQmake;
|
||||
&& s1.alwaysRunQmake == s2.alwaysRunQmake
|
||||
&& s1.runSystemFunction == s2.runSystemFunction;
|
||||
}
|
||||
static bool operator!=(const QmakeSettingsData &s1, const QmakeSettingsData &s2)
|
||||
{
|
||||
@@ -59,6 +61,11 @@ bool QmakeSettings::alwaysRunQmake()
|
||||
return instance().m_settings.alwaysRunQmake;
|
||||
}
|
||||
|
||||
bool QmakeSettings::runSystemFunction()
|
||||
{
|
||||
return instance().m_settings.runSystemFunction;
|
||||
}
|
||||
|
||||
QmakeSettings &QmakeSettings::instance()
|
||||
{
|
||||
static QmakeSettings theSettings;
|
||||
@@ -85,6 +92,7 @@ void QmakeSettings::loadSettings()
|
||||
m_settings.warnAgainstUnalignedBuildDir = s->value(
|
||||
BUILD_DIR_WARNING_KEY, Utils::HostOsInfo::isWindowsHost()).toBool();
|
||||
m_settings.alwaysRunQmake = s->value(ALWAYS_RUN_QMAKE_KEY, false).toBool();
|
||||
m_settings.runSystemFunction = s->value(RUN_SYSTEM_KEY, false).toBool();
|
||||
}
|
||||
|
||||
void QmakeSettings::storeSettings() const
|
||||
@@ -92,6 +100,7 @@ void QmakeSettings::storeSettings() const
|
||||
QSettings * const s = Core::ICore::settings();
|
||||
s->setValue(BUILD_DIR_WARNING_KEY, warnAgainstUnalignedBuildDir());
|
||||
s->setValue(ALWAYS_RUN_QMAKE_KEY, alwaysRunQmake());
|
||||
s->setValue(RUN_SYSTEM_KEY, runSystemFunction());
|
||||
}
|
||||
|
||||
class QmakeSettingsPage::SettingsWidget : public QWidget
|
||||
@@ -110,9 +119,15 @@ public:
|
||||
m_alwaysRunQmakeCheckbox.setToolTip(tr("This option can help to prevent failures on "
|
||||
"incremental builds, but might slow them down unnecessarily in the general case."));
|
||||
m_alwaysRunQmakeCheckbox.setChecked(QmakeSettings::alwaysRunQmake());
|
||||
m_ignoreSystemCheckbox.setText(tr("Ignore qmake's system() function "
|
||||
"when parsing a project"));
|
||||
m_ignoreSystemCheckbox.setToolTip(tr("Unchecking this option can help getting more exact "
|
||||
"parsing results, but can have unwanted side effects."));
|
||||
m_ignoreSystemCheckbox.setChecked(!QmakeSettings::runSystemFunction());
|
||||
const auto layout = new QVBoxLayout(this);
|
||||
layout->addWidget(&m_warnAgainstUnalignedBuildDirCheckbox);
|
||||
layout->addWidget(&m_alwaysRunQmakeCheckbox);
|
||||
layout->addWidget(&m_ignoreSystemCheckbox);
|
||||
layout->addStretch(1);
|
||||
}
|
||||
|
||||
@@ -121,12 +136,14 @@ public:
|
||||
QmakeSettingsData settings;
|
||||
settings.warnAgainstUnalignedBuildDir = m_warnAgainstUnalignedBuildDirCheckbox.isChecked();
|
||||
settings.alwaysRunQmake = m_alwaysRunQmakeCheckbox.isChecked();
|
||||
settings.runSystemFunction = !m_ignoreSystemCheckbox.isChecked();
|
||||
QmakeSettings::setSettingsData(settings);
|
||||
}
|
||||
|
||||
private:
|
||||
QCheckBox m_warnAgainstUnalignedBuildDirCheckbox;
|
||||
QCheckBox m_alwaysRunQmakeCheckbox;
|
||||
QCheckBox m_ignoreSystemCheckbox;
|
||||
};
|
||||
|
||||
QmakeSettingsPage::QmakeSettingsPage()
|
||||
|
||||
@@ -37,6 +37,7 @@ class QmakeSettingsData {
|
||||
public:
|
||||
bool warnAgainstUnalignedBuildDir = false;
|
||||
bool alwaysRunQmake = false;
|
||||
bool runSystemFunction = false;
|
||||
};
|
||||
|
||||
class QmakeSettings : public QObject
|
||||
@@ -46,6 +47,7 @@ public:
|
||||
static QmakeSettings &instance();
|
||||
static bool warnAgainstUnalignedBuildDir();
|
||||
static bool alwaysRunQmake();
|
||||
static bool runSystemFunction();
|
||||
static void setSettingsData(const QmakeSettingsData &settings);
|
||||
|
||||
signals:
|
||||
|
||||
Reference in New Issue
Block a user