Commit 4eb2908c authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Unify "missing compiler" and "missing build configuration" tasks



Everybody used to do their own thing...

Also unify the "Configuration is faulty" message we write into the
Application output window.

Change-Id: I0e5c4ec68155d66aa1d0ea53134b98917869e5c6
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 43735f28
......@@ -164,13 +164,15 @@ bool MakeStep::init()
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
emit addTask(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)));
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!tc || !bc) {
emitFaultyConfigurationMessage();
return false;
}
......
......@@ -177,21 +177,15 @@ bool MakeStep::init()
if (!bc)
bc = targetsActiveBuildConfiguration();
if (!bc) {
emit addTask(Task(Task::Error, tr("Qt Creator needs a build configuration set up to build. Configure a build configuration in the project settings."),
Utils::FileName(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
emit addTask(Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit options."),
Utils::FileName(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
emitFaultyConfigurationMessage();
return false;
}
......
......@@ -103,13 +103,15 @@ bool GenericMakeStep::init()
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
emit addTask(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)));
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emitFaultyConfigurationMessage();
return false;
}
......
......@@ -110,17 +110,18 @@ bool IosBuildStep::init()
BuildConfiguration *bc = buildConfiguration();
if (!bc)
bc = target()->activeBuildConfiguration();
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
Task t = Task(Task::Error, tr("Qt Creator needs a compiler set up to build. Configure a compiler in the kit preferences."),
Utils::FileName(), -1,
Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(t);
emit addOutput(tr("Configuration is faulty. Check the Issues output pane for details."),
BuildStep::MessageOutput);
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emitFaultyConfigurationMessage();
return false;
}
ProcessParameters *pp = processParameters();
pp->setMacroExpander(bc->macroExpander());
pp->setWorkingDirectory(bc->buildDirectory().toString());
......
......@@ -149,6 +149,12 @@ ProjectExplorer::IOutputParser *AbstractProcessStep::outputParser() const
return m_outputParserChain;
}
void AbstractProcessStep::emitFaultyConfigurationMessage()
{
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."),
BuildStep::MessageOutput);
}
bool AbstractProcessStep::ignoreReturnValue()
{
return m_ignoreReturnValue;
......
......@@ -65,6 +65,9 @@ public:
void setOutputParser(ProjectExplorer::IOutputParser *parser);
void appendOutputParser(ProjectExplorer::IOutputParser *parser);
ProjectExplorer::IOutputParser *outputParser() const;
void emitFaultyConfigurationMessage();
protected:
AbstractProcessStep(BuildStepList *bsl, const Core::Id id);
AbstractProcessStep(BuildStepList *bsl, AbstractProcessStep *bs);
......
......@@ -32,6 +32,8 @@
#include <coreplugin/coreconstants.h>
#include <utils/qtcassert.h>
#include "projectexplorerconstants.h"
namespace ProjectExplorer
{
......@@ -69,6 +71,26 @@ Task::Task(TaskType type_, const QString &description_,
++s_nextId;
}
Task Task::compilerMissingTask()
{
return Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"Qt Creator needs a compiler set up to build. "
"Configure a compiler in the kit options."),
Utils::FileName(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
}
Task Task::buildConfigurationMissingTask()
{
return Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"Qt Creator needs a build configuration set up to build. "
"Configure a build configuration in the project settings."),
Utils::FileName(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
}
void Task::addMark(TextEditor::BaseTextMark *mark)
{
QTC_ASSERT(m_mark.isNull(), return);
......
......@@ -57,6 +57,9 @@ public:
const Utils::FileName &file, int line, Core::Id category,
const Utils::FileName &iconName = Utils::FileName());
static Task compilerMissingTask();
static Task buildConfigurationMissingTask();
bool isNull() const;
void clear();
......@@ -79,6 +82,7 @@ public:
// doesn't work if you split it up, nor are our parsers
// anywhere near being that good
QList<QTextLayout::FormatRange> formats;
private:
QSharedPointer<TextEditor::BaseTextMark> m_mark;
static unsigned int s_nextId;
......
......@@ -157,13 +157,15 @@ bool MakeStep::init()
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
if (!bc)
bc = qobject_cast<QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
if (!bc)
emit addTask(Task::buildConfigurationMissingTask());
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit());
if (!tc) {
emit addTask(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)));
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
if (!tc)
emit addTask(Task::compilerMissingTask());
if (!bc || !tc) {
emitFaultyConfigurationMessage();
return false;
}
......
......@@ -286,7 +286,7 @@ bool QMakeStep::init()
canContinue = false;
}
if (!canContinue) {
emit addOutput(tr("Configuration is faulty, please check the Issues view for details."), BuildStep::MessageOutput);
emitFaultyConfigurationMessage();
return false;
}
}
......
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