Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
a6e1c200
Commit
a6e1c200
authored
Nov 08, 2010
by
Pawel Polanski
Browse files
qmake error/warning parser has been improved
parent
b373da1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qmakeparser.cpp
View file @
a6e1c200
...
...
@@ -33,6 +33,7 @@
#include
<projectexplorer/taskwindow.h>
#include
<projectexplorer/projectexplorerconstants.h>
#include
<utils/qtcassert.h>
#include
<QDir>
using
namespace
Qt4ProjectManager
;
using
namespace
Qt4ProjectManager
::
Internal
;
...
...
@@ -41,6 +42,9 @@ using ProjectExplorer::Task;
QMakeParser
::
QMakeParser
()
{
setObjectName
(
QLatin1String
(
"QMakeParser"
));
m_error
.
setPattern
(
"^(.+):(
\\
d+):
\\
s(.+)$"
);
m_error
.
setMinimal
(
true
);
}
void
QMakeParser
::
stdError
(
const
QString
&
line
)
...
...
@@ -55,5 +59,108 @@ void QMakeParser::stdError(const QString &line)
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
));
return
;
}
if
(
lne
.
startsWith
(
QLatin1String
(
"Project WARNING:"
)))
{
const
QString
description
=
lne
.
mid
(
17
);
emit
addTask
(
Task
(
Task
::
Warning
,
description
,
QString
()
/* filename */
,
-
1
/* linenumber */
,
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
));
return
;
}
if
(
m_error
.
indexIn
(
lne
)
>
-
1
)
{
emit
addTask
(
Task
(
Task
::
Error
,
m_error
.
cap
(
3
)
/* description */
,
QDir
::
fromNativeSeparators
(
m_error
.
cap
(
1
))
/* file */
,
m_error
.
cap
(
2
).
toInt
()
/* line */
,
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
));
return
;
}
IOutputParser
::
stdError
(
line
);
}
// Unit tests:
#ifdef WITH_TESTS
# include <QTest>
# include "qt4projectmanagerplugin.h"
# include "projectexplorer/outputparser_test.h"
using
namespace
Qt4ProjectManager
::
Internal
;
using
namespace
ProjectExplorer
;
void
Qt4ProjectManagerPlugin
::
testQmakeOutputParsers_data
()
{
QTest
::
addColumn
<
QString
>
(
"input"
);
QTest
::
addColumn
<
OutputParserTester
::
Channel
>
(
"inputChannel"
);
QTest
::
addColumn
<
QString
>
(
"childStdOutLines"
);
QTest
::
addColumn
<
QString
>
(
"childStdErrLines"
);
QTest
::
addColumn
<
QList
<
ProjectExplorer
::
Task
>
>
(
"tasks"
);
QTest
::
addColumn
<
QString
>
(
"outputLines"
);
QTest
::
newRow
(
"pass-through stdout"
)
<<
QString
::
fromLatin1
(
"Sometext"
)
<<
OutputParserTester
::
STDOUT
<<
QString
::
fromLatin1
(
"Sometext"
)
<<
QString
()
<<
QList
<
ProjectExplorer
::
Task
>
()
<<
QString
();
QTest
::
newRow
(
"pass-through stderr"
)
<<
QString
::
fromLatin1
(
"Sometext"
)
<<
OutputParserTester
::
STDERR
<<
QString
()
<<
QString
::
fromLatin1
(
"Sometext"
)
<<
QList
<
ProjectExplorer
::
Task
>
()
<<
QString
();
QTest
::
newRow
(
"qMake error"
)
<<
QString
::
fromLatin1
(
"Project ERROR: undefined file"
)
<<
OutputParserTester
::
STDERR
<<
QString
()
<<
QString
()
<<
(
QList
<
ProjectExplorer
::
Task
>
()
<<
Task
(
Task
::
Error
,
QLatin1String
(
"undefined file"
),
QString
(),
-
1
,
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
();
QTest
::
newRow
(
"qMake Parse Error"
)
<<
QString
::
fromLatin1
(
"e:
\\
project.pro:14: Parse Error ('sth odd')"
)
<<
OutputParserTester
::
STDERR
<<
QString
()
<<
QString
()
<<
(
QList
<
ProjectExplorer
::
Task
>
()
<<
Task
(
Task
::
Error
,
QLatin1String
(
"Parse Error ('sth odd')"
),
QDir
::
fromNativeSeparators
(
QLatin1String
(
"e:
\\
project.pro"
)),
14
,
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
();
QTest
::
newRow
(
"qMake warning"
)
<<
QString
::
fromLatin1
(
"Project WARNING: bearer module might require ReadUserData capability"
)
<<
OutputParserTester
::
STDERR
<<
QString
()
<<
QString
()
<<
(
QList
<
ProjectExplorer
::
Task
>
()
<<
Task
(
Task
::
Warning
,
QLatin1String
(
"bearer module might require ReadUserData capability"
),
QString
(),
-
1
,
ProjectExplorer
::
Constants
::
TASK_CATEGORY_BUILDSYSTEM
))
<<
QString
();
}
void
Qt4ProjectManagerPlugin
::
testQmakeOutputParsers
()
{
OutputParserTester
testbench
;
testbench
.
appendOutputParser
(
new
QMakeParser
);
QFETCH
(
QString
,
input
);
QFETCH
(
OutputParserTester
::
Channel
,
inputChannel
);
QFETCH
(
QList
<
Task
>
,
tasks
);
QFETCH
(
QString
,
childStdOutLines
);
QFETCH
(
QString
,
childStdErrLines
);
QFETCH
(
QString
,
outputLines
);
testbench
.
testParsing
(
input
,
inputChannel
,
tasks
,
childStdOutLines
,
childStdErrLines
,
outputLines
);
}
#endif
src/plugins/qt4projectmanager/qmakeparser.h
View file @
a6e1c200
...
...
@@ -32,6 +32,8 @@
#include
<projectexplorer/ioutputparser.h>
#include
<QtCore/QRegExp>
namespace
Qt4ProjectManager
{
namespace
Internal
{
...
...
@@ -42,6 +44,9 @@ class QMakeParser : public ProjectExplorer::IOutputParser
public:
QMakeParser
();
virtual
void
stdError
(
const
QString
&
line
);
private:
QRegExp
m_error
;
};
}
// namesapce Internal
...
...
src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
View file @
a6e1c200
...
...
@@ -88,6 +88,8 @@ private slots:
void
testSbsV2OutputParsers
();
void
testRvctOutputParser_data
();
void
testRvctOutputParser
();
void
testQmakeOutputParsers_data
();
void
testQmakeOutputParsers
();
#endif
private:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment