aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmakeprojectmanager/qmakeparser.cpp
diff options
context:
space:
mode:
authorhjk <[email protected]>2020-01-15 08:56:11 +0100
committerhjk <[email protected]>2020-01-20 10:11:59 +0000
commit0334b6e491a3688f2455e075595afde87b8f76af (patch)
treecc63a1fae976a46ea6ddc5d2cb956d1d7ac37516 /src/plugins/qmakeprojectmanager/qmakeparser.cpp
parent7e19d1af7c356dae703e110f9d24b75429ef8fb5 (diff)
ProjectManager: Add convenience Task subclasses
For Compile, BuildSystem and Deployment. Unclutters user code and reduces binary size. Change-Id: Ia18e917bb411754162e9f4ec6056d752a020bb50 Reviewed-by: Christian Kandeler <[email protected]>
Diffstat (limited to 'src/plugins/qmakeprojectmanager/qmakeparser.cpp')
-rw-r--r--src/plugins/qmakeprojectmanager/qmakeparser.cpp85
1 files changed, 36 insertions, 49 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeparser.cpp b/src/plugins/qmakeprojectmanager/qmakeparser.cpp
index ed6abf5ca75..46ad10a0a00 100644
--- a/src/plugins/qmakeprojectmanager/qmakeparser.cpp
+++ b/src/plugins/qmakeprojectmanager/qmakeparser.cpp
@@ -29,8 +29,10 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/buildmanager.h>
-using namespace QmakeProjectManager;
-using ProjectExplorer::Task;
+using namespace ProjectExplorer;
+using namespace Utils;
+
+namespace QmakeProjectManager {
QMakeParser::QMakeParser() : m_error(QLatin1String("^(.+):(\\d+):\\s(.+)$"))
{
@@ -57,39 +59,29 @@ void QMakeParser::stdError(const QString &line)
type = Task::Warning;
else if (description.startsWith(QLatin1String("error:"), Qt::CaseInsensitive))
type = Task::Error;
- Task task = Task(type,
- description,
- Utils::FilePath::fromUserInput(fileName),
- m_error.cap(2).toInt() /* line */,
- Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
- emit addTask(task, 1);
+ emit addTask(BuildSystemTask(type,
+ description,
+ FilePath::fromUserInput(fileName),
+ m_error.cap(2).toInt() /* line */),
+ 1);
return;
}
if (lne.startsWith(QLatin1String("Project ERROR: "))
|| lne.startsWith(QLatin1String("ERROR: "))) {
const QString description = lne.mid(lne.indexOf(QLatin1Char(':')) + 2);
- Task task = Task(Task::Error,
- description,
- Utils::FilePath() /* filename */,
- -1 /* linenumber */,
- Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
- emit addTask(task, 1);
+ emit addTask(BuildSystemTask(Task::Error, description), 1);
return;
}
if (lne.startsWith(QLatin1String("Project WARNING: "))
|| lne.startsWith(QLatin1String("WARNING: "))) {
const QString description = lne.mid(lne.indexOf(QLatin1Char(':')) + 2);
- Task task = Task(Task::Warning,
- description,
- Utils::FilePath() /* filename */,
- -1 /* linenumber */,
- Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
- emit addTask(task, 1);
+ emit addTask(BuildSystemTask(Task::Warning, description), 1);
return;
}
IOutputParser::stdError(line);
}
+} // QmakeProjectManager
// Unit tests:
@@ -101,11 +93,11 @@ void QMakeParser::stdError(const QString &line)
# include "projectexplorer/outputparser_test.h"
using namespace QmakeProjectManager::Internal;
-using namespace ProjectExplorer;
+
+namespace QmakeProjectManager {
void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
{
- const Core::Id categoryBuildSystem = Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
QTest::addColumn<QString>("input");
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
QTest::addColumn<QString>("childStdOutLines");
@@ -130,10 +122,8 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Error,
- QLatin1String("undefined file"),
- Utils::FilePath(), -1,
- categoryBuildSystem))
+ << BuildSystemTask(Task::Error,
+ "undefined file"))
<< QString();
QTest::newRow("qMake Parse Error")
@@ -141,11 +131,10 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Error,
- QLatin1String("Parse Error ('sth odd')"),
- Utils::FilePath::fromUserInput(QLatin1String("e:\\project.pro")),
- 14,
- categoryBuildSystem))
+ << BuildSystemTask(Task::Error,
+ "Parse Error ('sth odd')",
+ FilePath::fromUserInput("e:\\project.pro"),
+ 14))
<< QString();
QTest::newRow("qMake warning")
@@ -153,10 +142,8 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Warning,
- QLatin1String("bearer module might require ReadUserData capability"),
- Utils::FilePath(), -1,
- categoryBuildSystem))
+ << BuildSystemTask(Task::Warning,
+ "bearer module might require ReadUserData capability"))
<< QString();
QTest::newRow("qMake warning 2")
@@ -164,10 +151,8 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Warning,
- QLatin1String("Failure to find: blackberrycreatepackagestepconfigwidget.cpp"),
- Utils::FilePath(), -1,
- categoryBuildSystem))
+ << BuildSystemTask(Task::Warning,
+ "Failure to find: blackberrycreatepackagestepconfigwidget.cpp"))
<< QString();
QTest::newRow("qMake warning with location")
@@ -175,22 +160,21 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Warning,
- QLatin1String("Unescaped backslashes are deprecated."),
- Utils::FilePath::fromUserInput(QLatin1String("e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl")), 1,
- categoryBuildSystem))
+ << BuildSystemTask(Task::Warning,
+ "Unescaped backslashes are deprecated.",
+ FilePath::fromUserInput("e:\\QtSDK\\Simulator\\Qt\\msvc2008\\lib\\qtmaind.prl"), 1))
<< QString();
+
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
- << Task(Task::Unknown,
- QLatin1String("Note: No relevant classes found. No output generated."),
- Utils::FilePath::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
- categoryBuildSystem)
- )
- << QString();}
+ << BuildSystemTask(Task::Unknown,
+ "Note: No relevant classes found. No output generated.",
+ FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), 0))
+ << QString();
+}
void QmakeProjectManagerPlugin::testQmakeOutputParsers()
{
@@ -207,4 +191,7 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers()
tasks, childStdOutLines, childStdErrLines,
outputLines);
}
+
+} // QmakeProjectManager
+
#endif