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)
|
if (!bc)
|
||||||
emit addTask(Task::buildConfigurationMissingTask());
|
emit addTask(Task::buildConfigurationMissingTask());
|
||||||
|
|
||||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
const QString make = effectiveMakeCommand();
|
||||||
if (!tc)
|
if (make.isEmpty())
|
||||||
emit addTask(Task::compilerMissingTask());
|
emit addTask(makeCommandMissingTask());
|
||||||
|
|
||||||
if (!bc || !tc) {
|
if (!bc || make.isEmpty()) {
|
||||||
emitFaultyConfigurationMessage();
|
emitFaultyConfigurationMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
Utils::Environment::setupEnglishOutput(&env);
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
pp->setEnvironment(env);
|
pp->setEnvironment(env);
|
||||||
pp->setCommand(effectiveMakeCommand());
|
pp->setCommand(make);
|
||||||
pp->setArguments(allArguments());
|
pp->setArguments(allArguments());
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
@@ -114,6 +114,29 @@ QString MakeStep::defaultDisplayName()
|
|||||||
return tr("Make");
|
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)
|
void MakeStep::setMakeCommand(const QString &command)
|
||||||
{
|
{
|
||||||
m_makeCommand = command;
|
m_makeCommand = command;
|
||||||
@@ -166,11 +189,7 @@ QString MakeStep::effectiveMakeCommand() const
|
|||||||
{
|
{
|
||||||
if (!m_makeCommand.isEmpty())
|
if (!m_makeCommand.isEmpty())
|
||||||
return m_makeCommand;
|
return m_makeCommand;
|
||||||
BuildConfiguration *bc = buildConfiguration();
|
return defaultMakeCommand();
|
||||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
|
||||||
if (bc && tc)
|
|
||||||
return tc->makeCommand(bc->environment());
|
|
||||||
return QString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||||
@@ -290,14 +309,14 @@ void MakeStepConfigWidget::updateDetails()
|
|||||||
= ToolChainKitInformation::toolChain(m_makeStep->target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
= ToolChainKitInformation::toolChain(m_makeStep->target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||||
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||||
|
|
||||||
const QString make = tc && bc ? tc->makeCommand(bc->environment()) : QString();
|
const QString defaultMake = m_makeStep->defaultMakeCommand();
|
||||||
if (make.isEmpty())
|
if (defaultMake.isEmpty())
|
||||||
m_ui->makeLabel->setText(tr("Make:"));
|
m_ui->makeLabel->setText(tr("Make:"));
|
||||||
else
|
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) {
|
if (m_makeStep->effectiveMakeCommand().isEmpty()) {
|
||||||
setSummaryText(tr("<b>Make:</b> %1").arg(ProjectExplorer::ToolChainKitInformation::msgNoToolChainInTarget()));
|
setSummaryText(tr("<b>Make:</b> %1").arg(MakeStep::msgNoMakeCommand()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!bc) {
|
if (!bc) {
|
||||||
|
@@ -64,6 +64,10 @@ public:
|
|||||||
|
|
||||||
static QString defaultDisplayName();
|
static QString defaultDisplayName();
|
||||||
|
|
||||||
|
QString defaultMakeCommand() const;
|
||||||
|
static QString msgNoMakeCommand();
|
||||||
|
static Task makeCommandMissingTask();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
@@ -71,11 +71,11 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
if (!bc)
|
if (!bc)
|
||||||
emit addTask(Task::buildConfigurationMissingTask());
|
emit addTask(Task::buildConfigurationMissingTask());
|
||||||
|
|
||||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
const QString make = effectiveMakeCommand();
|
||||||
if (!tc)
|
if (make.isEmpty())
|
||||||
emit addTask(Task::compilerMissingTask());
|
emit addTask(makeCommandMissingTask());
|
||||||
|
|
||||||
if (!bc || !tc) {
|
if (!bc || make.isEmpty()) {
|
||||||
emitFaultyConfigurationMessage();
|
emitFaultyConfigurationMessage();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
workingDirectory = bc->buildDirectory().toString();
|
workingDirectory = bc->buildDirectory().toString();
|
||||||
pp->setWorkingDirectory(workingDirectory);
|
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
|
// If we are cleaning, then make can fail with a error code, but that doesn't mean
|
||||||
// we should stop the clean queue
|
// we should stop the clean queue
|
||||||
@@ -154,6 +154,8 @@ bool QmakeMakeStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
Utils::Environment env = bc->environment();
|
Utils::Environment env = bc->environment();
|
||||||
Utils::Environment::setupEnglishOutput(&env);
|
Utils::Environment::setupEnglishOutput(&env);
|
||||||
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
// 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 && makeCommand().isEmpty()) {
|
||||||
if (tc->targetAbi().os() == Abi::WindowsOS
|
if (tc->targetAbi().os() == Abi::WindowsOS
|
||||||
&& tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) {
|
&& tc->targetAbi().osFlavor() != Abi::WindowsMSysFlavor) {
|
||||||
|
Reference in New Issue
Block a user