Commit 68d6bfe3 authored by dt's avatar dt
Browse files

Output parsers: Make target specific code pseudo generic

Introduce IOutputParser::setWorkingDirectory and
IOutputParser::hasFatalErrors()

Reviewed-By: hunger
parent f8073770
......@@ -142,9 +142,10 @@ bool MakeStep::init()
pp->setCommand(bc->toolChain()->makeCommand());
pp->setArguments(arguments);
setOutputParser(new ProjectExplorer::GnuMakeParser(pp->effectiveWorkingDirectory()));
setOutputParser(new ProjectExplorer::GnuMakeParser());
if (bc->toolChain())
appendOutputParser(bc->toolChain()->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
......
......@@ -111,9 +111,10 @@ bool GenericMakeStep::init()
pp->setCommand(makeCommand());
pp->setArguments(allArguments());
setOutputParser(new ProjectExplorer::GnuMakeParser(pp->effectiveWorkingDirectory()));
setOutputParser(new ProjectExplorer::GnuMakeParser());
if (bc->genericTarget()->genericProject()->toolChain())
appendOutputParser(bc->genericTarget()->genericProject()->toolChain()->outputParser());
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
}
......
......@@ -42,7 +42,7 @@ namespace {
const char * const MAKE_PATTERN("^(([A-Za-z]:)?[/\\\\][^:]*[/\\\\])?(mingw(32|64)-|g)?make(.exe)?(\\[\\d+\\])?:\\s");
}
GnuMakeParser::GnuMakeParser(const QString &dir) :
GnuMakeParser::GnuMakeParser() :
m_suppressIssues(false),
m_fatalErrorCount(0)
{
......@@ -54,12 +54,17 @@ GnuMakeParser::GnuMakeParser(const QString &dir) :
m_makeLine.setMinimal(true);
m_makefileError.setPattern(QLatin1String("^(.*):(\\d+):\\s\\*\\*\\*\\s(.*)$"));
m_makefileError.setMinimal(true);
addDirectory(dir);
}
int GnuMakeParser::fatalErrors() const
void GnuMakeParser::setWorkingDirectory(const QString &workingDirectory)
{
return m_fatalErrorCount;
addDirectory(workingDirectory);
IOutputParser::setWorkingDirectory(workingDirectory);
}
bool GnuMakeParser::hasFatalErrors() const
{
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
}
void GnuMakeParser::stdOutput(const QString &line)
......
......@@ -42,14 +42,16 @@ class PROJECTEXPLORER_EXPORT GnuMakeParser : public ProjectExplorer::IOutputPars
Q_OBJECT
public:
explicit GnuMakeParser(const QString &dir = QString());
explicit GnuMakeParser();
virtual void stdOutput(const QString &line);
virtual void stdError(const QString &line);
virtual void setWorkingDirectory(const QString &workingDirectory);
QStringList searchDirectories() const;
int fatalErrors() const;
bool hasFatalErrors() const;
public slots:
virtual void taskAdded(const ProjectExplorer::Task &task);
......
......@@ -103,4 +103,15 @@ void IOutputParser::taskAdded(const ProjectExplorer::Task &task)
emit addTask(task);
}
bool IOutputParser::hasFatalErrors() const
{
return false || (m_parser && m_parser->hasFatalErrors());
}
void IOutputParser::setWorkingDirectory(const QString &workingDirectory)
{
if (m_parser)
m_parser->setWorkingDirectory(workingDirectory);
}
}
......@@ -63,6 +63,11 @@ public:
/// Called once for each line if standard error to parse.
virtual void stdError(const QString &line);
// This is mainly a symbian specific quirk
virtual bool hasFatalErrors() const;
// For GnuMakeParser
virtual void setWorkingDirectory(const QString &workingDirectory);
signals:
/// Should be emitted whenever some additional information should be
/// added to the output.
......
......@@ -183,24 +183,14 @@ bool MakeStep::init()
setEnabled(true);
pp->setArguments(args);
m_gnuMakeParser = 0;
if (bc->qtVersion()->supportsTargetId(Qt4ProjectManager::Constants::S60_DEVICE_TARGET_ID) ||
bc->qtVersion()->supportsTargetId(Qt4ProjectManager::Constants::S60_EMULATOR_TARGET_ID)) {
if (bc->qtVersion()->isBuildWithSymbianSbsV2()) {
setOutputParser(new SbsV2Parser);
} else {
setOutputParser(new AbldParser);
m_gnuMakeParser = new ProjectExplorer::GnuMakeParser(workingDirectory);
appendOutputParser(m_gnuMakeParser);
}
} else {
setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory));
}
appendOutputParser(new QtParser);
m_makeParser = bc->qtVersion()->createOutputParser();
m_makeParser->appendOutputParser(new QtParser);
if (toolchain)
appendOutputParser(toolchain->outputParser());
m_makeParser->appendOutputParser(toolchain->outputParser());
m_makeParser->setWorkingDirectory(workingDirectory);
setOutputParser(m_makeParser);
return AbstractProcessStep::init();
}
......@@ -218,8 +208,8 @@ void MakeStep::run(QFutureInterface<bool> & fi)
bool MakeStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
{
// Symbian does retun 0, even on failed makes! So we check for fatal make errors here.
if (m_gnuMakeParser)
return m_gnuMakeParser->fatalErrors() == 0;
if (m_makeParser && m_makeParser->hasFatalErrors())
return false;
return AbstractProcessStep::processSucceeded(exitCode, status);
}
......
......@@ -110,7 +110,7 @@ private:
bool m_clean;
QString m_userArgs;
QString m_makeCmd;
ProjectExplorer::GnuMakeParser * m_gnuMakeParser;
ProjectExplorer::IOutputParser *m_makeParser;
};
class MakeStepConfigWidget : public ProjectExplorer::BuildStepConfigWidget
......
......@@ -409,11 +409,12 @@ bool S60CreatePackageStep::createOnePackage()
m_outputParserChain = new Qt4ProjectManager::AbldParser;
m_outputParserChain->appendOutputParser(new ProjectExplorer::GnuMakeParser);
} else {
m_outputParserChain = new ProjectExplorer::GnuMakeParser(wd.absolutePath());
m_outputParserChain = new ProjectExplorer::GnuMakeParser();
}
Q_ASSERT(!m_parser);
m_parser = new S60CreatePackageParser(wd.absolutePath());
m_outputParserChain->appendOutputParser(m_parser);
m_outputParserChain->setWorkingDirectory(wd.absolutePath());
connect(m_outputParserChain, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)),
this, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)));
......
......@@ -36,10 +36,13 @@
#include "qt-maemo/maemomanager.h"
#include "qt-s60/s60manager.h"
#include "qt-s60/s60projectchecker.h"
#include "qt-s60/abldparser.h"
#include "qt-s60/sbsv2parser.h"
#include "qmlobservertool.h"
#include "qmldumptool.h"
#include <projectexplorer/debugginghelper.h>
#include <projectexplorer/gnumakeparser.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/cesdkhandler.h>
......@@ -669,6 +672,21 @@ bool QtVersion::supportsShadowBuilds() const
return true;
}
ProjectExplorer::IOutputParser *QtVersion::createOutputParser() const
{
if (supportsTargetId(Qt4ProjectManager::Constants::S60_DEVICE_TARGET_ID) ||
supportsTargetId(Qt4ProjectManager::Constants::S60_EMULATOR_TARGET_ID)) {
if (isBuildWithSymbianSbsV2()) {
return new SbsV2Parser;
} else {
ProjectExplorer::IOutputParser *parser = new AbldParser;
parser->appendOutputParser(new ProjectExplorer::GnuMakeParser);
return parser;
}
}
return new ProjectExplorer::GnuMakeParser;
}
QList<ProjectExplorer::Task>
QtVersion::reportIssues(const QString &proFile, const QString &buildDir)
{
......
......@@ -31,6 +31,8 @@
#define QTVERSIONMANAGER_H
#include "qt4projectmanager_global.h"
#include <projectexplorer/ioutputparser.h>
#include <projectexplorer/taskwindow.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/task.h>
......@@ -173,6 +175,8 @@ public:
/// warnings and finally info items.
QList<ProjectExplorer::Task> reportIssues(const QString &proFile, const QString &buildDir);
ProjectExplorer::IOutputParser *createOutputParser() const;
private:
QList<QSharedPointer<ProjectExplorer::ToolChain> > toolChains() const;
static int getUniqueId();
......
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