forked from qt-creator/qt-creator
MakeStep: Fix that make command could not be set without tool chain
Both the configuration widget and the build itself were complaining that a tool chain is needed, even though the build in the end cares only about the make command, not the tool chain. Change-Id: I5be0f44376a446bd76053f5365c842384d71be30 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -66,11 +66,11 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
if (!bc)
|
||||
emit addTask(Task::buildConfigurationMissingTask());
|
||||
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (!tc)
|
||||
emit addTask(Task::compilerMissingTask());
|
||||
const QString make = effectiveMakeCommand();
|
||||
if (make.isEmpty())
|
||||
emit addTask(makeCommandMissingTask());
|
||||
|
||||
if (!bc || !tc) {
|
||||
if (!bc || make.isEmpty()) {
|
||||
emitFaultyConfigurationMessage();
|
||||
return false;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
Utils::Environment env = bc->environment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommand(effectiveMakeCommand());
|
||||
pp->setCommand(make);
|
||||
pp->setArguments(allArguments());
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -114,6 +114,29 @@ QString MakeStep::defaultDisplayName()
|
||||
return tr("Make");
|
||||
}
|
||||
|
||||
QString MakeStep::defaultMakeCommand() const
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (bc && tc)
|
||||
return tc->makeCommand(bc->environment());
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString MakeStep::msgNoMakeCommand()
|
||||
{
|
||||
return tr("Make command missing. Specify Make command in step configuration.");
|
||||
}
|
||||
|
||||
Task MakeStep::makeCommandMissingTask()
|
||||
{
|
||||
return Task(Task::Error,
|
||||
msgNoMakeCommand(),
|
||||
Utils::FileName(),
|
||||
-1,
|
||||
Constants::TASK_CATEGORY_BUILDSYSTEM);
|
||||
}
|
||||
|
||||
void MakeStep::setMakeCommand(const QString &command)
|
||||
{
|
||||
m_makeCommand = command;
|
||||
@@ -166,11 +189,7 @@ QString MakeStep::effectiveMakeCommand() const
|
||||
{
|
||||
if (!m_makeCommand.isEmpty())
|
||||
return m_makeCommand;
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (bc && tc)
|
||||
return tc->makeCommand(bc->environment());
|
||||
return QString();
|
||||
return defaultMakeCommand();
|
||||
}
|
||||
|
||||
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
@@ -290,14 +309,14 @@ void MakeStepConfigWidget::updateDetails()
|
||||
= ToolChainKitInformation::toolChain(m_makeStep->target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
|
||||
const QString make = tc && bc ? tc->makeCommand(bc->environment()) : QString();
|
||||
if (make.isEmpty())
|
||||
const QString defaultMake = m_makeStep->defaultMakeCommand();
|
||||
if (defaultMake.isEmpty())
|
||||
m_ui->makeLabel->setText(tr("Make:"));
|
||||
else
|
||||
m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(make)));
|
||||
m_ui->makeLabel->setText(tr("Override %1:").arg(QDir::toNativeSeparators(defaultMake)));
|
||||
|
||||
if (!tc) {
|
||||
setSummaryText(tr("<b>Make:</b> %1").arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget()));
|
||||
if (m_makeStep->effectiveMakeCommand().isEmpty()) {
|
||||
setSummaryText(tr("<b>Make:</b> %1").arg(MakeStep::msgNoMakeCommand()));
|
||||
return;
|
||||
}
|
||||
if (!bc) {
|
||||
|
@@ -64,6 +64,10 @@ public:
|
||||
|
||||
static QString defaultDisplayName();
|
||||
|
||||
QString defaultMakeCommand() const;
|
||||
static QString msgNoMakeCommand();
|
||||
static Task makeCommandMissingTask();
|
||||
|
||||
private:
|
||||
QVariantMap toMap() const override;
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
@@ -71,11 +71,11 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
if (!bc)
|
||||
emit addTask(Task::buildConfigurationMissingTask());
|
||||
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (!tc)
|
||||
emit addTask(Task::compilerMissingTask());
|
||||
const QString make = effectiveMakeCommand();
|
||||
if (make.isEmpty())
|
||||
emit addTask(makeCommandMissingTask());
|
||||
|
||||
if (!bc || !tc) {
|
||||
if (!bc || make.isEmpty()) {
|
||||
emitFaultyConfigurationMessage();
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
workingDirectory = bc->buildDirectory().toString();
|
||||
pp->setWorkingDirectory(workingDirectory);
|
||||
|
||||
pp->setCommand(effectiveMakeCommand());
|
||||
pp->setCommand(make);
|
||||
|
||||
// If we are cleaning, then make can fail with a error code, but that doesn't mean
|
||||
// we should stop the clean queue
|
||||
@@ -154,6 +154,8 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
Utils::Environment env = bc->environment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(),
|
||||
ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
if (tc && makeCommand().isEmpty()) {
|
||||
if (tc->targetAbi().os() == Abi::WindowsOS
|
||||
&& tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) {
|
||||
|
Reference in New Issue
Block a user