Add effectiveMakeCommand to MakeStep base

Similar to the make step from qmakeprojectmanager.
There is an internal semantic change when there is no C++ toolchain: Now
the effective make command will be empty in that case. Before this patch
it was defaulting to "make", but init() was never using that because it
also checks for an existing C++ toolchain, so there is no visible
change, and actually more consistent now.

Change-Id: I31157fee63c465b4b61701d76152f3ad172c29e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2018-05-14 12:11:10 +02:00
parent 7adbdf050e
commit 032dd4a340
3 changed files with 21 additions and 15 deletions

View File

@@ -115,17 +115,17 @@ QString MakeStep::makeCommand() const
return m_makeCommand;
}
QString MakeStep::makeCommand(const Utils::Environment &environment) const
QString MakeStep::effectiveMakeCommand() const
{
QString command = m_makeCommand;
if (command.isEmpty()) {
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (tc)
command = tc->makeCommand(environment);
else
command = "make";
}
return command;
if (!m_makeCommand.isEmpty())
return m_makeCommand;
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (bc && tc)
return tc->makeCommand(bc->environment());
return QString();
}
BuildStepConfigWidget *MakeStep::createConfigWidget()
@@ -227,8 +227,14 @@ void MakeStepConfigWidget::updateMakeOverrideLabel()
BuildConfiguration *bc = m_makeStep->buildConfiguration();
if (!bc)
bc = m_makeStep->target()->activeBuildConfiguration();
m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(m_makeStep->makeCommand(bc->environment()))));
ToolChain *tc = ToolChainKitInformation::toolChain(m_makeStep->target()->kit(),
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (bc && tc) {
m_ui->makeLabel->setText(
tr("Override %1:").arg(QDir::toNativeSeparators(tc->makeCommand(bc->environment()))));
} else {
m_ui->makeLabel->setText(tr("Make:"));
}
}
void MakeStepConfigWidget::updateDetails()
@@ -241,7 +247,7 @@ void MakeStepConfigWidget::updateDetails()
param.setMacroExpander(bc->macroExpander());
param.setWorkingDirectory(bc->buildDirectory().toString());
param.setEnvironment(bc->environment());
param.setCommand(m_makeStep->makeCommand(bc->environment()));
param.setCommand(m_makeStep->effectiveMakeCommand());
param.setArguments(m_makeStep->allArguments());
m_summaryText = param.summary(displayName());
emit updateSummary();