forked from qt-creator/qt-creator
IOutputParser: Replace std{Out,Err} with a single parameterized function
Another step towards parser/formatter unification. Task-number: QTCREATORBUG-22665 Change-Id: I6de86b3aee2c54585cdd4b06d21b0ea67300aeac Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -36,18 +36,6 @@ JavaParser::JavaParser() :
|
|||||||
m_javaRegExp(QLatin1String("^(.*\\[javac\\]\\s)(.*\\.java):(\\d+):(.*)$"))
|
m_javaRegExp(QLatin1String("^(.*\\[javac\\]\\s)(.*\\.java):(\\d+):(.*)$"))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void JavaParser::stdOutput(const QString &line)
|
|
||||||
{
|
|
||||||
parse(line);
|
|
||||||
IOutputParser::stdOutput(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JavaParser::stdError(const QString &line)
|
|
||||||
{
|
|
||||||
parse(line);
|
|
||||||
IOutputParser::stdError(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JavaParser::setProjectFileList(const QStringList &fileList)
|
void JavaParser::setProjectFileList(const QStringList &fileList)
|
||||||
{
|
{
|
||||||
m_fileList = fileList;
|
m_fileList = fileList;
|
||||||
@@ -63,6 +51,12 @@ void JavaParser::setSourceDirectory(const Utils::FilePath &sourceDirectory)
|
|||||||
m_sourceDirectory = sourceDirectory;
|
m_sourceDirectory = sourceDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JavaParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
|
{
|
||||||
|
parse(line);
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
}
|
||||||
|
|
||||||
void JavaParser::parse(const QString &line)
|
void JavaParser::parse(const QString &line)
|
||||||
{
|
{
|
||||||
if (m_javaRegExp.indexIn(line) > -1) {
|
if (m_javaRegExp.indexIn(line) > -1) {
|
||||||
|
@@ -39,14 +39,13 @@ class JavaParser : public ProjectExplorer::IOutputParser
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
JavaParser();
|
JavaParser();
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
void setProjectFileList(const QStringList &fileList);
|
void setProjectFileList(const QStringList &fileList);
|
||||||
|
|
||||||
void setBuildDirectory(const Utils::FilePath &buildDirectory);
|
void setBuildDirectory(const Utils::FilePath &buildDirectory);
|
||||||
void setSourceDirectory(const Utils::FilePath &sourceDirectory);
|
void setSourceDirectory(const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void parse(const QString &line);
|
void parse(const QString &line);
|
||||||
|
|
||||||
QRegExp m_javaRegExp;
|
QRegExp m_javaRegExp;
|
||||||
|
@@ -190,9 +190,17 @@ bool IarParser::parseErrorMessage1(const QString &lne)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IarParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
void IarParser::stdError(const QString &line)
|
void IarParser::stdError(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
|
|
||||||
const QString lne = rightTrimmed(line);
|
const QString lne = rightTrimmed(line);
|
||||||
|
|
||||||
@@ -232,7 +240,7 @@ void IarParser::stdError(const QString &line)
|
|||||||
|
|
||||||
void IarParser::stdOutput(const QString &line)
|
void IarParser::stdOutput(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
|
|
||||||
const QString lne = rightTrimmed(line);
|
const QString lne = rightTrimmed(line);
|
||||||
|
|
||||||
|
@@ -52,8 +52,9 @@ private:
|
|||||||
bool parseErrorInCommandLineMessage(const QString &lne);
|
bool parseErrorInCommandLineMessage(const QString &lne);
|
||||||
bool parseErrorMessage1(const QString &lne);
|
bool parseErrorMessage1(const QString &lne);
|
||||||
|
|
||||||
void stdError(const QString &line) final;
|
void handleLine(const QString &line, Utils::OutputFormat type) final;
|
||||||
void stdOutput(const QString &line) final;
|
void stdError(const QString &line);
|
||||||
|
void stdOutput(const QString &line);
|
||||||
void doFlush() final;
|
void doFlush() final;
|
||||||
|
|
||||||
ProjectExplorer::Task m_lastTask;
|
ProjectExplorer::Task m_lastTask;
|
||||||
|
@@ -190,9 +190,17 @@ bool KeilParser::parseMcs51FatalErrorMessage2(const QString &lne)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeilParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
void KeilParser::stdError(const QString &line)
|
void KeilParser::stdError(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
|
|
||||||
const QString lne = rightTrimmed(line);
|
const QString lne = rightTrimmed(line);
|
||||||
|
|
||||||
@@ -228,7 +236,7 @@ static bool hasDetailsPointer(const QString &trimmedLine)
|
|||||||
|
|
||||||
void KeilParser::stdOutput(const QString &line)
|
void KeilParser::stdOutput(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
|
|
||||||
QString lne = rightTrimmed(line);
|
QString lne = rightTrimmed(line);
|
||||||
|
|
||||||
|
@@ -55,8 +55,9 @@ private:
|
|||||||
bool parseMcs51WarningOrFatalErrorMessage(const QString &lne);
|
bool parseMcs51WarningOrFatalErrorMessage(const QString &lne);
|
||||||
bool parseMcs51FatalErrorMessage2(const QString &lne);
|
bool parseMcs51FatalErrorMessage2(const QString &lne);
|
||||||
|
|
||||||
void stdError(const QString &line) final;
|
void handleLine(const QString &line, Utils::OutputFormat type) final;
|
||||||
void stdOutput(const QString &line) final;
|
void stdError(const QString &line);
|
||||||
|
void stdOutput(const QString &line);
|
||||||
void doFlush() final;
|
void doFlush() final;
|
||||||
|
|
||||||
ProjectExplorer::Task m_lastTask;
|
ProjectExplorer::Task m_lastTask;
|
||||||
|
@@ -87,9 +87,17 @@ void SdccParser::amendDescription(const QString &desc)
|
|||||||
++m_lines;
|
++m_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdccParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
void SdccParser::stdError(const QString &line)
|
void SdccParser::stdError(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
|
|
||||||
const QString lne = rightTrimmed(line);
|
const QString lne = rightTrimmed(line);
|
||||||
|
|
||||||
@@ -154,7 +162,7 @@ void SdccParser::stdError(const QString &line)
|
|||||||
|
|
||||||
void SdccParser::stdOutput(const QString &line)
|
void SdccParser::stdOutput(const QString &line)
|
||||||
{
|
{
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdccParser::doFlush()
|
void SdccParser::doFlush()
|
||||||
|
@@ -45,8 +45,9 @@ private:
|
|||||||
void newTask(const ProjectExplorer::Task &task);
|
void newTask(const ProjectExplorer::Task &task);
|
||||||
void amendDescription(const QString &desc);
|
void amendDescription(const QString &desc);
|
||||||
|
|
||||||
void stdError(const QString &line) final;
|
void handleLine(const QString &line, Utils::OutputFormat type) final;
|
||||||
void stdOutput(const QString &line) final;
|
void stdError(const QString &line);
|
||||||
|
void stdOutput(const QString &line);
|
||||||
void doFlush() final;
|
void doFlush() final;
|
||||||
|
|
||||||
ProjectExplorer::Task m_lastTask;
|
ProjectExplorer::Task m_lastTask;
|
||||||
|
@@ -57,10 +57,14 @@ void CMakeParser::setSourceDirectory(const QString &sourceDir)
|
|||||||
m_sourceDirectory = QDir(sourceDir);
|
m_sourceDirectory = QDir(sourceDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeParser::stdError(const QString &line)
|
void CMakeParser::handleLine(const QString &line, OutputFormat type)
|
||||||
{
|
{
|
||||||
QString trimmedLine = rightTrimmed(line);
|
if (type != StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString trimmedLine = rightTrimmed(line);
|
||||||
switch (m_expectTripleLineErrorData) {
|
switch (m_expectTripleLineErrorData) {
|
||||||
case NONE:
|
case NONE:
|
||||||
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
|
if (trimmedLine.isEmpty() && !m_lastTask.isNull()) {
|
||||||
@@ -110,7 +114,7 @@ void CMakeParser::stdError(const QString &line)
|
|||||||
// Do not pass on lines starting with "-- " or "* ". Those are typical CMake output
|
// Do not pass on lines starting with "-- " or "* ". Those are typical CMake output
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
return;
|
return;
|
||||||
case LINE_LOCATION:
|
case LINE_LOCATION:
|
||||||
{
|
{
|
||||||
|
@@ -43,12 +43,11 @@ class CMAKE_EXPORT CMakeParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
explicit CMakeParser();
|
explicit CMakeParser();
|
||||||
void setSourceDirectory(const QString &sourceDir);
|
void setSourceDirectory(const QString &sourceDir);
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void doFlush() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
void doFlush() override;
|
||||||
|
|
||||||
enum TripleLineError { NONE, LINE_LOCATION, LINE_DESCRIPTION, LINE_DESCRIPTION2 };
|
enum TripleLineError { NONE, LINE_LOCATION, LINE_DESCRIPTION, LINE_DESCRIPTION2 };
|
||||||
|
|
||||||
TripleLineError m_expectTripleLineErrorData = NONE;
|
TripleLineError m_expectTripleLineErrorData = NONE;
|
||||||
|
@@ -361,7 +361,7 @@ void ServerModeReader::createNewServer()
|
|||||||
connect(m_cmakeServer.get(), &ServerMode::cmakeMessage, [this](const QString &m) {
|
connect(m_cmakeServer.get(), &ServerMode::cmakeMessage, [this](const QString &m) {
|
||||||
const QStringList lines = m.split('\n');
|
const QStringList lines = m.split('\n');
|
||||||
for (const QString &l : lines) {
|
for (const QString &l : lines) {
|
||||||
m_parser.stdError(l);
|
m_parser.handleStderr(l);
|
||||||
Core::MessageManager::write(l);
|
Core::MessageManager::write(l);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -45,20 +45,13 @@ namespace {
|
|||||||
|
|
||||||
class NimParser : public IOutputParser
|
class NimParser : public IOutputParser
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
void stdOutput(const QString &line) final
|
|
||||||
{
|
|
||||||
parseLine(line.trimmed());
|
|
||||||
IOutputParser::stdOutput(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void stdError(const QString &line) final
|
|
||||||
{
|
|
||||||
parseLine(line.trimmed());
|
|
||||||
IOutputParser::stdError(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override
|
||||||
|
{
|
||||||
|
parseLine(line.trimmed());
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
}
|
||||||
|
|
||||||
void parseLine(const QString &line)
|
void parseLine(const QString &line)
|
||||||
{
|
{
|
||||||
static QRegularExpression regex("(.+.nim)\\((\\d+), (\\d+)\\) (.+)",
|
static QRegularExpression regex("(.+.nim)\\((\\d+), (\\d+)\\) (.+)",
|
||||||
|
@@ -47,20 +47,12 @@ namespace Nim {
|
|||||||
|
|
||||||
class NimParser : public ProjectExplorer::IOutputParser
|
class NimParser : public ProjectExplorer::IOutputParser
|
||||||
{
|
{
|
||||||
public:
|
void handleLine(const QString &line, Utils::OutputFormat type) override
|
||||||
void stdOutput(const QString &line) final
|
|
||||||
{
|
{
|
||||||
parseLine(line.trimmed());
|
parseLine(line.trimmed());
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stdError(const QString &line) final
|
|
||||||
{
|
|
||||||
parseLine(line.trimmed());
|
|
||||||
IOutputParser::stdError(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void parseLine(const QString &line)
|
void parseLine(const QString &line)
|
||||||
{
|
{
|
||||||
static QRegularExpression regex("(.+.nim)\\((\\d+), (\\d+)\\) (.+)",
|
static QRegularExpression regex("(.+.nim)\\((\\d+), (\\d+)\\) (.+)",
|
||||||
|
@@ -54,8 +54,12 @@ ClangParser::ClangParser() :
|
|||||||
setObjectName(QLatin1String("ClangParser"));
|
setObjectName(QLatin1String("ClangParser"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangParser::stdError(const QString &line)
|
void ClangParser::handleLine(const QString &line, OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const QString lne = rightTrimmed(line);
|
const QString lne = rightTrimmed(line);
|
||||||
QRegularExpressionMatch match = m_summaryRegExp.match(lne);
|
QRegularExpressionMatch match = m_summaryRegExp.match(lne);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
@@ -107,7 +111,7 @@ void ClangParser::stdError(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id ClangParser::id()
|
Core::Id ClangParser::id()
|
||||||
|
@@ -38,11 +38,12 @@ class PROJECTEXPLORER_EXPORT ClangParser : public ProjectExplorer::GccParser
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ClangParser();
|
ClangParser();
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
QRegularExpression m_commandRegExp;
|
QRegularExpression m_commandRegExp;
|
||||||
QRegularExpression m_inLineRegExp;
|
QRegularExpression m_inLineRegExp;
|
||||||
QRegularExpression m_messageRegExp;
|
QRegularExpression m_messageRegExp;
|
||||||
|
@@ -118,22 +118,6 @@ CustomParser::CustomParser(const CustomParserSettings &settings)
|
|||||||
setSettings(settings);
|
setSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomParser::stdError(const QString &line)
|
|
||||||
{
|
|
||||||
if (parseLine(line, CustomParserExpression::ParseStdErrChannel))
|
|
||||||
return;
|
|
||||||
|
|
||||||
IOutputParser::stdError(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomParser::stdOutput(const QString &line)
|
|
||||||
{
|
|
||||||
if (parseLine(line, CustomParserExpression::ParseStdOutChannel))
|
|
||||||
return;
|
|
||||||
|
|
||||||
IOutputParser::stdOutput(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomParser::setSettings(const CustomParserSettings &settings)
|
void CustomParser::setSettings(const CustomParserSettings &settings)
|
||||||
{
|
{
|
||||||
m_error = settings.error;
|
m_error = settings.error;
|
||||||
@@ -145,6 +129,16 @@ Core::Id CustomParser::id()
|
|||||||
return Core::Id("ProjectExplorer.OutputParser.Custom");
|
return Core::Id("ProjectExplorer.OutputParser.Custom");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CustomParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
const CustomParserExpression::CustomParserChannel channel = type == StdErrFormat
|
||||||
|
? CustomParserExpression::ParseStdErrChannel
|
||||||
|
: CustomParserExpression::ParseStdOutChannel;
|
||||||
|
if (parseLine(line, channel))
|
||||||
|
return;
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
}
|
||||||
|
|
||||||
bool CustomParser::hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
bool CustomParser::hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
||||||
const CustomParserExpression &expression, Task::TaskType taskType)
|
const CustomParserExpression &expression, Task::TaskType taskType)
|
||||||
{
|
{
|
||||||
|
@@ -86,14 +86,13 @@ class CustomParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
CustomParser(const CustomParserSettings &settings = CustomParserSettings());
|
CustomParser(const CustomParserSettings &settings = CustomParserSettings());
|
||||||
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
|
|
||||||
void setSettings(const CustomParserSettings &settings);
|
void setSettings(const CustomParserSettings &settings);
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
bool hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
bool hasMatch(const QString &line, CustomParserExpression::CustomParserChannel channel,
|
||||||
const CustomParserExpression &expression, Task::TaskType taskType);
|
const CustomParserExpression &expression, Task::TaskType taskType);
|
||||||
bool parseLine(const QString &rawLine, CustomParserExpression::CustomParserChannel channel);
|
bool parseLine(const QString &rawLine, CustomParserExpression::CustomParserChannel channel);
|
||||||
|
@@ -71,7 +71,7 @@ void GccParser::stdError(const QString &line)
|
|||||||
// Blacklist some lines to not handle them:
|
// Blacklist some lines to not handle them:
|
||||||
if (lne.startsWith(QLatin1String("TeamBuilder ")) ||
|
if (lne.startsWith(QLatin1String("TeamBuilder ")) ||
|
||||||
lne.startsWith(QLatin1String("distcc["))) {
|
lne.startsWith(QLatin1String("distcc["))) {
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,13 +130,13 @@ void GccParser::stdError(const QString &line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
doFlush();
|
doFlush();
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GccParser::stdOutput(const QString &line)
|
void GccParser::stdOutput(const QString &line)
|
||||||
{
|
{
|
||||||
doFlush();
|
doFlush();
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id GccParser::id()
|
Core::Id GccParser::id()
|
||||||
@@ -180,6 +180,14 @@ void GccParser::amendDescription(const QString &desc, bool monospaced)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GccParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
// Unit tests:
|
// Unit tests:
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
@@ -40,9 +40,6 @@ class PROJECTEXPLORER_EXPORT GccParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
GccParser();
|
GccParser();
|
||||||
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -52,6 +49,11 @@ protected:
|
|||||||
void amendDescription(const QString &desc, bool monospaced);
|
void amendDescription(const QString &desc, bool monospaced);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
|
void stdError(const QString &line);
|
||||||
|
void stdOutput(const QString &line);
|
||||||
|
|
||||||
QRegularExpression m_regExp;
|
QRegularExpression m_regExp;
|
||||||
QRegularExpression m_regExpIncluded;
|
QRegularExpression m_regExpIncluded;
|
||||||
QRegularExpression m_regExpGccNames;
|
QRegularExpression m_regExpGccNames;
|
||||||
|
@@ -56,6 +56,14 @@ GnuMakeParser::GnuMakeParser()
|
|||||||
QTC_CHECK(m_errorInMakefile.isValid());
|
QTC_CHECK(m_errorInMakefile.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GnuMakeParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
bool GnuMakeParser::hasFatalErrors() const
|
bool GnuMakeParser::hasFatalErrors() const
|
||||||
{
|
{
|
||||||
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
||||||
@@ -74,7 +82,7 @@ void GnuMakeParser::stdOutput(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Result {
|
class Result {
|
||||||
@@ -145,7 +153,7 @@ void GnuMakeParser::stdError(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GnuMakeParser::emitTask(const ProjectExplorer::Task &task)
|
void GnuMakeParser::emitTask(const ProjectExplorer::Task &task)
|
||||||
|
@@ -39,12 +39,13 @@ class PROJECTEXPLORER_EXPORT GnuMakeParser : public ProjectExplorer::IOutputPars
|
|||||||
public:
|
public:
|
||||||
explicit GnuMakeParser();
|
explicit GnuMakeParser();
|
||||||
|
|
||||||
void stdOutput(const QString &line) override;
|
private:
|
||||||
void stdError(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
bool hasFatalErrors() const override;
|
bool hasFatalErrors() const override;
|
||||||
|
|
||||||
private:
|
void stdOutput(const QString &line);
|
||||||
|
void stdError(const QString &line);
|
||||||
|
|
||||||
void emitTask(const ProjectExplorer::Task &task);
|
void emitTask(const ProjectExplorer::Task &task);
|
||||||
|
|
||||||
QRegularExpression m_makeDir;
|
QRegularExpression m_makeDir;
|
||||||
|
@@ -55,15 +55,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void ProjectExplorer::IOutputParser::stdOutput(const QString &line)
|
\fn void ProjectExplorer::IOutputParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
|
|
||||||
Called once for each line if standard output to parse.
|
Called once for each line of standard output or standard error to parse.
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn void ProjectExplorer::IOutputParser::stdError(const QString &line)
|
|
||||||
|
|
||||||
Called once for each line if standard error to parse.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -109,14 +103,13 @@
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class OutputChannelState
|
class IOutputParser::OutputChannelState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using LineHandler = void (IOutputParser::*)(const QString &line);
|
using LineHandler = void (IOutputParser::*)(const QString &line);
|
||||||
|
|
||||||
OutputChannelState(IOutputParser *parser, LineHandler lineHandler,
|
OutputChannelState(IOutputParser *parser, Utils::OutputFormat type)
|
||||||
QList<IOutputParser::Filter> &filters)
|
: parser(parser), type(type) {}
|
||||||
: parser(parser), lineHandler(lineHandler), filters(filters) {}
|
|
||||||
|
|
||||||
void handleData(const QString &newData)
|
void handleData(const QString &newData)
|
||||||
{
|
{
|
||||||
@@ -128,30 +121,20 @@ public:
|
|||||||
break;
|
break;
|
||||||
const QString line = pendingData.left(eolPos + 1);
|
const QString line = pendingData.left(eolPos + 1);
|
||||||
pendingData.remove(0, eolPos + 1);
|
pendingData.remove(0, eolPos + 1);
|
||||||
(parser->*lineHandler)(filteredLine(line));
|
parser->handleLine(parser->filteredLine(line), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void flush()
|
void flush()
|
||||||
{
|
{
|
||||||
if (!pendingData.isEmpty()) {
|
if (!pendingData.isEmpty()) {
|
||||||
(parser->*lineHandler)(filteredLine(pendingData));
|
parser->handleLine(parser->filteredLine(pendingData), type);
|
||||||
pendingData.clear();
|
pendingData.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filteredLine(const QString &line)
|
|
||||||
{
|
|
||||||
QString l = line;
|
|
||||||
for (const IOutputParser::Filter &f : filters)
|
|
||||||
l = f(l);
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IOutputParser * const parser;
|
IOutputParser * const parser;
|
||||||
const LineHandler lineHandler;
|
const Utils::OutputFormat type;
|
||||||
QList<IOutputParser::Filter> &filters;
|
|
||||||
QString pendingData;
|
QString pendingData;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -159,8 +142,8 @@ class IOutputParser::IOutputParserPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IOutputParserPrivate(IOutputParser *parser)
|
IOutputParserPrivate(IOutputParser *parser)
|
||||||
: stdoutState(parser, &IOutputParser::stdOutput, filters),
|
: stdoutState(parser, Utils::StdOutFormat),
|
||||||
stderrState(parser, &IOutputParser::stdError, filters)
|
stderrState(parser, Utils::StdErrFormat)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IOutputParser *childParser = nullptr;
|
IOutputParser *childParser = nullptr;
|
||||||
@@ -218,16 +201,10 @@ void IOutputParser::setChildParser(IOutputParser *parser)
|
|||||||
connect(parser, &IOutputParser::addTask, this, &IOutputParser::addTask);
|
connect(parser, &IOutputParser::addTask, this, &IOutputParser::addTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::stdOutput(const QString &line)
|
void IOutputParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
if (d->childParser)
|
if (d->childParser)
|
||||||
d->childParser->stdOutput(line);
|
d->childParser->handleLine(line, type);
|
||||||
}
|
|
||||||
|
|
||||||
void IOutputParser::stdError(const QString &line)
|
|
||||||
{
|
|
||||||
if (d->childParser)
|
|
||||||
d->childParser->stdError(line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOutputParser::skipFileExistsCheck()
|
void IOutputParser::skipFileExistsCheck()
|
||||||
@@ -237,6 +214,14 @@ void IOutputParser::skipFileExistsCheck()
|
|||||||
|
|
||||||
void IOutputParser::doFlush() { }
|
void IOutputParser::doFlush() { }
|
||||||
|
|
||||||
|
QString IOutputParser::filteredLine(const QString &line) const
|
||||||
|
{
|
||||||
|
QString l = line;
|
||||||
|
for (const IOutputParser::Filter &f : qAsConst(d->filters))
|
||||||
|
l = f(l);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
bool IOutputParser::hasFatalErrors() const
|
bool IOutputParser::hasFatalErrors() const
|
||||||
{
|
{
|
||||||
return d->childParser && d->childParser->hasFatalErrors();
|
return d->childParser && d->childParser->hasFatalErrors();
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "buildstep.h"
|
#include "buildstep.h"
|
||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
#include <utils/outputformat.h>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@@ -70,14 +71,16 @@ signals:
|
|||||||
void addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
void addTask(const ProjectExplorer::Task &task, int linkedOutputLines = 0, int skipLines = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void stdOutput(const QString &line);
|
virtual void handleLine(const QString &line, Utils::OutputFormat type);
|
||||||
virtual void stdError(const QString &line);
|
|
||||||
|
|
||||||
Utils::FilePath absoluteFilePath(const Utils::FilePath &filePath);
|
Utils::FilePath absoluteFilePath(const Utils::FilePath &filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void doFlush();
|
virtual void doFlush();
|
||||||
|
|
||||||
|
QString filteredLine(const QString &line) const;
|
||||||
|
|
||||||
|
class OutputChannelState;
|
||||||
class IOutputParserPrivate;
|
class IOutputParserPrivate;
|
||||||
IOutputParserPrivate * const d;
|
IOutputParserPrivate * const d;
|
||||||
};
|
};
|
||||||
|
@@ -54,8 +54,12 @@ LdParser::LdParser()
|
|||||||
QTC_CHECK(m_regExpGccNames.isValid());
|
QTC_CHECK(m_regExpGccNames.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LdParser::stdError(const QString &line)
|
void LdParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != Utils::StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString lne = rightTrimmed(line);
|
QString lne = rightTrimmed(line);
|
||||||
if (!lne.isEmpty() && !lne.at(0).isSpace() && !m_incompleteTask.isNull())
|
if (!lne.isEmpty() && !lne.at(0).isSpace() && !m_incompleteTask.isNull())
|
||||||
flush();
|
flush();
|
||||||
@@ -63,7 +67,7 @@ void LdParser::stdError(const QString &line)
|
|||||||
if (lne.startsWith(QLatin1String("TeamBuilder "))
|
if (lne.startsWith(QLatin1String("TeamBuilder "))
|
||||||
|| lne.startsWith(QLatin1String("distcc["))
|
|| lne.startsWith(QLatin1String("distcc["))
|
||||||
|| lne.contains(QLatin1String("ar: creating "))) {
|
|| lne.contains(QLatin1String("ar: creating "))) {
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, Utils::StdErrFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +141,7 @@ void LdParser::stdError(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LdParser::doFlush()
|
void LdParser::doFlush()
|
||||||
|
@@ -39,7 +39,7 @@ class LdParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
LdParser();
|
LdParser();
|
||||||
private:
|
private:
|
||||||
void stdError(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void doFlush() override;
|
void doFlush() override;
|
||||||
|
|
||||||
QRegularExpression m_ranlib;
|
QRegularExpression m_ranlib;
|
||||||
|
@@ -68,8 +68,12 @@ LinuxIccParser::LinuxIccParser() :
|
|||||||
appendOutputParser(new LdParser);
|
appendOutputParser(new LdParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxIccParser::stdError(const QString &line)
|
void LinuxIccParser::handleLine(const QString &line, OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != Utils::StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (m_pchInfoLine.indexIn(line) != -1) {
|
if (m_pchInfoLine.indexIn(line) != -1) {
|
||||||
// totally ignore this line
|
// totally ignore this line
|
||||||
return;
|
return;
|
||||||
@@ -115,7 +119,7 @@ void LinuxIccParser::stdError(const QString &line)
|
|||||||
m_temporary.description.append(m_continuationLines.cap(1).trimmed());
|
m_temporary.description.append(m_continuationLines.cap(1).trimmed());
|
||||||
++m_lines;
|
++m_lines;
|
||||||
} else {
|
} else {
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,11 +39,10 @@ class LinuxIccParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
LinuxIccParser();
|
LinuxIccParser();
|
||||||
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void doFlush() override;
|
void doFlush() override;
|
||||||
|
|
||||||
QRegExp m_firstLine;
|
QRegExp m_firstLine;
|
||||||
|
@@ -35,8 +35,12 @@
|
|||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void LldParser::stdError(const QString &line)
|
void LldParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != Utils::StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const QString trimmedLine = rightTrimmed(line);
|
const QString trimmedLine = rightTrimmed(line);
|
||||||
if (trimmedLine.contains("error:") && trimmedLine.contains("lld")) {
|
if (trimmedLine.contains("error:") && trimmedLine.contains("lld")) {
|
||||||
emit addTask(CompileTask(Task::Error, trimmedLine));
|
emit addTask(CompileTask(Task::Error, trimmedLine));
|
||||||
@@ -68,7 +72,7 @@ void LldParser::stdError(const QString &line)
|
|||||||
absoluteFilePath(file), lineNo));
|
absoluteFilePath(file), lineNo));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -32,7 +32,7 @@ namespace Internal {
|
|||||||
|
|
||||||
class LldParser : public IOutputParser
|
class LldParser : public IOutputParser
|
||||||
{
|
{
|
||||||
void stdError(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -147,7 +147,7 @@ void MsvcParser::stdOutput(const QString &line)
|
|||||||
m_lines = 1;
|
m_lines = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MsvcParser::stdError(const QString &line)
|
void MsvcParser::stdError(const QString &line)
|
||||||
@@ -159,7 +159,7 @@ void MsvcParser::stdError(const QString &line)
|
|||||||
m_lines = 1;
|
m_lines = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::Id MsvcParser::id()
|
Core::Id MsvcParser::id()
|
||||||
@@ -167,6 +167,14 @@ Core::Id MsvcParser::id()
|
|||||||
return Core::Id("ProjectExplorer.OutputParser.Msvc");
|
return Core::Id("ProjectExplorer.OutputParser.Msvc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MsvcParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == OutputFormat::StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
bool MsvcParser::processCompileLine(const QString &line)
|
bool MsvcParser::processCompileLine(const QString &line)
|
||||||
{
|
{
|
||||||
doFlush();
|
doFlush();
|
||||||
@@ -212,6 +220,14 @@ ClangClParser::ClangClParser()
|
|||||||
QTC_CHECK(m_compileRegExp.isValid());
|
QTC_CHECK(m_compileRegExp.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangClParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
void ClangClParser::stdOutput(const QString &line)
|
void ClangClParser::stdOutput(const QString &line)
|
||||||
{
|
{
|
||||||
if (handleNmakeJomMessage(line, &m_lastTask)) {
|
if (handleNmakeJomMessage(line, &m_lastTask)) {
|
||||||
@@ -219,7 +235,7 @@ void ClangClParser::stdOutput(const QString &line)
|
|||||||
doFlush();
|
doFlush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for a code marker '~~~~ ^ ~~~~~~~~~~~~' underlining above code.
|
// Check for a code marker '~~~~ ^ ~~~~~~~~~~~~' underlining above code.
|
||||||
@@ -274,7 +290,7 @@ void ClangClParser::stdError(const QString &lineIn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IOutputParser::stdError(lineIn);
|
IOutputParser::handleLine(lineIn, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangClParser::doFlush()
|
void ClangClParser::doFlush()
|
||||||
|
@@ -40,13 +40,14 @@ class PROJECTEXPLORER_EXPORT MsvcParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
MsvcParser();
|
MsvcParser();
|
||||||
|
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
static Core::Id id();
|
static Core::Id id();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void doFlush() override;
|
void doFlush() override;
|
||||||
|
|
||||||
|
void stdOutput(const QString &line);
|
||||||
|
void stdError(const QString &line);
|
||||||
bool processCompileLine(const QString &line);
|
bool processCompileLine(const QString &line);
|
||||||
|
|
||||||
QRegularExpression m_compileRegExp;
|
QRegularExpression m_compileRegExp;
|
||||||
@@ -63,12 +64,13 @@ class PROJECTEXPLORER_EXPORT ClangClParser : public ProjectExplorer::IOutputPar
|
|||||||
public:
|
public:
|
||||||
ClangClParser();
|
ClangClParser();
|
||||||
|
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void doFlush() override;
|
void doFlush() override;
|
||||||
|
|
||||||
|
void stdOutput(const QString &line);
|
||||||
|
void stdError(const QString &line);
|
||||||
|
|
||||||
const QRegularExpression m_compileRegExp;
|
const QRegularExpression m_compileRegExp;
|
||||||
Task m_lastTask;
|
Task m_lastTask;
|
||||||
int m_linkedLines = 0;
|
int m_linkedLines = 0;
|
||||||
|
@@ -36,6 +36,14 @@ OsParser::OsParser()
|
|||||||
setObjectName(QLatin1String("OsParser"));
|
setObjectName(QLatin1String("OsParser"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OsParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == Utils::StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
void OsParser::stdError(const QString &line)
|
void OsParser::stdError(const QString &line)
|
||||||
{
|
{
|
||||||
if (Utils::HostOsInfo::isLinuxHost()) {
|
if (Utils::HostOsInfo::isLinuxHost()) {
|
||||||
@@ -43,7 +51,7 @@ void OsParser::stdError(const QString &line)
|
|||||||
if (trimmed.contains(QLatin1String(": error while loading shared libraries:")))
|
if (trimmed.contains(QLatin1String(": error while loading shared libraries:")))
|
||||||
emit addTask(CompileTask(Task::Error, trimmed));
|
emit addTask(CompileTask(Task::Error, trimmed));
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OsParser::stdOutput(const QString &line)
|
void OsParser::stdOutput(const QString &line)
|
||||||
@@ -57,7 +65,7 @@ void OsParser::stdOutput(const QString &line)
|
|||||||
m_hasFatalError = true;
|
m_hasFatalError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, Utils::StdOutFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OsParser::hasFatalErrors() const
|
bool OsParser::hasFatalErrors() const
|
||||||
|
@@ -40,12 +40,13 @@ class PROJECTEXPLORER_EXPORT OsParser : public ProjectExplorer::IOutputParser
|
|||||||
public:
|
public:
|
||||||
OsParser();
|
OsParser();
|
||||||
|
|
||||||
void stdError(const QString &line) override;
|
private:
|
||||||
void stdOutput(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
bool hasFatalErrors() const override;
|
bool hasFatalErrors() const override;
|
||||||
|
|
||||||
private:
|
void stdError(const QString &line);
|
||||||
|
void stdOutput(const QString &line);
|
||||||
|
|
||||||
bool m_hasFatalError = false;
|
bool m_hasFatalError = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -103,15 +103,12 @@ TestTerminator::TestTerminator(OutputParserTester *t) :
|
|||||||
m_tester(t)
|
m_tester(t)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void TestTerminator::stdOutput(const QString &line)
|
void TestTerminator::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
QVERIFY(line.endsWith('\n'));
|
QVERIFY(line.endsWith('\n'));
|
||||||
|
if (type == Utils::StdOutFormat)
|
||||||
m_tester->m_receivedStdOutChildLine.append(line);
|
m_tester->m_receivedStdOutChildLine.append(line);
|
||||||
}
|
else
|
||||||
|
|
||||||
void TestTerminator::stdError(const QString &line)
|
|
||||||
{
|
|
||||||
QVERIFY(line.endsWith('\n'));
|
|
||||||
m_tester->m_receivedStdErrChildLine.append(line);
|
m_tester->m_receivedStdErrChildLine.append(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -81,10 +81,9 @@ class TestTerminator : public IOutputParser
|
|||||||
public:
|
public:
|
||||||
TestTerminator(OutputParserTester *t);
|
TestTerminator(OutputParserTester *t);
|
||||||
|
|
||||||
void stdOutput(const QString &line) override;
|
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
OutputParserTester *m_tester = nullptr;
|
OutputParserTester *m_tester = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -52,6 +52,14 @@ XcodebuildParser::XcodebuildParser()
|
|||||||
QTC_CHECK(m_buildRe.isValid());
|
QTC_CHECK(m_buildRe.isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XcodebuildParser::handleLine(const QString &line, OutputFormat type)
|
||||||
|
{
|
||||||
|
if (type == StdOutFormat)
|
||||||
|
stdOutput(line);
|
||||||
|
else
|
||||||
|
stdError(line);
|
||||||
|
}
|
||||||
|
|
||||||
bool XcodebuildParser::hasFatalErrors() const
|
bool XcodebuildParser::hasFatalErrors() const
|
||||||
{
|
{
|
||||||
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
return (m_fatalErrorCount > 0) || IOutputParser::hasFatalErrors();
|
||||||
@@ -79,9 +87,9 @@ void XcodebuildParser::stdOutput(const QString &line)
|
|||||||
emit addTask(task, 1);
|
emit addTask(task, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat); // ??
|
||||||
} else {
|
} else {
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +104,7 @@ void XcodebuildParser::stdError(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_xcodeBuildParserState == OutsideXcodebuild) { // also forward if UnknownXcodebuildState ?
|
if (m_xcodeBuildParserState == OutsideXcodebuild) { // also forward if UnknownXcodebuildState ?
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -46,11 +46,13 @@ public:
|
|||||||
|
|
||||||
XcodebuildParser();
|
XcodebuildParser();
|
||||||
|
|
||||||
void stdOutput(const QString &line) override;
|
private:
|
||||||
void stdError(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
bool hasFatalErrors() const override;
|
bool hasFatalErrors() const override;
|
||||||
|
|
||||||
private:
|
void stdOutput(const QString &line);
|
||||||
|
void stdError(const QString &line);
|
||||||
|
|
||||||
int m_fatalErrorCount = 0;
|
int m_fatalErrorCount = 0;
|
||||||
QRegExp m_failureRe;
|
QRegExp m_failureRe;
|
||||||
QRegExp m_successRe;
|
QRegExp m_successRe;
|
||||||
|
@@ -40,8 +40,12 @@ QMakeParser::QMakeParser() : m_error(QLatin1String("^(.+):(\\d+):\\s(.+)$"))
|
|||||||
m_error.setMinimal(true);
|
m_error.setMinimal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMakeParser::stdError(const QString &line)
|
void QMakeParser::handleLine(const QString &line, OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != Utils::StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString lne = rightTrimmed(line);
|
QString lne = rightTrimmed(line);
|
||||||
if (m_error.indexIn(lne) > -1) {
|
if (m_error.indexIn(lne) > -1) {
|
||||||
QString fileName = m_error.cap(1);
|
QString fileName = m_error.cap(1);
|
||||||
@@ -78,7 +82,7 @@ void QMakeParser::stdError(const QString &line)
|
|||||||
emit addTask(BuildSystemTask(Task::Warning, description), 1);
|
emit addTask(BuildSystemTask(Task::Warning, description), 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // QmakeProjectManager
|
} // QmakeProjectManager
|
||||||
|
@@ -39,9 +39,10 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeParser : public ProjectExplorer::IOutputPa
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QMakeParser();
|
QMakeParser();
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
QRegExp m_error;
|
QRegExp m_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -43,8 +43,12 @@ QtParser::QtParser() :
|
|||||||
m_translationRegExp.setMinimal(true);
|
m_translationRegExp.setMinimal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtParser::stdError(const QString &line)
|
void QtParser::handleLine(const QString &line, Utils::OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != Utils::StdErrFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString lne = rightTrimmed(line);
|
QString lne = rightTrimmed(line);
|
||||||
if (m_mocRegExp.indexIn(lne) > -1) {
|
if (m_mocRegExp.indexIn(lne) > -1) {
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -72,7 +76,7 @@ void QtParser::stdError(const QString &line)
|
|||||||
emit addTask(task, 1);
|
emit addTask(task, 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::handleLine(line, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unit tests:
|
// Unit tests:
|
||||||
|
@@ -40,9 +40,10 @@ class QTSUPPORT_EXPORT QtParser : public ProjectExplorer::IOutputParser
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QtParser();
|
QtParser();
|
||||||
void stdError(const QString &line) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
|
|
||||||
QRegExp m_mocRegExp;
|
QRegExp m_mocRegExp;
|
||||||
QRegExp m_translationRegExp;
|
QRegExp m_translationRegExp;
|
||||||
};
|
};
|
||||||
|
@@ -47,8 +47,12 @@ using namespace Utils;
|
|||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
void QtTestParser::stdOutput(const QString &line)
|
void QtTestParser::handleLine(const QString &line, OutputFormat type)
|
||||||
{
|
{
|
||||||
|
if (type != StdOutFormat) {
|
||||||
|
IOutputParser::handleLine(line, type);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const QString theLine = rightTrimmed(line);
|
const QString theLine = rightTrimmed(line);
|
||||||
static const QRegularExpression triggerPattern("^(?:XPASS|FAIL!) : .+$");
|
static const QRegularExpression triggerPattern("^(?:XPASS|FAIL!) : .+$");
|
||||||
QTC_CHECK(triggerPattern.isValid());
|
QTC_CHECK(triggerPattern.isValid());
|
||||||
@@ -59,7 +63,7 @@ void QtTestParser::stdOutput(const QString &line)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_currentTask.isNull()) {
|
if (m_currentTask.isNull()) {
|
||||||
IOutputParser::stdOutput(line);
|
IOutputParser::handleLine(line, StdOutFormat);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
static const QRegularExpression locationPattern(HostOsInfo::isWindowsHost()
|
static const QRegularExpression locationPattern(HostOsInfo::isWindowsHost()
|
||||||
|
@@ -35,7 +35,7 @@ class QtTestParser : public ProjectExplorer::IOutputParser
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
void stdOutput(const QString &line) override;
|
void handleLine(const QString &line, Utils::OutputFormat type) override;
|
||||||
void doFlush() override { emitCurrentTask(); }
|
void doFlush() override { emitCurrentTask(); }
|
||||||
|
|
||||||
void emitCurrentTask();
|
void emitCurrentTask();
|
||||||
|
@@ -73,7 +73,7 @@ void CompilerOutputProcessor::start()
|
|||||||
connect(&parser, &ProjectExplorer::IOutputParser::addTask,
|
connect(&parser, &ProjectExplorer::IOutputParser::addTask,
|
||||||
this, &CompilerOutputProcessor::handleTask);
|
this, &CompilerOutputProcessor::handleTask);
|
||||||
while (!m_source.atEnd())
|
while (!m_source.atEnd())
|
||||||
parser.stdError(QString::fromLocal8Bit(m_source.readLine().trimmed()));
|
parser.handleStderr(QString::fromLocal8Bit(m_source.readLine().trimmed()));
|
||||||
QCoreApplication::quit();
|
QCoreApplication::quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user