diff options
author | hjk <hjk@qt.io> | 2020-01-15 08:56:11 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2020-01-20 10:11:59 +0000 |
commit | 0334b6e491a3688f2455e075595afde87b8f76af (patch) | |
tree | cc63a1fae976a46ea6ddc5d2cb956d1d7ac37516 /src/plugins/baremetal/sdccparser.cpp | |
parent | 7e19d1af7c356dae703e110f9d24b75429ef8fb5 (diff) | |
download | qt-creator-0334b6e491a3688f2455e075595afde87b8f76af.tar.gz |
ProjectManager: Add convenience Task subclasses
For Compile, BuildSystem and Deployment. Unclutters user code and reduces
binary size.
Change-Id: Ia18e917bb411754162e9f4ec6056d752a020bb50
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/baremetal/sdccparser.cpp')
-rw-r--r-- | src/plugins/baremetal/sdccparser.cpp | 114 |
1 files changed, 45 insertions, 69 deletions
diff --git a/src/plugins/baremetal/sdccparser.cpp b/src/plugins/baremetal/sdccparser.cpp index 2b2a34454b..5a12b5d66e 100644 --- a/src/plugins/baremetal/sdccparser.cpp +++ b/src/plugins/baremetal/sdccparser.cpp @@ -34,6 +34,7 @@ #include <QRegularExpression> using namespace ProjectExplorer; +using namespace Utils; namespace BareMetal { namespace Internal { @@ -105,8 +106,7 @@ void SdccParser::stdError(const QString &line) const int lineno = match.captured(LineNumberIndex).toInt(); const Task::TaskType type = taskType(match.captured(MessageTypeIndex)); const QString descr = match.captured(MessageTextIndex); - const Task task(type, descr, fileName, lineno, Constants::TASK_CATEGORY_COMPILE); - newTask(task); + newTask(CompileTask(type, descr, fileName, lineno)); return; } @@ -120,8 +120,7 @@ void SdccParser::stdError(const QString &line) const int lineno = match.captured(LineNumberIndex).toInt(); const Task::TaskType type = taskType(match.captured(MessageTypeIndex)); const QString descr = match.captured(MessageTextIndex); - const Task task(type, descr, fileName, lineno, Constants::TASK_CATEGORY_COMPILE); - newTask(task); + newTask(CompileTask(type, descr, fileName, lineno)); return; } @@ -131,8 +130,7 @@ void SdccParser::stdError(const QString &line) enum CaptureIndex { MessageCodeIndex = 1, MessageTypeIndex, MessageTextIndex }; const Task::TaskType type = taskType(match.captured(MessageTypeIndex)); const QString descr = match.captured(MessageTextIndex); - const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE); - newTask(task); + newTask(CompileTask(type, descr)); return; } @@ -142,8 +140,7 @@ void SdccParser::stdError(const QString &line) enum CaptureIndex { MessageTypeIndex = 1, MessageTextIndex }; const Task::TaskType type = taskType(match.captured(MessageTypeIndex)); const QString descr = match.captured(MessageTextIndex); - const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE); - newTask(task); + newTask(CompileTask(type, descr)); return; } @@ -204,8 +201,6 @@ void BareMetalPlugin::testSdccOutputParsers_data() << Tasks() << QString(); - const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE; - // Compiler messages. QTest::newRow("Assembler error") @@ -213,11 +208,10 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("c:\\foo\\main.c:63: Error: Some error\n") - << (Tasks() << Task(Task::Error, - "Some error", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler single line warning") @@ -225,11 +219,10 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("c:\\foo\\main.c:63: warning 123: Some warning\n") - << (Tasks() << Task(Task::Warning, - "Some warning", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Warning, + "Some warning", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler multi line warning") @@ -241,13 +234,12 @@ void BareMetalPlugin::testSdccOutputParsers_data() << QString::fromLatin1("c:\\foo\\main.c:63: warning 123: Some warning\n" "details #1\n" " details #2\n") - << (Tasks() << Task(Task::Warning, - "Some warning\n" - "details #1\n" - " details #2", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Warning, + "Some warning\n" + "details #1\n" + " details #2", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler simple single line error") @@ -255,11 +247,10 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("c:\\foo\\main.c:63: error: Some error\n") - << (Tasks() << Task(Task::Error, - "Some error", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler single line error") @@ -267,11 +258,10 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("c:\\foo\\main.c:63: error 123: Some error\n") - << (Tasks() << Task(Task::Error, - "Some error", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler multi line error") @@ -283,13 +273,12 @@ void BareMetalPlugin::testSdccOutputParsers_data() << QString::fromLatin1("c:\\foo\\main.c:63: error 123: Some error\n" "details #1\n" " details #2\n") - << (Tasks() << Task(Task::Error, - "Some error\n" - "details #1\n" - " details #2", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error\n" + "details #1\n" + " details #2", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler syntax error") @@ -297,11 +286,10 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("c:\\foo\\main.c:63: syntax error: Some error\n") - << (Tasks() << Task(Task::Error, - "Some error", - Utils::FilePath::fromUserInput("c:\\foo\\main.c"), - 63, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error", + FilePath::fromUserInput("c:\\foo\\main.c"), + 63)) << QString(); QTest::newRow("Compiler bad option error") @@ -309,11 +297,8 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("at 1: error 123: Some error\n") - << (Tasks() << Task(Task::Error, - "Some error", - Utils::FilePath(), - -1, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "Some error")) << QString(); QTest::newRow("Compiler bad option warning") @@ -321,11 +306,8 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("at 1: warning 123: Some warning\n") - << (Tasks() << Task(Task::Warning, - "Some warning", - Utils::FilePath(), - -1, - categoryCompile)) + << (Tasks() << CompileTask(Task::Warning, + "Some warning")) << QString(); QTest::newRow("Linker warning") @@ -333,11 +315,8 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("?ASlink-Warning-Couldn't find library 'foo.lib'\n") - << (Tasks() << Task(Task::Warning, - "Couldn't find library 'foo.lib'", - Utils::FilePath(), - -1, - categoryCompile)) + << (Tasks() << CompileTask(Task::Warning, + "Couldn't find library 'foo.lib'")) << QString(); QTest::newRow("Linker error") @@ -345,11 +324,8 @@ void BareMetalPlugin::testSdccOutputParsers_data() << OutputParserTester::STDERR << QString() << QString::fromLatin1("?ASlink-Error-<cannot open> : \"foo.rel\"\n") - << (Tasks() << Task(Task::Error, - "<cannot open> : \"foo.rel\"", - Utils::FilePath(), - -1, - categoryCompile)) + << (Tasks() << CompileTask(Task::Error, + "<cannot open> : \"foo.rel\"")) << QString(); } |