From 032dd4a340e9285e231f08d883e8d78cd1f6e0d0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 14 May 2018 12:11:10 +0200 Subject: [PATCH] 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 --- .../genericprojectmanager/genericmakestep.cpp | 2 +- src/plugins/projectexplorer/makestep.cpp | 32 +++++++++++-------- src/plugins/projectexplorer/makestep.h | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/plugins/genericprojectmanager/genericmakestep.cpp b/src/plugins/genericprojectmanager/genericmakestep.cpp index 739c8211a02..d8d22395f88 100644 --- a/src/plugins/genericprojectmanager/genericmakestep.cpp +++ b/src/plugins/genericprojectmanager/genericmakestep.cpp @@ -71,7 +71,7 @@ bool GenericMakeStep::init(QList &earlierSteps) Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - pp->setCommand(makeCommand(bc->environment())); + pp->setCommand(effectiveMakeCommand()); pp->setArguments(allArguments()); pp->resolveAll(); diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index da2c691bfe0..7c7b6457148 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -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(); diff --git a/src/plugins/projectexplorer/makestep.h b/src/plugins/projectexplorer/makestep.h index 5fe669e985a..e6a5ffc6cd3 100644 --- a/src/plugins/projectexplorer/makestep.h +++ b/src/plugins/projectexplorer/makestep.h @@ -56,7 +56,7 @@ public: void setUserArguments(const QString &args); QString makeCommand() const; void setMakeCommand(const QString &command); - QString makeCommand(const Utils::Environment &environment) const; + QString effectiveMakeCommand() const; void setClean(bool clean); bool isClean() const;