forked from qt-creator/qt-creator
BuildSteps: emitting tasks from init() works fine
Change-Id: Ida5c7e9eea197d12ebe6e4bd86e90b2ef7e7a100 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -165,13 +165,13 @@ bool MakeStep::init()
|
||||
if (!bc)
|
||||
bc = 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."),
|
||||
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)));
|
||||
return true; // otherwise the tasks will not get reported
|
||||
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
QString arguments = Utils::QtcProcess::joinArgs(m_buildTargets);
|
||||
@@ -202,19 +202,6 @@ 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);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractProcessStep::run(interface);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ private:
|
||||
QStringList m_buildTargets;
|
||||
QString m_additionalArguments;
|
||||
bool m_clean;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
@@ -104,13 +104,13 @@ bool GenericMakeStep::init()
|
||||
if (!bc)
|
||||
bc = 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."),
|
||||
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)));
|
||||
return true; // otherwise the tasks will not get reported
|
||||
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
@@ -192,18 +192,6 @@ QString GenericMakeStep::makeCommand(const Utils::Environment &environment) cons
|
||||
|
||||
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);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ private:
|
||||
QString m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
bool m_clean;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
||||
class GenericMakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
|
||||
@@ -111,14 +111,14 @@ bool IosBuildStep::init()
|
||||
if (!bc)
|
||||
bc = target()->activeBuildConfiguration();
|
||||
|
||||
m_tasks.clear();
|
||||
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));
|
||||
m_tasks.append(t);
|
||||
emit addTask(t);
|
||||
emit addOutput(tr("Configuration is faulty. Check the Issues output pane for details."),
|
||||
BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
ProcessParameters *pp = processParameters();
|
||||
@@ -217,19 +217,6 @@ QString IosBuildStep::buildCommand() const
|
||||
|
||||
void IosBuildStep::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 output pane for details."),
|
||||
BuildStep::MessageOutput);
|
||||
fi.reportResult(false);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ private:
|
||||
QString m_buildCommand;
|
||||
bool m_useDefaultArguments;
|
||||
bool m_clean;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
||||
class IosBuildStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
|
||||
@@ -157,13 +157,13 @@ bool MakeStep::init()
|
||||
if (!bc)
|
||||
bc = qobject_cast<QmakeBuildConfiguration *>(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."),
|
||||
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)));
|
||||
return true; // otherwise the tasks will not get reported
|
||||
emit addOutput(tr("Configuration is faulty. Check the Issues view for details."), BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
@@ -269,18 +269,6 @@ 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);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_scriptTarget) {
|
||||
fi.reportResult(true);
|
||||
emit finished();
|
||||
|
||||
@@ -113,7 +113,6 @@ private:
|
||||
QString m_makeFileToCheck;
|
||||
QString m_userArgs;
|
||||
QString m_makeCmd;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
||||
class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
|
||||
|
||||
@@ -274,8 +274,21 @@ bool QMakeStep::init()
|
||||
node = qt4bc->subNodeBuild();
|
||||
QString proFile = node->path();
|
||||
|
||||
m_tasks = qtVersion->reportIssues(proFile, workingDirectory);
|
||||
qSort(m_tasks);
|
||||
QList<ProjectExplorer::Task> tasks = qtVersion->reportIssues(proFile, workingDirectory);
|
||||
qSort(tasks);
|
||||
|
||||
if (!tasks.isEmpty()) {
|
||||
bool canContinue = true;
|
||||
foreach (const ProjectExplorer::Task &t, tasks) {
|
||||
addTask(t);
|
||||
if (t.type == Task::Error)
|
||||
canContinue = false;
|
||||
}
|
||||
if (!canContinue) {
|
||||
emit addOutput(tr("Configuration is faulty, please check the Issues view for details."), BuildStep::MessageOutput);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_scriptTemplate = node->projectType() == ScriptTemplate;
|
||||
|
||||
@@ -289,20 +302,6 @@ void QMakeStep::run(QFutureInterface<bool> &fi)
|
||||
return;
|
||||
}
|
||||
|
||||
// Warn on common error conditions:
|
||||
bool canContinue = true;
|
||||
foreach (const ProjectExplorer::Task &t, m_tasks) {
|
||||
addTask(t);
|
||||
if (t.type == Task::Error)
|
||||
canContinue = false;
|
||||
}
|
||||
if (!canContinue) {
|
||||
emit addOutput(tr("Configuration is faulty, please check the Issues view for details."), BuildStep::MessageOutput);
|
||||
fi.reportResult(false);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_needToRunQMake) {
|
||||
emit addOutput(tr("Configuration unchanged, skipping qmake step."), BuildStep::MessageOutput);
|
||||
fi.reportResult(true);
|
||||
|
||||
@@ -135,7 +135,6 @@ private:
|
||||
QString m_userArgs;
|
||||
QmlLibraryLink m_linkQmlDebuggingLibrary;
|
||||
bool m_scriptTemplate;
|
||||
QList<ProjectExplorer::Task> m_tasks;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user