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:
Christian Kandeler
2020-10-15 17:07:00 +02:00
parent d1b0c12d6b
commit dd62254e4e
9 changed files with 65 additions and 8 deletions

View File

@@ -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()