forked from qt-creator/qt-creator
ProjectExplorer: Let the user override parallel jobs in arguments
Change-Id: I2cfe49686d3430cdd2087842936c3bf0f685d345 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
3056105c66
commit
7cc1dc7d1a
@@ -196,14 +196,23 @@ void MakeStep::setJobCountOverrideMakeflags(bool override)
|
|||||||
m_overrideMakeflags = override;
|
m_overrideMakeflags = override;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool argsContainsJobCount(const QString &str)
|
||||||
|
{
|
||||||
|
const QStringList args = Utils::QtcProcess::splitArgs(str, Utils::HostOsInfo::hostOs());
|
||||||
|
return Utils::anyOf(args, [](const QString &arg) { return arg.startsWith("-j"); });
|
||||||
|
}
|
||||||
|
|
||||||
bool MakeStep::makeflagsContainsJobCount() const
|
bool MakeStep::makeflagsContainsJobCount() const
|
||||||
{
|
{
|
||||||
const Utils::Environment env = environment(buildConfiguration());
|
const Utils::Environment env = environment(buildConfiguration());
|
||||||
if (!env.hasKey(MAKEFLAGS))
|
if (!env.hasKey(MAKEFLAGS))
|
||||||
return false;
|
return false;
|
||||||
const QStringList args = Utils::QtcProcess::splitArgs(env.value(MAKEFLAGS),
|
return argsContainsJobCount(env.value(MAKEFLAGS));
|
||||||
Utils::HostOsInfo::hostOs());
|
}
|
||||||
return Utils::anyOf(args, [](const QString &arg) { return arg.startsWith("-j"); });
|
|
||||||
|
bool MakeStep::userArgsContainsJobCount() const
|
||||||
|
{
|
||||||
|
return argsContainsJobCount(m_makeArguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::Environment MakeStep::environment(BuildConfiguration *bc) const
|
Utils::Environment MakeStep::environment(BuildConfiguration *bc) const
|
||||||
@@ -262,8 +271,10 @@ int MakeStep::defaultJobCount()
|
|||||||
|
|
||||||
QStringList MakeStep::jobArguments() const
|
QStringList MakeStep::jobArguments() const
|
||||||
{
|
{
|
||||||
if (!isJobCountSupported() || (makeflagsContainsJobCount() && !jobCountOverridesMakeflags()))
|
if (!isJobCountSupported() || userArgsContainsJobCount()
|
||||||
|
|| (makeflagsContainsJobCount() && !jobCountOverridesMakeflags())) {
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
return {"-j" + QString::number(m_userJobCount)};
|
return {"-j" + QString::number(m_userJobCount)};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,6 +437,13 @@ void MakeStepConfigWidget::setUserJobCountVisible(bool visible)
|
|||||||
m_ui->overrideMakeflags->setVisible(visible);
|
m_ui->overrideMakeflags->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MakeStepConfigWidget::setUserJobCountEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
m_ui->jobsLabel->setEnabled(enabled);
|
||||||
|
m_ui->userJobCount->setEnabled(enabled);
|
||||||
|
m_ui->overrideMakeflags->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
void MakeStepConfigWidget::updateDetails()
|
void MakeStepConfigWidget::updateDetails()
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||||
@@ -446,6 +464,7 @@ void MakeStepConfigWidget::updateDetails()
|
|||||||
}
|
}
|
||||||
|
|
||||||
setUserJobCountVisible(m_makeStep->isJobCountSupported());
|
setUserJobCountVisible(m_makeStep->isJobCountSupported());
|
||||||
|
setUserJobCountEnabled(!m_makeStep->userArgsContainsJobCount());
|
||||||
m_ui->userJobCount->setValue(m_makeStep->jobCount());
|
m_ui->userJobCount->setValue(m_makeStep->jobCount());
|
||||||
m_ui->overrideMakeflags->setCheckState(
|
m_ui->overrideMakeflags->setCheckState(
|
||||||
m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked);
|
m_makeStep->jobCountOverridesMakeflags() ? Qt::Checked : Qt::Unchecked);
|
||||||
|
@@ -74,6 +74,7 @@ public:
|
|||||||
bool jobCountOverridesMakeflags() const;
|
bool jobCountOverridesMakeflags() const;
|
||||||
void setJobCountOverrideMakeflags(bool override);
|
void setJobCountOverrideMakeflags(bool override);
|
||||||
bool makeflagsContainsJobCount() const;
|
bool makeflagsContainsJobCount() const;
|
||||||
|
bool userArgsContainsJobCount() const;
|
||||||
|
|
||||||
Utils::Environment environment(BuildConfiguration *bc) const;
|
Utils::Environment environment(BuildConfiguration *bc) const;
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ private:
|
|||||||
void updateDetails();
|
void updateDetails();
|
||||||
void setSummaryText(const QString &text);
|
void setSummaryText(const QString &text);
|
||||||
void setUserJobCountVisible(bool visible);
|
void setUserJobCountVisible(bool visible);
|
||||||
|
void setUserJobCountEnabled(bool enabled);
|
||||||
|
|
||||||
Internal::Ui::MakeStep *m_ui;
|
Internal::Ui::MakeStep *m_ui;
|
||||||
MakeStep *m_makeStep;
|
MakeStep *m_makeStep;
|
||||||
|
Reference in New Issue
Block a user