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