Commit 9d90f8b3 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Warn if kit has no tool chain set up



Change-Id: I551402c1e3023feeeb127f001a0e908938a07fc2
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 8b05f1af
......@@ -168,14 +168,23 @@ void MakeStep::setClean(bool clean)
bool MakeStep::init()
{
AutotoolsBuildConfiguration *bc = autotoolsBuildConfiguration();
if (!bc)
bc = static_cast<AutotoolsBuildConfiguration *>(target()->activeBuildConfiguration());
m_tasks.clear();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
setIgnoreReturnValue(m_clean);
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setEnvironment(bc->environment());
......@@ -193,6 +202,18 @@ bool MakeStep::init()
void MakeStep::run(QFutureInterface<bool> &interface)
{
// Warn on common error conditions:
bool canContinue = true;
foreach (const Task &t, m_tasks) {
addTask(t);
canContinue = false;
}
if (!canContinue) {
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
interface.reportResult(false);
return;
}
AbstractProcessStep::run(interface);
}
......
......@@ -36,6 +36,7 @@
#define MAKESTEP_H
#include <projectexplorer/abstractprocessstep.h>
#include <projectexplorer/task.h>
QT_BEGIN_NAMESPACE
class QLineEdit;
......@@ -124,6 +125,7 @@ private:
QStringList m_buildTargets;
QString m_additionalArguments;
bool m_clean;
QList<ProjectExplorer::Task> m_tasks;
};
///////////////////////////////
......
......@@ -132,12 +132,20 @@ bool MakeStep::init()
if (!bc)
bc = static_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
m_tasks.clear();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
Utils::QtcProcess::addArgs(&arguments, additionalArguments());
setIgnoreReturnValue(m_clean);
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setEnvironment(bc->environment());
......@@ -158,6 +166,17 @@ bool MakeStep::init()
void MakeStep::run(QFutureInterface<bool> &fi)
{
bool canContinue = true;
foreach (const Task &t, m_tasks) {
addTask(t);
canContinue = false;
}
if (!canContinue) {
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
fi.reportResult(false);
return;
}
m_futureInterface = &fi;
m_futureInterface->setProgressRange(0, 100);
AbstractProcessStep::run(fi);
......
......@@ -94,6 +94,7 @@ private:
QFutureInterface<bool> *m_futureInterface;
QStringList m_buildTargets;
QString m_additionalArguments;
QList<ProjectExplorer::Task> m_tasks;
};
class MakeStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
......
......@@ -106,6 +106,15 @@ bool GenericMakeStep::init()
if (!bc)
bc = static_cast<GenericBuildConfiguration *>(target()->activeBuildConfiguration());
m_tasks.clear();
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory());
......@@ -119,7 +128,6 @@ bool GenericMakeStep::init()
setIgnoreReturnValue(m_clean);
setOutputParser(new GnuMakeParser());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (tc)
appendOutputParser(tc->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
......@@ -180,6 +188,17 @@ QString GenericMakeStep::makeCommand() const
void GenericMakeStep::run(QFutureInterface<bool> &fi)
{
bool canContinue = true;
foreach (const Task &t, m_tasks) {
addTask(t);
canContinue = false;
}
if (!canContinue) {
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
fi.reportResult(false);
return;
}
AbstractProcessStep::run(fi);
}
......
......@@ -85,6 +85,7 @@ private:
QString m_makeArguments;
QString m_makeCommand;
bool m_clean;
QList<ProjectExplorer::Task> m_tasks;
};
class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
......
......@@ -144,18 +144,11 @@ bool MakeStep::init()
bc = qobject_cast<Qt4BuildConfiguration *>(target()->activeBuildConfiguration());
m_tasks.clear();
if (!bc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a build configuration set up to build. Configure a target in Project mode."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the target options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
m_tasks.append(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
return true; // otherwise the tasks will not get reported
}
......@@ -278,12 +271,10 @@ bool MakeStep::init()
void MakeStep::run(QFutureInterface<bool> & fi)
{
// Warn on common error conditions:
bool canContinue = true;
foreach (const Task &t, m_tasks) {
addTask(t);
if (t.type == Task::Error)
canContinue = false;
canContinue = false;
}
if (!canContinue) {
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment