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