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>
This commit is contained in:
hjk
2020-01-15 08:56:11 +01:00
parent 7e19d1af7c
commit 0334b6e491
56 changed files with 1233 additions and 1548 deletions

View File

@@ -84,11 +84,10 @@ void JavaParser::parse(const QString &line)
}
}
Task task(Task::Error,
m_javaRegExp.cap(4).trimmed(),
file /* filename */,
lineno,
Constants::TASK_CATEGORY_COMPILE);
CompileTask task(Task::Error,
m_javaRegExp.cap(4).trimmed(),
file /* filename */,
lineno);
emit addTask(task, 1);
return;
}

View File

@@ -34,6 +34,7 @@
#include <QRegularExpression>
using namespace ProjectExplorer;
using namespace Utils;
namespace BareMetal {
namespace Internal {
@@ -114,8 +115,7 @@ bool IarParser::parseErrorOrFatalErrorDetailsMessage1(const QString &lne)
match.captured(DescriptionIndex));
// This task has a file path, but this patch are split on
// some lines, which will be received later.
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr));
// Prepare first part of a file path.
QString firstPart = match.captured(FilepathBeginIndex);
firstPart.remove("referenced from ");
@@ -138,8 +138,7 @@ bool IarParser::parseErrorOrFatalErrorDetailsMessage2(const QString &lne)
match.captured(DescriptionIndex));
// This task has not a file path. The description details
// will be received later on the next lines.
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr));
m_expectSnippet = true;
m_expectFilePath = false;
m_expectDescription = false;
@@ -159,8 +158,7 @@ bool IarParser::parseWarningOrErrorOrFatalErrorDetailsMessage1(const QString &ln
const int lineno = match.captured(LineNumberIndex).toInt();
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
// A full description will be received later on next lines.
const Task task(type, {}, fileName, lineno, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, {}, fileName, lineno));
const QString firstPart = QString("[%1]: ").arg(match.captured(MessageCodeIndex));
m_descriptionParts.append(firstPart);
m_expectDescription = true;
@@ -173,9 +171,7 @@ bool IarParser::parseErrorInCommandLineMessage(const QString &lne)
{
if (!lne.startsWith("Error in command line"))
return false;
const Task task(Task::TaskType::Error, lne.trimmed(), {},
-1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(Task::TaskType::Error, lne.trimmed()));
return true;
}
@@ -190,8 +186,7 @@ bool IarParser::parseErrorMessage1(const QString &lne)
const QString descr = QString("[%1]: %2").arg(match.captured(MessageCodeIndex),
match.captured(DescriptionIndex));
// This task has not a file path and line number (as it is a linker message)
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr));
return true;
}
@@ -301,19 +296,14 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< Tasks()
<< QString();
const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE;
// For std out.
QTest::newRow("Error in command line")
<< QString::fromLatin1("Error in command line: Some error")
<< OutputParserTester::STDOUT
<< QString::fromLatin1("Error in command line: Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"Error in command line: Some error",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"Error in command line: Some error"))
<< QString();
QTest::newRow("Linker error")
@@ -321,11 +311,8 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("Error[e46]: Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"[e46]: Some error",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[e46]: Some error"))
<< QString();
// For std error.
@@ -336,11 +323,10 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< QString()
<< QString::fromLatin1("\"c:\\foo\\main.c\",63 Warning[Pe223]:\n"
" Some warning \"foo\" bar\n")
<< (Tasks() << Task(Task::Warning,
"[Pe223]: Some warning \"foo\" bar",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"[Pe223]: Some warning \"foo\" bar",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("Details warning")
@@ -354,13 +340,12 @@ void BareMetalPlugin::testIarOutputParsers_data()
" ^\n"
"\"c:\\foo\\main.c\",63 Warning[Pe223]:\n"
" Some warning\n")
<< (Tasks() << Task(Task::Warning,
"[Pe223]: Some warning\n"
" some_detail;\n"
" ^",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"[Pe223]: Some warning\n"
" some_detail;\n"
" ^",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("No details split-description warning")
@@ -372,11 +357,10 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< QString::fromLatin1("\"c:\\foo\\main.c\",63 Warning[Pe223]:\n"
" Some warning\n"
" , split\n")
<< (Tasks() << Task(Task::Warning,
"[Pe223]: Some warning, split",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"[Pe223]: Some warning, split",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("No details error")
@@ -386,11 +370,10 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< QString()
<< QString::fromLatin1("\"c:\\foo\\main.c\",63 Error[Pe223]:\n"
" Some error\n")
<< (Tasks() << Task(Task::Error,
"[Pe223]: Some error",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Pe223]: Some error",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("Details error")
@@ -404,13 +387,12 @@ void BareMetalPlugin::testIarOutputParsers_data()
" ^\n"
"\"c:\\foo\\main.c\",63 Error[Pe223]:\n"
" Some error\n")
<< (Tasks() << Task(Task::Error,
"[Pe223]: Some error\n"
" some_detail;\n"
" ^",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Pe223]: Some error\n"
" some_detail;\n"
" ^",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("No details split-description error")
@@ -422,11 +404,10 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< QString::fromLatin1("\"c:\\foo\\main.c\",63 Error[Pe223]:\n"
" Some error\n"
" , split\n")
<< (Tasks() << Task(Task::Error,
"[Pe223]: Some error, split",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Pe223]: Some error, split",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("No definition for")
@@ -440,11 +421,9 @@ void BareMetalPlugin::testIarOutputParsers_data()
" o\\bar\\mai\n"
" n.c.o\n"
"]\n")
<< (Tasks() << Task(Task::Error,
"[Li005]: Some error \"foo\"",
Utils::FilePath::fromUserInput("c:\\foo\\bar\\main.c.o"),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Li005]: Some error \"foo\"",
FilePath::fromUserInput("c:\\foo\\bar\\main.c.o")))
<< QString();
QTest::newRow("More than one source file specified")
@@ -458,13 +437,10 @@ void BareMetalPlugin::testIarOutputParsers_data()
" c:\\foo.c\n"
" c:\\bar.c\n"
"Fatal error detected, aborting.\n")
<< (Tasks() << Task(Task::Error,
"[Su011]: Some error:\n"
" c:\\foo.c\n"
" c:\\bar.c",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Su011]: Some error:\n"
" c:\\foo.c\n"
" c:\\bar.c"))
<< QString();
QTest::newRow("At end of source")
@@ -472,11 +448,8 @@ void BareMetalPlugin::testIarOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("At end of source Error[Pe040]: Some error \";\"\n")
<< (Tasks() << Task(Task::Error,
"[Pe040]: Some error \";\"",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"[Pe040]: Some error \";\""))
<< QString();
}

View File

@@ -34,6 +34,7 @@
#include <QRegularExpression>
using namespace ProjectExplorer;
using namespace Utils;
namespace BareMetal {
namespace Internal {
@@ -105,8 +106,7 @@ bool KeilParser::parseArmWarningOrErrorDetailsMessage(const QString &lne)
const int lineno = match.captured(LineNumberIndex).toInt();
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
const QString descr = match.captured(DescriptionIndex);
const Task task(type, descr, fileName, lineno, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr, fileName, lineno));
return true;
}
@@ -119,8 +119,7 @@ bool KeilParser::parseArmErrorOrFatalErorrMessage(const QString &lne)
enum CaptureIndex { MessageTypeIndex = 1, DescriptionIndex };
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
const QString descr = match.captured(DescriptionIndex);
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr));
return true;
}
@@ -140,8 +139,7 @@ bool KeilParser::parseMcs51WarningOrErrorDetailsMessage1(const QString &lne)
match.captured(FilePathIndex));
const QString descr = QString("%1: %2").arg(match.captured(MessageCodeIndex),
match.captured(MessageTextIndex));
const Task task(type, descr, fileName, lineno, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr, fileName, lineno));
return true;
}
@@ -159,8 +157,7 @@ bool KeilParser::parseMcs51WarningOrErrorDetailsMessage2(const QString &lne)
match.captured(FilePathIndex));
const QString descr = QString("%1: %2").arg(match.captured(MessageCodeIndex),
match.captured(MessageTextIndex));
const Task task(type, descr, fileName, lineno, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr, fileName, lineno));
return true;
}
@@ -173,8 +170,7 @@ bool KeilParser::parseMcs51WarningOrFatalErrorMessage(const QString &lne)
enum CaptureIndex { MessageTypeIndex = 1, MessageDescriptionIndex };
const Task::TaskType type = taskType(match.captured(MessageTypeIndex));
const QString descr = match.captured(MessageDescriptionIndex);
const Task task(type, descr, {}, -1, Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(type, descr));
return true;
}
@@ -190,9 +186,7 @@ bool KeilParser::parseMcs51FatalErrorMessage2(const QString &lne)
descr = "Assembler fatal error";
else if (key == 'C')
descr = "Compiler fatal error";
const Task task(Task::TaskType::Error, descr, {}, -1,
Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(Task::TaskType::Error, descr));
return true;
}
@@ -320,8 +314,6 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< Tasks()
<< QString();
const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE;
// ARM compiler specific patterns.
QTest::newRow("ARM: No details warning")
@@ -329,11 +321,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("\"c:\\foo\\main.c\", line 63: Warning: #1234: Some warning\n")
<< (Tasks() << Task(Task::Warning,
"#1234: Some warning",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"#1234: Some warning",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("ARM: Details warning")
@@ -345,13 +336,12 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< QString::fromLatin1("\"c:\\foo\\main.c\", line 63: Warning: #1234: Some warning\n"
" int f;\n"
" ^\n")
<< (Tasks() << Task(Task::Warning,
"#1234: Some warning\n"
" int f;\n"
" ^",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"#1234: Some warning\n"
" int f;\n"
" ^",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("ARM: No details error")
@@ -359,11 +349,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("\"c:\\foo\\main.c\", line 63: Error: #1234: Some error\n")
<< (Tasks() << Task(Task::Error,
"#1234: Some error",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"#1234: Some error",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("ARM: No details error with column")
@@ -371,11 +360,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("\"flash.sct\", line 51 (column 20): Error: L1234: Some error\n")
<< (Tasks() << Task(Task::Error,
"L1234: Some error",
Utils::FilePath::fromUserInput("flash.sct"),
51,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"L1234: Some error",
FilePath::fromUserInput("flash.sct"),
51))
<< QString();
QTest::newRow("ARM: Details error")
@@ -387,13 +375,12 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< QString::fromLatin1("\"c:\\foo\\main.c\", line 63: Error: #1234: Some error\n"
" int f;\n"
" ^\n")
<< (Tasks() << Task(Task::Error,
"#1234: Some error\n"
" int f;\n"
" ^",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
63,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"#1234: Some error\n"
" int f;\n"
" ^",
FilePath::fromUserInput("c:\\foo\\main.c"),
63))
<< QString();
QTest::newRow("ARM: At end of source")
@@ -401,11 +388,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("\"c:\\foo\\main.c\", line 71: Error: At end of source: #40: Some error\n")
<< (Tasks() << Task(Task::Error,
"#40: Some error",
Utils::FilePath::fromUserInput("c:\\foo\\main.c"),
71,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"#40: Some error",
FilePath::fromUserInput("c:\\foo\\main.c"),
71))
<< QString();
QTest::newRow("ARM: Starts with error")
@@ -413,11 +399,8 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("Error: L6226E: Some error.\n")
<< (Tasks() << Task(Task::Error,
"L6226E: Some error.",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"L6226E: Some error."))
<< QString();
// MCS51 compiler specific patterns.
@@ -428,11 +411,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** WARNING #A9 IN 15 (c:\\foo\\dscr.a51, LINE 15): Some warning\n")
<< QString()
<< (Tasks() << Task(Task::Warning,
"#A9: Some warning",
Utils::FilePath::fromUserInput("c:\\foo\\dscr.a51"),
15,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"#A9: Some warning",
FilePath::fromUserInput("c:\\foo\\dscr.a51"),
15))
<< QString();
QTest::newRow("MCS51: Assembler simple error")
@@ -440,11 +422,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** ERROR #A9 IN 15 (c:\\foo\\dscr.a51, LINE 15): Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"#A9: Some error",
Utils::FilePath::fromUserInput("c:\\foo\\dscr.a51"),
15,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"#A9: Some error",
FilePath::fromUserInput("c:\\foo\\dscr.a51"),
15))
<< QString();
QTest::newRow("MCS51: Assembler fatal error")
@@ -456,13 +437,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
" Some detail 1\n"
" Some detail N\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"Assembler fatal error\n"
" Some detail 1\n"
" Some detail N",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"Assembler fatal error\n"
" Some detail 1\n"
" Some detail N"))
<< QString();
QTest::newRow("MCS51: Assembler details error")
@@ -474,13 +452,12 @@ void BareMetalPlugin::testKeilOutputParsers_data()
"*** ___^\n"
"*** ERROR #A45 IN 28 (d:\\foo.a51, LINE 28): Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"#A45: Some error\n"
" Some detail\n"
" ___^",
Utils::FilePath::fromUserInput("d:\\foo.a51"),
28,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"#A45: Some error\n"
" Some detail\n"
" ___^",
FilePath::fromUserInput("d:\\foo.a51"),
28))
<< QString();
// Compiler messages.
@@ -489,11 +466,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** WARNING C123 IN LINE 13 OF c:\\foo.c: Some warning\n")
<< QString()
<< (Tasks() << Task(Task::Warning,
"C123: Some warning",
Utils::FilePath::fromUserInput("c:\\foo.c"),
13,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"C123: Some warning",
FilePath::fromUserInput("c:\\foo.c"),
13))
<< QString();
QTest::newRow("MCS51: Compiler extended warning")
@@ -501,11 +477,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** WARNING C123 IN LINE 13 OF c:\\foo.c: Some warning : 'extended text'\n")
<< QString()
<< (Tasks() << Task(Task::Warning,
"C123: Some warning : 'extended text'",
Utils::FilePath::fromUserInput("c:\\foo.c"),
13,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"C123: Some warning : 'extended text'",
FilePath::fromUserInput("c:\\foo.c"),
13))
<< QString();
QTest::newRow("MCS51: Compiler simple error")
@@ -513,11 +488,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** ERROR C123 IN LINE 13 OF c:\\foo.c: Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"C123: Some error",
Utils::FilePath::fromUserInput("c:\\foo.c"),
13,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"C123: Some error",
FilePath::fromUserInput("c:\\foo.c"),
13))
<< QString();
QTest::newRow("MCS51: Compiler extended error")
@@ -525,11 +499,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** ERROR C123 IN LINE 13 OF c:\\foo.c: Some error : 'extended text'\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"C123: Some error : 'extended text'",
Utils::FilePath::fromUserInput("c:\\foo.c"),
13,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"C123: Some error : 'extended text'",
FilePath::fromUserInput("c:\\foo.c"),
13))
<< QString();
QTest::newRow("MCS51: Compiler fatal error")
@@ -541,13 +514,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
" Some detail 1\n"
" Some detail N\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"Compiler fatal error\n"
" Some detail 1\n"
" Some detail N",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"Compiler fatal error\n"
" Some detail 1\n"
" Some detail N"))
<< QString();
// Linker messages.
@@ -558,12 +528,9 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< QString::fromLatin1("*** WARNING L16: Some warning\n"
" Some detail 1\n")
<< QString()
<< (Tasks() << Task(Task::Warning,
"L16: Some warning\n"
" Some detail 1",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Warning,
"L16: Some warning\n"
" Some detail 1"))
<< QString();
QTest::newRow("MCS51: Linker simple fatal error")
@@ -571,11 +538,8 @@ void BareMetalPlugin::testKeilOutputParsers_data()
<< OutputParserTester::STDOUT
<< QString::fromLatin1("*** FATAL ERROR L456: Some error\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"L456: Some error",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"L456: Some error"))
<< QString();
QTest::newRow("MCS51: Linker extended fatal error")
@@ -587,13 +551,10 @@ void BareMetalPlugin::testKeilOutputParsers_data()
" Some detail 1\n"
" Some detail N\n")
<< QString()
<< (Tasks() << Task(Task::Error,
"L456: Some error\n"
" Some detail 1\n"
" Some detail N",
Utils::FilePath(),
-1,
categoryCompile))
<< (Tasks() << CompileTask(Task::Error,
"L456: Some error\n"
" Some detail 1\n"
" Some detail N"))
<< QString();
}

View File

@@ -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();
}

View File

@@ -281,9 +281,8 @@ void BuildDirManager::setParametersAndRequestParse(const BuildDirParameters &par
{
qCDebug(cmakeBuildDirManagerLog) << "setting parameters and requesting reparse";
if (!parameters.cmakeTool()) {
TaskHub::addTask(Task::Error,
tr("The kit needs to define a CMake tool to parse this project."),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
TaskHub::addTask(BuildSystemTask(Task::Error, tr(
"The kit needs to define a CMake tool to parse this project.")));
return;
}
QTC_ASSERT(parameters.isValid(), return );

View File

@@ -141,32 +141,26 @@ bool CMakeBuildStep::init()
canInit = false;
}
if (bc && !bc->isEnabled()) {
emit addTask(Task(Task::Error,
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
"The build configuration is currently disabled."),
Utils::FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Error,
tr("CMakeProjectManager::CMakeBuildStep")));
canInit = false;
}
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
if (!tool || !tool->isValid()) {
emit addTask(Task(Task::Error,
emit addTask(BuildSystemTask(Task::Error,
tr("A CMake tool must be set up for building. "
"Configure a CMake tool in the kit options."),
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
"Configure a CMake tool in the kit options.")));
canInit = false;
}
RunConfiguration *rc = target()->activeRunConfiguration();
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildKey().isEmpty())) {
emit addTask(Task(Task::Error,
emit addTask(BuildSystemTask(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"You asked to build the current Run Configuration's build target only, "
"but it is not associated with a build target. "
"Update the Make Step in your build settings."),
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
"Update the Make Step in your build settings.")));
canInit = false;
}
@@ -179,13 +173,11 @@ bool CMakeBuildStep::init()
const Utils::FilePath projectDirectory = bc->target()->project()->projectDirectory();
if (bc->buildDirectory() != projectDirectory) {
if (projectDirectory.pathAppended("CMakeCache.txt").exists()) {
emit addTask(Task(Task::Warning,
emit addTask(BuildSystemTask(Task::Warning,
tr("There is a CMakeCache.txt file in \"%1\", which suggest an "
"in-source build was done before. You are now building in \"%2\", "
"and the CMakeCache.txt file might confuse CMake.")
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput()),
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
.arg(projectDirectory.toUserOutput(), bc->buildDirectory().toUserOutput())));
}
}

View File

@@ -252,9 +252,8 @@ Tasks CMakeKitAspect::validate(const Kit *k) const
if (tool) {
CMakeTool::Version version = tool->version();
if (version.major < 3) {
result << Task(Task::Warning, tr("CMake version %1 is unsupported. Please update to "
"version 3.0 or later.").arg(QString::fromUtf8(version.fullVersion)),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Warning, tr("CMake version %1 is unsupported. Please update to "
"version 3.0 or later.").arg(QString::fromUtf8(version.fullVersion)));
}
}
return result;
@@ -653,41 +652,38 @@ QVariant CMakeGeneratorKitAspect::defaultValue(const Kit *k) const
Tasks CMakeGeneratorKitAspect::validate(const Kit *k) const
{
CMakeTool *tool = CMakeKitAspect::cmakeTool(k);
GeneratorInfo info = generatorInfo(k);
if (!tool)
return {};
Tasks result;
if (tool) {
if (!tool->isValid()) {
result << Task(Task::Warning, tr("CMake Tool is unconfigured, CMake generator will be ignored."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
const auto addWarning = [&result](const QString &desc) {
result << BuildSystemTask(Task::Warning, desc);
};
if (!tool->isValid()) {
addWarning(tr("CMake Tool is unconfigured, CMake generator will be ignored."));
} else {
const GeneratorInfo info = generatorInfo(k);
QList<CMakeTool::Generator> known = tool->supportedGenerators();
auto it = std::find_if(known.constBegin(), known.constEnd(), [info](const CMakeTool::Generator &g) {
return g.matches(info.generator, info.extraGenerator);
});
if (it == known.constEnd()) {
addWarning(tr("CMake Tool does not support the configured generator."));
} else {
QList<CMakeTool::Generator> known = tool->supportedGenerators();
auto it = std::find_if(known.constBegin(), known.constEnd(), [info](const CMakeTool::Generator &g) {
return g.matches(info.generator, info.extraGenerator);
});
if (it == known.constEnd()) {
result << Task(Task::Warning, tr("CMake Tool does not support the configured generator."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} else {
if (!it->supportsPlatform && !info.platform.isEmpty()) {
result << Task(Task::Warning, tr("Platform is not supported by the selected CMake generator."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
if (!it->supportsToolset && !info.toolset.isEmpty()) {
result << Task(Task::Warning, tr("Toolset is not supported by the selected CMake generator."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
}
if ((!tool->hasServerMode() && !tool->hasFileApi())
&& info.extraGenerator != "CodeBlocks") {
result << Task(Task::Warning, tr("The selected CMake binary has no server-mode and the CMake "
"generator does not generate a CodeBlocks file. "
"%1 will not be able to parse CMake projects.")
.arg(Core::Constants::IDE_DISPLAY_NAME),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
}
if (!it->supportsPlatform && !info.platform.isEmpty())
addWarning(tr("Platform is not supported by the selected CMake generator."));
if (!it->supportsToolset && !info.toolset.isEmpty())
addWarning(tr("Toolset is not supported by the selected CMake generator."));
}
if (!tool->hasServerMode() && !tool->hasFileApi() && info.extraGenerator != "CodeBlocks") {
addWarning(tr("The selected CMake binary has no server-mode and the CMake "
"generator does not generate a CodeBlocks file. "
"%1 will not be able to parse CMake projects.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
}
}
return result;
}
@@ -982,69 +978,63 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
}
Tasks result;
const auto addWarning = [&result](const QString &desc) {
result << BuildSystemTask(Task::Warning, desc);
};
// Validate Qt:
if (qmakePath.isEmpty()) {
if (version && version->isValid() && isQt4) {
result << Task(Task::Warning, tr("CMake configuration has no path to qmake binary set, "
"even though the kit has a valid Qt version."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has no path to qmake binary set, "
"even though the kit has a valid Qt version."));
}
} else {
if (!version || !version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set, "
"even though the kit has no valid Qt version."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a qmake binary set, "
"even though the kit has no valid Qt version."));
} else if (qmakePath != version->qmakeCommand() && isQt4) {
result << Task(Task::Warning, tr("CMake configuration has a path to a qmake binary set "
"that does not match the qmake binary path "
"configured in the Qt version."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a qmake binary set "
"that does not match the qmake binary path "
"configured in the Qt version."));
}
}
if (version && !qtInstallDirs.contains(version->prefix().toString()) && !isQt4) {
if (version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set "
"that points to the kit Qt version."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has no CMAKE_PREFIX_PATH set "
"that points to the kit Qt version."));
}
}
// Validate Toolchains:
if (tcCPath.isEmpty()) {
if (tcC && tcC->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no path to a C compiler set, "
"even though the kit has a valid tool chain."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has no path to a C compiler set, "
"even though the kit has a valid tool chain."));
}
} else {
if (!tcC || !tcC->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set, "
"even though the kit has no valid tool chain."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a C compiler set, "
"even though the kit has no valid tool chain."));
} else if (tcCPath != tcC->compilerCommand()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a C compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."));
}
}
if (tcCxxPath.isEmpty()) {
if (tcCxx && tcCxx->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no path to a C++ compiler set, "
"even though the kit has a valid tool chain."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has no path to a C++ compiler set, "
"even though the kit has a valid tool chain."));
}
} else {
if (!tcCxx || !tcCxx->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set, "
"even though the kit has no valid tool chain."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a C++ compiler set, "
"even though the kit has no valid tool chain."));
} else if (tcCxxPath != tcCxx->compilerCommand()) {
result << Task(Task::Warning, tr("CMake configuration has a path to a C++ compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."),
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
addWarning(tr("CMake configuration has a path to a C++ compiler set "
"that does not match the compiler path "
"configured in the tool chain of the kit."));
}
}

View File

@@ -29,8 +29,10 @@
#include <projectexplorer/projectexplorerconstants.h>
using namespace CMakeProjectManager;
using namespace ProjectExplorer;
using namespace Utils;
namespace CMakeProjectManager {
const char COMMON_ERROR_PATTERN[] = "^CMake Error at (.*):([0-9]*)( \\((.*)\\))?:";
const char NEXT_SUBERROR_PATTERN[] = "^CMake Error in (.*):";
@@ -76,16 +78,15 @@ void CMakeParser::stdError(const QString &line)
QDir::fromNativeSeparators(m_commonError.cap(1)))
: QDir::fromNativeSeparators(m_commonError.cap(1));
m_lastTask = Task(Task::Error,
QString(),
Utils::FilePath::fromUserInput(path),
m_commonError.cap(2).toInt(),
Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lastTask = BuildSystemTask(Task::Error,
QString(),
FilePath::fromUserInput(path),
m_commonError.cap(2).toInt());
m_lines = 1;
return;
} else if (m_nextSubError.indexIn(trimmedLine) != -1) {
m_lastTask = Task(Task::Error, QString(), Utils::FilePath::fromUserInput(m_nextSubError.cap(1)), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lastTask = BuildSystemTask(Task::Error, QString(),
FilePath::fromUserInput(m_nextSubError.cap(1)));
m_lines = 1;
return;
} else if (trimmedLine.startsWith(QLatin1String(" ")) && !m_lastTask.isNull()) {
@@ -97,12 +98,12 @@ void CMakeParser::stdError(const QString &line)
} else if (trimmedLine.endsWith(QLatin1String("in cmake code at"))) {
m_expectTripleLineErrorData = LINE_LOCATION;
doFlush();
m_lastTask = Task(trimmedLine.contains(QLatin1String("Error")) ? Task::Error : Task::Warning,
QString(), Utils::FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
const Task::TaskType type =
trimmedLine.contains(QLatin1String("Error")) ? Task::Error : Task::Warning;
m_lastTask = BuildSystemTask(type, QString());
return;
} else if (trimmedLine.startsWith("CMake Error: ")) {
m_lastTask = Task(Task::Error, trimmedLine.mid(13),
Utils::FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM);
m_lastTask = BuildSystemTask(Task::Error, trimmedLine.mid(13));
m_lines = 1;
return;
} else if (trimmedLine.startsWith("-- ") || trimmedLine.startsWith(" * ")) {
@@ -148,6 +149,8 @@ void CMakeParser::doFlush()
m_lines = 0;
}
} // CMakeProjectManager
#ifdef WITH_TESTS
#include "cmakeprojectplugin.h"
@@ -155,6 +158,8 @@ void CMakeParser::doFlush()
#include <QTest>
namespace CMakeProjectManager {
void Internal::CMakeProjectPlugin::testCMakeParser_data()
{
QTest::addColumn<QString>("input");
@@ -164,8 +169,6 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
QTest::addColumn<Tasks>("tasks");
QTest::addColumn<QString>("outputLines");
const Core::Id categoryBuild = Constants::TASK_CATEGORY_BUILDSYSTEM;
// negative tests
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
@@ -193,14 +196,14 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Cannot find source file: unknownFile.qml Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx"),
Utils::FilePath::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), 70,
categoryBuild)
<< Task(Task::Error,
QLatin1String("Cannot find source file: CMakeLists.txt2 Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx"),
Utils::FilePath::fromUserInput(QLatin1String("src/1/app/CMakeLists.txt")), -1,
categoryBuild))
<< BuildSystemTask(Task::Error,
"Cannot find source file: unknownFile.qml Tried extensions "
".c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx",
FilePath::fromUserInput("src/1/app/CMakeLists.txt"), 70)
<< BuildSystemTask(Task::Error,
"Cannot find source file: CMakeLists.txt2 Tried extensions "
".c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx",
FilePath::fromUserInput("src/1/app/CMakeLists.txt"), -1))
<< QString();
QTest::newRow("add subdirectory")
@@ -209,10 +212,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("add_subdirectory given source \"app1\" which is not an existing directory."),
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< BuildSystemTask(Task::Error,
"add_subdirectory given source \"app1\" which is not an existing directory.",
FilePath::fromUserInput("src/1/CMakeLists.txt"), 8))
<< QString();
QTest::newRow("unknown command")
@@ -221,10 +223,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Unknown CMake command \"i_am_wrong_command\"."),
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< BuildSystemTask(Task::Error,
"Unknown CMake command \"i_am_wrong_command\".",
FilePath::fromUserInput("src/1/CMakeLists.txt"), 8))
<< QString();
QTest::newRow("incorrect arguments")
@@ -233,10 +234,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("message called with incorrect number of arguments"),
Utils::FilePath::fromUserInput(QLatin1String("src/1/CMakeLists.txt")), 8,
categoryBuild))
<< BuildSystemTask(Task::Error,
"message called with incorrect number of arguments",
FilePath::fromUserInput("src/1/CMakeLists.txt"), 8))
<< QString();
QTest::newRow("cmake error")
@@ -247,10 +247,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Parse error. Expected \"(\", got newline with text \"\n\"."),
Utils::FilePath::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
categoryBuild))
<< BuildSystemTask(Task::Error,
"Parse error. Expected \"(\", got newline with text \"\n\".",
FilePath::fromUserInput("/test/path/CMakeLists.txt"), 9))
<< QString();
QTest::newRow("cmake error2")
@@ -258,11 +257,11 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
"Missing variable is:\n"
"CMAKE_MAKE_PROGRAM\n")
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Missing variable is:\nCMAKE_MAKE_PROGRAM\n")
<< QString() << QString("Missing variable is:\nCMAKE_MAKE_PROGRAM\n")
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Error required internal CMake variable not set, cmake may be not be built correctly."),
Utils::FilePath(), -1, categoryBuild))
<< BuildSystemTask(Task::Error,
"Error required internal CMake variable not set, "
"cmake may be not be built correctly."))
<< QString();
QTest::newRow("cmake error at")
@@ -273,10 +272,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("Parse error. Expected \"(\", got newline with text \" \"."),
Utils::FilePath::fromUserInput(QLatin1String("CMakeLists.txt")), 4,
categoryBuild))
<< BuildSystemTask(Task::Error,
"Parse error. Expected \"(\", got newline with text \" \".",
FilePath::fromUserInput("CMakeLists.txt"), 4))
<< QString();
QTest::newRow("cmake warning")
@@ -286,10 +284,9 @@ void Internal::CMakeProjectPlugin::testCMakeParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QLatin1String("Argument not separated from preceding token by whitespace."),
Utils::FilePath::fromUserInput(QLatin1String("/test/path/CMakeLists.txt")), 9,
categoryBuild))
<< BuildSystemTask(Task::Warning,
"Argument not separated from preceding token by whitespace.",
FilePath::fromUserInput("/test/path/CMakeLists.txt"), 9))
<< QString();
QTest::newRow("eat normal CMake output")
<< QString::fromLatin1("-- Qt5 install prefix: /usr/lib\n"
@@ -313,4 +310,6 @@ void Internal::CMakeProjectPlugin::testCMakeParser()
outputLines);
}
} // CMakeProjectManager
#endif

View File

@@ -225,7 +225,7 @@ void CMakeProcess::handleProcessFinished(int code, QProcess::ExitStatus status)
if (!msg.isEmpty()) {
Core::MessageManager::write(msg);
TaskHub::addTask(Task::Error, msg, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
m_future->reportCanceled();
} else {
m_future->setProgressValue(1);

View File

@@ -439,8 +439,8 @@ void ServerModeReader::handleReply(const QVariantMap &data, const QString &inRep
void ServerModeReader::handleError(const QString &message)
{
TaskHub::addTask(Task::Error, message, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
Utils::FilePath(), -1);
TaskHub::addTask(BuildSystemTask(Task::Error, message));
if (!m_delayedErrorMessage.isEmpty()) {
reportError();
return;

View File

@@ -2147,9 +2147,9 @@ void CdbEngine::handleExtensionMessage(char t, int token, const QString &what, c
const FilePath fileName = FilePath::fromUserInput(exception.file);
const QString taskEntry = tr("Debugger encountered an exception: %1").arg(
exception.toString(false).trimmed());
TaskHub::addTask(type, taskEntry,
Constants::TASK_CATEGORY_DEBUGGER_RUNTIME,
fileName, exception.lineNumber);
TaskHub::addTask(Task(type, taskEntry,
fileName, exception.lineNumber,
Constants::TASK_CATEGORY_DEBUGGER_RUNTIME));
}
return;
}

View File

@@ -355,27 +355,26 @@ Tasks DebuggerKitAspect::validateDebugger(const Kit *k)
if (const DebuggerItem *item = debugger(k))
path = item->command().toUserOutput();
const Core::Id id = ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM;
if (errors & NoDebugger)
result << Task(Task::Warning, tr("No debugger set up."), FilePath(), -1, id);
result << BuildSystemTask(Task::Warning, tr("No debugger set up."));
if (errors & DebuggerNotFound)
result << Task(Task::Error, tr("Debugger \"%1\" not found.").arg(path),
FilePath(), -1, id);
result << BuildSystemTask(Task::Error, tr("Debugger \"%1\" not found.").arg(path));
if (errors & DebuggerNotExecutable)
result << Task(Task::Error, tr("Debugger \"%1\" not executable.").arg(path), FilePath(), -1, id);
result << BuildSystemTask(Task::Error, tr("Debugger \"%1\" not executable.").arg(path));
if (errors & DebuggerNeedsAbsolutePath) {
const QString message =
tr("The debugger location must be given as an "
"absolute path (%1).").arg(path);
result << Task(Task::Error, message, FilePath(), -1, id);
result << BuildSystemTask(Task::Error, message);
}
if (errors & DebuggerDoesNotMatch) {
const QString message = tr("The ABI of the selected debugger does not "
"match the toolchain ABI.");
result << Task(Task::Warning, message, FilePath(), -1, id);
result << BuildSystemTask(Task::Warning, message);
}
return result;
}

View File

@@ -329,7 +329,8 @@ void GdbEngine::handleResponse(const QString &buff)
m_lastWinException = msgWinException(data, &exCode);
showMessage(m_lastWinException, LogMisc);
const Task::TaskType type = isFatalWinException(exCode) ? Task::Error : Task::Warning;
TaskHub::addTask(type, m_lastWinException, Constants::TASK_CATEGORY_DEBUGGER_RUNTIME);
TaskHub::addTask(Task(type, m_lastWinException, {}, -1,
Constants::TASK_CATEGORY_DEBUGGER_RUNTIME));
}
break;
}

View File

@@ -602,9 +602,8 @@ void GenericBuildSystem::updateDeploymentData()
void GenericBuildSystem::removeFiles(const QStringList &filesToRemove)
{
if (removeFiles(nullptr, filesToRemove, nullptr) == RemovedFilesFromProject::Error) {
TaskHub::addTask(Task::Error, tr("Project files list update failed."),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
filesFilePath());
TaskHub::addTask(BuildSystemTask(Task::Error, tr("Project files list update failed."),
filesFilePath()));
}
}

View File

@@ -105,8 +105,8 @@ void IosDeployStep::doRun()
{
QTC_CHECK(m_transferStatus == NoTransfer);
if (device().isNull()) {
TaskHub::addTask(Task::Error, tr("Deployment failed. No iOS device found."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(
DeploymentTask(Task::Error, tr("Deployment failed. No iOS device found.")));
emit finished(!iossimulator().isNull());
cleanup();
return;
@@ -160,9 +160,8 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString
} else {
m_transferStatus = TransferFailed;
if (!m_expectFail)
TaskHub::addTask(Task::Error,
tr("Deployment failed. The settings in the Devices window of Xcode might be incorrect."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Error,
tr("Deployment failed. The settings in the Devices window of Xcode might be incorrect.")));
}
emit finished(status == IosToolHandler::Success);
}
@@ -172,8 +171,7 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
switch (m_transferStatus) {
case TransferInProgress:
m_transferStatus = TransferFailed;
TaskHub::addTask(Task::Error, tr("Deployment failed."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Error, tr("Deployment failed.")));
emit finished(false);
break;
case NoTransfer:
@@ -190,9 +188,8 @@ void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg)
{
Q_UNUSED(handler)
if (msg.contains(QLatin1String("AMDeviceInstallApplication returned -402653103")))
TaskHub::addTask(Task::Warning,
tr("The Info.plist might be incorrect."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Warning, tr("The Info.plist might be incorrect.")));
emit addOutput(msg, BuildStep::OutputFormat::ErrorMessage);
}
@@ -258,14 +255,11 @@ void IosDeployStep::checkProvisioningProfile()
m_expectFail = true;
QString provisioningProfile = provisionPlist.value(QLatin1String("Name")).toString();
QString provisioningUid = provisionPlist.value(QLatin1String("UUID")).toString();
Task task(Task::Warning,
CompileTask task(Task::Warning,
tr("The provisioning profile \"%1\" (%2) used to sign the application "
"does not cover the device %3 (%4). Deployment to it will fail.")
.arg(provisioningProfile, provisioningUid, device->displayName(),
targetId),
Utils::FilePath(), /* filename */
-1, /* line */
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
targetId));
emit addTask(task);
}

View File

@@ -160,9 +160,7 @@ void IosRunner::start()
m_cleanExit = false;
m_qmlServerPort = Port();
if (!QFileInfo::exists(m_bundleDir)) {
TaskHub::addTask(Task::Warning,
tr("Could not find %1.").arg(m_bundleDir),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Warning, tr("Could not find %1.").arg(m_bundleDir)));
reportFailure();
return;
}
@@ -292,13 +290,11 @@ void IosRunner::handleErrorMsg(IosToolHandler *handler, const QString &msg)
QString res(msg);
QString lockedErr ="Unexpected reply: ELocked (454c6f636b6564) vs OK (4f4b)";
if (msg.contains("AMDeviceStartService returned -402653150")) {
TaskHub::addTask(Task::Warning,
tr("Run failed. The settings in the Organizer window of Xcode might be incorrect."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Warning, tr("Run failed. "
"The settings in the Organizer window of Xcode might be incorrect.")));
} else if (res.contains(lockedErr)) {
QString message = tr("The device is locked, please unlock.");
TaskHub::addTask(Task::Error, message,
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Error, message));
res.replace(lockedErr, message);
}
QRegExp qmlPortRe("QML Debugger: Waiting for connection on port ([0-9]+)...");
@@ -454,12 +450,11 @@ void IosDebugSupport::start()
if (deviceSdk2.isDir()) {
deviceSdk = deviceSdk2.toString();
} else {
TaskHub::addTask(Task::Warning, tr(
TaskHub::addTask(DeploymentTask(Task::Warning, tr(
"Could not find device specific debug symbols at %1. "
"Debugging initialization will be slow until you open the Organizer window of "
"Xcode with the device connected to have the symbols generated.")
.arg(deviceSdk1.toUserOutput()),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
.arg(deviceSdk1.toUserOutput())));
}
}
setDeviceSymbolsRoot(deviceSdk);
@@ -487,10 +482,9 @@ void IosDebugSupport::start()
FilePath dsymPath = FilePath::fromString(bundlePath.append(".dSYM"));
if (dsymPath.exists() && dsymPath.toFileInfo().lastModified()
< QFileInfo(iosRunConfig->localExecutable().toUserOutput()).lastModified()) {
TaskHub::addTask(Task::Warning,
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
.arg(dsymPath.toUserOutput()),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
TaskHub::addTask(DeploymentTask(Task::Warning,
tr("The dSYM %1 seems to be outdated, it might confuse the debugger.")
.arg(dsymPath.toUserOutput())));
}
}

View File

@@ -87,12 +87,7 @@ private:
else
return;
Task task(type,
message,
Utils::FilePath::fromUserInput(filename),
lineNumber,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
emit addTask(task);
emit addTask(CompileTask(type, message, FilePath::fromUserInput(filename), lineNumber));
}
};

View File

@@ -108,11 +108,7 @@ bool NimbleTaskStep::validate()
QTC_ASSERT(nimbleBuildSystem, return false);
if (!Utils::contains(nimbleBuildSystem->tasks(), [this](const NimbleTask &task){ return task.name == m_taskName; })) {
emit addTask(Task(Task::Error,
tr("Nimble task %1 not found").arg(m_taskName),
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Error, tr("Nimble task %1 not found").arg(m_taskName)));
emitFaultyConfigurationMessage();
return false;
}

View File

@@ -89,12 +89,7 @@ private:
else
return;
Task task(type,
message,
Utils::FilePath::fromUserInput(filename),
lineNumber,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
emit addTask(task);
emit addTask(CompileTask(type, message, FilePath::fromUserInput(filename), lineNumber));
}
};
@@ -327,20 +322,18 @@ void NimPlugin::testNimParser_data()
<< QString::fromLatin1("main.nim(23, 1) Error: undeclared identifier: 'x'")
<< OutputParserTester::STDERR
<< QString("") << QString("main.nim(23, 1) Error: undeclared identifier: 'x'\n")
<< Tasks({Task(Task::Error,
"Error: undeclared identifier: 'x'",
Utils::FilePath::fromUserInput("main.nim"), 23,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)})
<< Tasks({CompileTask(Task::Error,
"Error: undeclared identifier: 'x'",
FilePath::fromUserInput("main.nim"), 23)})
<< QString();
QTest::newRow("Parse warning string")
<< QString::fromLatin1("lib/pure/parseopt.nim(56, 34) Warning: quoteIfContainsWhite is deprecated [Deprecated]")
<< OutputParserTester::STDERR
<< QString("") << QString("lib/pure/parseopt.nim(56, 34) Warning: quoteIfContainsWhite is deprecated [Deprecated]\n")
<< Tasks({Task(Task::Warning,
"Warning: quoteIfContainsWhite is deprecated [Deprecated]",
Utils::FilePath::fromUserInput("lib/pure/parseopt.nim"), 56,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)})
<< Tasks({CompileTask(Task::Warning,
"Warning: quoteIfContainsWhite is deprecated [Deprecated]",
FilePath::fromUserInput("lib/pure/parseopt.nim"), 56)})
<< QString();
}

View File

@@ -28,6 +28,7 @@
#include "projectexplorerconstants.h"
using namespace ProjectExplorer;
using namespace Utils;
static Task::TaskType taskType(const QString &capture)
{
@@ -66,23 +67,17 @@ void ClangParser::stdError(const QString &line)
match = m_commandRegExp.match(lne);
if (match.hasMatch()) {
m_expectSnippet = true;
Task task(taskType(match.captured(3)),
match.captured(4),
Utils::FilePath(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
newTask(task);
newTask(CompileTask(taskType(match.captured(3)), match.captured(4)));
return;
}
match = m_inLineRegExp.match(lne);
if (match.hasMatch()) {
m_expectSnippet = true;
newTask(Task(Task::Unknown,
lne.trimmed(),
Utils::FilePath::fromUserInput(match.captured(2)), /* filename */
match.captured(3).toInt(), /* line */
Constants::TASK_CATEGORY_COMPILE));
newTask(CompileTask(Task::Unknown,
lne.trimmed(),
FilePath::fromUserInput(match.captured(2)), /* filename */
match.captured(3).toInt() /* line */));
return;
}
@@ -93,24 +88,17 @@ void ClangParser::stdError(const QString &line)
int lineNo = match.captured(4).toInt(&ok);
if (!ok)
lineNo = match.captured(5).toInt(&ok);
Task task(taskType(match.captured(7)),
match.captured(8),
Utils::FilePath::fromUserInput(match.captured(1)), /* filename */
lineNo,
Core::Id(Constants::TASK_CATEGORY_COMPILE));
newTask(task);
newTask(CompileTask(taskType(match.captured(7)),
match.captured(8),
FilePath::fromUserInput(match.captured(1)), /* filename */
lineNo));
return;
}
match = m_codesignRegExp.match(lne);
if (match.hasMatch()) {
m_expectSnippet = true;
Task task(Task::Error,
match.captured(1),
Utils::FilePath(),
-1,
Core::Id(Constants::TASK_CATEGORY_COMPILE));
newTask(task);
newTask(CompileTask(Task::Error, match.captured(1)));
return;
}
@@ -144,13 +132,12 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
QTest::addColumn<Tasks >("tasks");
QTest::addColumn<QString>("outputLines");
const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE;
QTest::newRow("pass-through stdout")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
<< QString::fromLatin1("Sometext\n") << QString()
<< Tasks()
<< QString();
QTest::newRow("pass-through stderr")
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Sometext\n")
@@ -162,21 +149,19 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QLatin1String("argument unused during compilation: '-mthreads'"),
Utils::FilePath(), -1,
categoryCompile))
<< CompileTask(Task::Warning,
"argument unused during compilation: '-mthreads'"))
<< QString();
QTest::newRow("clang++ error")
<< QString::fromLatin1("clang++: error: no input files [err_drv_no_input_files]")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("no input files [err_drv_no_input_files]"),
Utils::FilePath(), -1,
categoryCompile))
<< CompileTask(Task::Error,
"no input files [err_drv_no_input_files]"))
<< QString();
QTest::newRow("complex warning")
<< QString::fromLatin1("In file included from ..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h:45:\n"
"..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h(1425) : warning: unknown attribute 'dllimport' ignored [-Wunknown-attributes]\n"
@@ -185,17 +170,18 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Unknown,
QLatin1String("In file included from ..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h:45:"),
Utils::FilePath::fromUserInput(QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h")), 45,
categoryCompile)
<< Task(Task::Warning,
QLatin1String("unknown attribute 'dllimport' ignored [-Wunknown-attributes]\n"
"class Q_CORE_EXPORT QSysInfo {\n"
" ^"),
Utils::FilePath::fromUserInput(QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h")), 1425,
categoryCompile))
<< CompileTask(Task::Unknown,
"In file included from ..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h:45:",
FilePath::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qnamespace.h"),
45)
<< CompileTask(Task::Warning,
"unknown attribute 'dllimport' ignored [-Wunknown-attributes]\n"
"class Q_CORE_EXPORT QSysInfo {\n"
" ^",
FilePath::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"),
1425))
<< QString();
QTest::newRow("note")
<< QString::fromLatin1("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h:1289:27: note: instantiated from:\n"
"# define Q_CORE_EXPORT Q_DECL_IMPORT\n"
@@ -203,13 +189,14 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Unknown,
QLatin1String("instantiated from:\n"
"# define Q_CORE_EXPORT Q_DECL_IMPORT\n"
" ^"),
Utils::FilePath::fromUserInput(QLatin1String("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h")), 1289,
categoryCompile))
<< CompileTask(Task::Unknown,
"instantiated from:\n"
"# define Q_CORE_EXPORT Q_DECL_IMPORT\n"
" ^",
FilePath::fromUserInput("..\\..\\..\\QtSDK1.1\\Desktop\\Qt\\4.7.3\\mingw\\include/QtCore/qglobal.h"),
1289))
<< QString();
QTest::newRow("fatal error")
<< QString::fromLatin1("/usr/include/c++/4.6/utility:68:10: fatal error: 'bits/c++config.h' file not found\n"
"#include <bits/c++config.h>\n"
@@ -217,12 +204,12 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QLatin1String("'bits/c++config.h' file not found\n"
"#include <bits/c++config.h>\n"
" ^"),
Utils::FilePath::fromUserInput(QLatin1String("/usr/include/c++/4.6/utility")), 68,
categoryCompile))
<< CompileTask(Task::Error,
"'bits/c++config.h' file not found\n"
"#include <bits/c++config.h>\n"
" ^",
FilePath::fromUserInput("/usr/include/c++/4.6/utility"),
68))
<< QString();
QTest::newRow("line confusion")
@@ -232,13 +219,14 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QLatin1String("?: has lower precedence than +; + will be evaluated first [-Wparentheses]\n"
" int x = option->rect.x() + horizontal ? 2 : 6;\n"
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^"),
Utils::FilePath::fromUserInput(QLatin1String("/home/code/src/creator/src/plugins/coreplugin/manhattanstyle.cpp")), 567,
categoryCompile))
<< CompileTask(Task::Warning,
"?: has lower precedence than +; + will be evaluated first [-Wparentheses]\n"
" int x = option->rect.x() + horizontal ? 2 : 6;\n"
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^",
FilePath::fromUserInput("/home/code/src/creator/src/plugins/coreplugin/manhattanstyle.cpp"),
567))
<< QString();
QTest::newRow("code sign error")
<< QString::fromLatin1("Check dependencies\n"
"Code Sign error: No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) were found.\n"
@@ -246,25 +234,21 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("Check dependencies\n")
<< (Tasks()
<< Task(Task::Error,
QLatin1String("No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) were found."),
Utils::FilePath(), -1,
categoryCompile)
<< Task(Task::Error,
QLatin1String("code signing is required for product type 'Application' in SDK 'iOS 7.0'"),
Utils::FilePath(), -1,
categoryCompile))
<< CompileTask(Task::Error,
"No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) were found.")
<< CompileTask(Task::Error,
"code signing is required for product type 'Application' in SDK 'iOS 7.0'"))
<< 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,
categoryCompile)
)
<< CompileTask(Task::Unknown,
"Note: No relevant classes found. No output generated.",
FilePath::fromUserInput("/home/qtwebkithelpviewer.h"),
0))
<< QString();
}

View File

@@ -175,8 +175,7 @@ bool CustomParser::hasMatch(const QString &line, CustomParserExpression::CustomP
const int lineNumber = match.captured(expression.lineNumberCap()).toInt();
const QString message = match.captured(expression.messageCap());
const Task task = Task(taskType, message, fileName, lineNumber, Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(taskType, message, fileName, lineNumber), 1);
return true;
}
@@ -218,7 +217,6 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
QTest::addColumn<Tasks >("tasks");
QTest::addColumn<QString>("outputLines");
const Core::Id categoryCompile = Constants::TASK_CATEGORY_COMPILE;
const QString simplePattern = "^([a-z]+\\.[a-z]+):(\\d+): error: ([^\\s].+)$";
const FilePath fileName = FilePath::fromUserInput("main.c");
@@ -267,7 +265,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern << 1 << 2 << 3
<< QString() << 0 << 0 << 0
<< QString() << QString()
<< Tasks{Task(Task::Error, message, fileName, 9, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, fileName, 9)})
<< QString();
const QString pathPattern = "^([a-z\\./]+):(\\d+): error: ([^\\s].+)$";
@@ -282,7 +280,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< pathPattern << 1 << 2 << 3
<< QString() << 0 << 0 << 0
<< QString() << QString()
<< Tasks{Task(Task::Error, message, expandedFileName, 9, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, expandedFileName, 9)})
<< QString();
expandedFileName = FilePath::fromString("/home/src/project/subdir/main.c");
@@ -294,7 +292,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< pathPattern << 1 << 2 << 3
<< QString() << 0 << 0 << 0
<< QString() << QString()
<< Tasks{Task(Task::Error, message, expandedFileName, 9, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, expandedFileName, 9)})
<< QString();
workingDir = "/home/src/build-project";
@@ -306,7 +304,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< pathPattern << 1 << 2 << 3
<< QString() << 0 << 0 << 0
<< QString() << QString()
<< Tasks{Task(Task::Error, message, expandedFileName, 9, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, expandedFileName, 9)})
<< QString();
QTest::newRow("simple error on wrong channel")
@@ -343,7 +341,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern2 << 2 << 1 << 3
<< QString() << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Error, message, fileName, lineNumber2, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, fileName, lineNumber2)})
<< QString();
QTest::newRow("another simple error on stdout")
@@ -354,7 +352,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern2 << 2 << 1 << 3
<< QString() << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Error, message, fileName, lineNumber2, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, fileName, lineNumber2)})
<< QString();
const QString simpleWarningPattern = "^([a-z]+\\.[a-z]+):(\\d+): warning: ([^\\s].+)$";
@@ -369,7 +367,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< QString() << 1 << 2 << 3
<< simpleWarningPattern << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)}
<< Tasks({CompileTask(Task::Warning, warningMessage, fileName, 1234)})
<< QString();
const QString simpleWarning2 = "Warning: `helloWorld' declared but not used (main.c:19)";
@@ -384,7 +382,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern2 << 1 << 2 << 3
<< simpleWarningPattern2 << 2 << 3 << 1
<< QString() << QString()
<< Tasks{Task(Task::Warning, warningMessage, fileName, lineNumber2, categoryCompile)}
<< Tasks({CompileTask(Task::Warning, warningMessage, fileName, lineNumber2)})
<< QString();
QTest::newRow("warning on wrong channel")
@@ -417,7 +415,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern << 1 << 2 << 3
<< simpleWarningPattern << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Warning, warningMessage, fileName, 1234, categoryCompile)}
<< Tasks({CompileTask(Task::Warning, warningMessage, fileName, 1234)})
<< QString();
QTest::newRow("*error* when equal pattern")
@@ -428,7 +426,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< simplePattern << 1 << 2 << 3
<< simplePattern << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Error, message, fileName, 9, categoryCompile)}
<< Tasks({CompileTask(Task::Error, message, fileName, 9)})
<< QString();
const QString unitTestError = "../LedDriver/LedDriverTest.c:63: FAIL: Expected 0x0080 Was 0xffff";
@@ -445,7 +443,7 @@ void ProjectExplorerPlugin::testCustomOutputParsers_data()
<< unitTestPattern << 1 << 2 << 3
<< QString() << 1 << 2 << 3
<< QString() << QString()
<< Tasks{Task(Task::Error, unitTestMessage, unitTestFileName, unitTestLineNumber, categoryCompile)}
<< Tasks({CompileTask(Task::Error, unitTestMessage, unitTestFileName, unitTestLineNumber)})
<< QString();
}

File diff suppressed because it is too large Load Diff

View File

@@ -34,7 +34,9 @@
#include <QDir>
#include <QFile>
using namespace ProjectExplorer;
using namespace Utils;
namespace ProjectExplorer {
namespace {
// optional full path, make executable name, optional exe extension, optional number in square brackets, colon space
@@ -132,10 +134,10 @@ void GnuMakeParser::stdError(const QString &line)
if (res.isFatal)
++m_fatalErrorCount;
if (!m_suppressIssues) {
taskAdded(Task(res.type, res.description,
Utils::FilePath::fromUserInput(match.captured(1)) /* filename */,
match.captured(4).toInt(), /* line */
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)), 1, 0);
taskAdded(BuildSystemTask(res.type, res.description,
FilePath::fromUserInput(match.captured(1)) /* filename */,
match.captured(4).toInt() /* line */),
1, 0);
}
return;
}
@@ -145,12 +147,8 @@ void GnuMakeParser::stdError(const QString &line)
Result res = parseDescription(match.captured(6));
if (res.isFatal)
++m_fatalErrorCount;
if (!m_suppressIssues) {
Task task = Task(res.type, res.description,
Utils::FilePath() /* filename */, -1, /* line */
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
taskAdded(task, 1, 0);
}
if (!m_suppressIssues)
taskAdded(BuildSystemTask(res.type, res.description), 1, 0);
return;
}
@@ -199,14 +197,7 @@ void GnuMakeParser::taskAdded(const Task &task, int linkedLines, int skippedLine
IOutputParser::taskAdded(editable, linkedLines, skippedLines);
}
#if defined WITH_TESTS
QStringList GnuMakeParser::searchDirectories() const
{
return m_directories;
}
#endif
// Unit tests:
} // ProjectExplorer
#ifdef WITH_TESTS
# include <QTest>
@@ -217,6 +208,13 @@ QStringList GnuMakeParser::searchDirectories() const
# include "projectexplorer.h"
# include "projectexplorerconstants.h"
namespace ProjectExplorer {
QStringList GnuMakeParser::searchDirectories() const
{
return m_directories;
}
GnuMakeParserTester::GnuMakeParserTester(GnuMakeParser *p, QObject *parent) :
QObject(parent),
parser(p)
@@ -289,18 +287,18 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< Tasks()
<< QString()
<< QStringList("/test/dir");
QTest::newRow("make error")
<< QStringList()
<< QString::fromLatin1("make: *** No rule to make target `hello.c', needed by `hello.o'. Stop.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("No rule to make target `hello.c', needed by `hello.o'. Stop."),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"No rule to make target `hello.c', needed by `hello.o'. Stop."))
<< QString()
<< QStringList();
QTest::newRow("multiple fatals")
<< QStringList()
<< QString::fromLatin1("make[3]: *** [.obj/debug-shared/gnumakeparser.o] Error 1\n"
@@ -309,24 +307,23 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("[.obj/debug-shared/gnumakeparser.o] Error 1"),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"[.obj/debug-shared/gnumakeparser.o] Error 1"))
<< QString()
<< QStringList();
QTest::newRow("Makefile error")
<< QStringList()
<< QString::fromLatin1("Makefile:360: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("missing separator (did you mean TAB instead of 8 spaces?). Stop."),
Utils::FilePath::fromUserInput(QLatin1String("Makefile")), 360,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"missing separator (did you mean TAB instead of 8 spaces?). Stop.",
Utils::FilePath::fromUserInput("Makefile"), 360))
<< QString()
<< QStringList();
QTest::newRow("mingw32-make error")
<< QStringList()
<< QString::fromLatin1("mingw32-make[1]: *** [debug/qplotaxis.o] Error 1\n"
@@ -334,36 +331,33 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("[debug/qplotaxis.o] Error 1"),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"[debug/qplotaxis.o] Error 1"))
<< QString()
<< QStringList();
QTest::newRow("mingw64-make error")
<< QStringList()
<< QString::fromLatin1("mingw64-make.exe[1]: *** [dynlib.inst] Error -1073741819")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("[dynlib.inst] Error -1073741819"),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"[dynlib.inst] Error -1073741819"))
<< QString()
<< QStringList();
QTest::newRow("make warning")
<< QStringList()
<< QString::fromLatin1("make[2]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QString::fromLatin1("jobserver unavailable: using -j1. Add `+' to parent make rule."),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Warning,
"jobserver unavailable: using -j1. Add `+' to parent make rule."))
<< QString()
<< QStringList();
QTest::newRow("pass-trough note")
<< QStringList()
<< QString::fromLatin1("/home/dev/creator/share/qtcreator/debugger/dumper.cpp:1079: note: initialized from here")
@@ -372,40 +366,38 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< Tasks()
<< QString()
<< QStringList();
QTest::newRow("Full path make exe")
<< QStringList()
<< QString::fromLatin1("C:\\Qt\\4.6.2-Symbian\\s60sdk\\epoc32\\tools\\make.exe: *** [sis] Error 2")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("[sis] Error 2"),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"[sis] Error 2"))
<< QString()
<< QStringList();
QTest::newRow("missing g++")
<< QStringList()
<< QString::fromLatin1("make: g++: Command not found")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Error,
QString::fromLatin1("g++: Command not found"),
Utils::FilePath(), -1,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Error,
"g++: Command not found"))
<< QString()
<< QStringList();
QTest::newRow("warning in Makefile")
<< QStringList()
<< QString::fromLatin1("Makefile:794: warning: overriding commands for target `xxxx.app/Contents/Info.plist'")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QString::fromLatin1("overriding commands for target `xxxx.app/Contents/Info.plist'"),
Utils::FilePath::fromString(QLatin1String("Makefile")), 794,
Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)))
<< BuildSystemTask(Task::Warning,
"overriding commands for target `xxxx.app/Contents/Info.plist'",
FilePath::fromString("Makefile"), 794))
<< QString()
<< QStringList();
}
@@ -465,42 +457,32 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling_data()
QTest::newRow("no filename")
<< QStringList()
<< QStringList()
<< Task(Task::Error,
QLatin1String("no filename, no mangling"),
Utils::FilePath(),
-1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("no filename, no mangling"),
Utils::FilePath(),
-1,
Constants::TASK_CATEGORY_COMPILE);
<< Task(CompileTask(Task::Error,
"no filename, no mangling"))
<< Task(CompileTask(Task::Error,
"no filename, no mangling"));
QTest::newRow("no mangling")
<< QStringList()
<< QStringList()
<< Task(Task::Error,
QLatin1String("unknown filename, no mangling"),
Utils::FilePath::fromUserInput(QLatin1String("some/path/unknown.cpp")),
-1,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("unknown filename, no mangling"),
Utils::FilePath::fromUserInput(QLatin1String("some/path/unknown.cpp")),
-1,
Constants::TASK_CATEGORY_COMPILE);
<< Task(CompileTask(Task::Error,
"unknown filename, no mangling",
FilePath::fromUserInput("some/path/unknown.cpp")))
<< Task(CompileTask(Task::Error,
"unknown filename, no mangling",
FilePath::fromUserInput("some/path/unknown.cpp")));
QTest::newRow("find file")
<< QStringList("test/file.cpp")
<< QStringList("test")
<< Task(Task::Error,
QLatin1String("mangling"),
Utils::FilePath::fromUserInput(QLatin1String("file.cpp")),
10,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error,
QLatin1String("mangling"),
Utils::FilePath::fromUserInput(QLatin1String("$TMPDIR/test/file.cpp")),
10,
Constants::TASK_CATEGORY_COMPILE);
<< Task(CompileTask(Task::Error,
"mangling",
FilePath::fromUserInput("file.cpp"),
10))
<< Task(CompileTask(Task::Error,
"mangling",
FilePath::fromUserInput("$TMPDIR/test/file.cpp"),
10));
}
void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
@@ -550,4 +532,7 @@ void ProjectExplorerPlugin::testGnuMakeParserTaskMangling()
foreach (const QString &file, files)
filedir.rmpath(tempdir + file);
}
} // ProjectExplorer
#endif

View File

@@ -130,14 +130,14 @@ Tasks SysRootKitAspect::validate(const Kit *k) const
const QFileInfo fi = dir.toFileInfo();
if (!fi.exists()) {
result << Task(Task::Warning, tr("Sys Root \"%1\" does not exist in the file system.").arg(dir.toUserOutput()),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Warning,
tr("Sys Root \"%1\" does not exist in the file system.").arg(dir.toUserOutput()));
} else if (!fi.isDir()) {
result << Task(Task::Warning, tr("Sys Root \"%1\" is not a directory.").arg(dir.toUserOutput()),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Warning,
tr("Sys Root \"%1\" is not a directory.").arg(dir.toUserOutput()));
} else if (QDir(dir.toString()).entryList(QDir::AllEntries | QDir::NoDotAndDotDot).isEmpty()) {
result << Task(Task::Warning, tr("Sys Root \"%1\" is empty.").arg(dir.toUserOutput()),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Warning,
tr("Sys Root \"%1\" is empty.").arg(dir.toUserOutput()));
}
return result;
}
@@ -370,8 +370,7 @@ Tasks ToolChainKitAspect::validate(const Kit *k) const
const QList<ToolChain*> tcList = toolChains(k);
if (tcList.isEmpty()) {
result << Task(Task::Warning, ToolChainKitAspect::msgNoToolChainInTarget(),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Warning, ToolChainKitAspect::msgNoToolChainInTarget());
} else {
QSet<Abi> targetAbis;
foreach (ToolChain *tc, tcList) {
@@ -379,9 +378,9 @@ Tasks ToolChainKitAspect::validate(const Kit *k) const
result << tc->validateKit(k);
}
if (targetAbis.count() != 1) {
result << Task(Task::Error, tr("Compilers produce code for different ABIs: %1")
.arg(Utils::transform<QList>(targetAbis, &Abi::toString).join(", ")),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM));
result << BuildSystemTask(Task::Error,
tr("Compilers produce code for different ABIs: %1")
.arg(Utils::transform<QList>(targetAbis, &Abi::toString).join(", ")));
}
}
return result;
@@ -973,11 +972,9 @@ Tasks DeviceKitAspect::validate(const Kit *k) const
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
Tasks result;
if (dev.isNull())
result.append(Task(Task::Warning, tr("No device set."),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
result.append(BuildSystemTask(Task::Warning, tr("No device set.")));
else if (!dev->isCompatibleWith(k))
result.append(Task(Task::Error, tr("Device is incompatible with this kit."),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
result.append(BuildSystemTask(Task::Error, tr("Device is incompatible with this kit.")));
return result;
}
@@ -1231,10 +1228,9 @@ Tasks EnvironmentKitAspect::validate(const Kit *k) const
QTC_ASSERT(k, return result);
const QVariant variant = k->value(EnvironmentKitAspect::id());
if (!variant.isNull() && !variant.canConvert(QVariant::List)) {
result.append(Task(Task::Error, tr("The environment setting value is invalid."),
Utils::FilePath(), -1, Core::Id(Constants::TASK_CATEGORY_BUILDSYSTEM)));
}
if (!variant.isNull() && !variant.canConvert(QVariant::List))
result << BuildSystemTask(Task::Error, tr("The environment setting value is invalid."));
return result;
}

View File

@@ -214,10 +214,9 @@ bool KitManagerConfigWidget::isDirty() const
QString KitManagerConfigWidget::validityMessage() const
{
Tasks tmp;
if (!m_hasUniqueName) {
tmp.append(Task(Task::Warning, tr("Display name is not unique."), Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE));
}
if (!m_hasUniqueName)
tmp.append(CompileTask(Task::Warning, tr("Display name is not unique.")));
return m_modifiedKit->toHtml(tmp);
}

View File

@@ -69,8 +69,7 @@ void LdParser::stdError(const QString &line)
// ld on macOS
if (lne.startsWith("Undefined symbols for architecture") && lne.endsWith(":")) {
m_incompleteTask = Task(Task::Error, lne, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE);
m_incompleteTask = CompileTask(Task::Error, lne);
return;
}
if (!m_incompleteTask.isNull() && lne.startsWith(" ")) {
@@ -83,22 +82,14 @@ void LdParser::stdError(const QString &line)
}
if (lne.startsWith("collect2:") || lne.startsWith("collect2.exe:")) {
Task task = Task(Task::Error,
lne /* description */,
Utils::FilePath() /* filename */,
-1 /* linenumber */,
Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(Task::Error, lne /* description */), 1);
return;
}
QRegularExpressionMatch match = m_ranlib.match(lne);
if (match.hasMatch()) {
QString description = match.captured(2);
Task task(Task::Warning, description,
Utils::FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(Task::Warning, description), 1);
return;
}
@@ -112,9 +103,7 @@ void LdParser::stdError(const QString &line)
} else if (description.startsWith(QLatin1String("fatal: "))) {
description = description.mid(7);
}
Task task(type, description, Utils::FilePath() /* filename */, -1 /* line */,
Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(type, description), 1);
return;
}
@@ -144,8 +133,7 @@ void LdParser::stdError(const QString &line)
type = Task::Warning;
description = description.mid(9);
}
Task task(type, description, filename, lineno, Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(type, description, filename, lineno), 1);
return;
}

View File

@@ -31,6 +31,7 @@
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
using namespace Utils;
LinuxIccParser::LinuxIccParser() :
m_temporary(Task())
@@ -82,10 +83,10 @@ void LinuxIccParser::stdError(const QString &line)
type = Task::Error;
else if (category == QLatin1String("warning"))
type = Task::Warning;
m_temporary = Task(type, m_firstLine.cap(6).trimmed(),
Utils::FilePath::fromUserInput(m_firstLine.cap(1)),
m_firstLine.cap(2).toInt(),
Constants::TASK_CATEGORY_COMPILE);
m_temporary = CompileTask(type,
m_firstLine.cap(6).trimmed(),
Utils::FilePath::fromUserInput(m_firstLine.cap(1)),
m_firstLine.cap(2).toInt());
m_lines = 1;
m_expectFirstLine = false;
@@ -172,10 +173,9 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("\n")
<< (Tasks()
<< Task(Task::Error,
QLatin1String("identifier \"f\" is undefined\nf(0);"),
Utils::FilePath::fromUserInput(QLatin1String("main.cpp")), 13,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"identifier \"f\" is undefined\nf(0);",
FilePath::fromUserInput(QLatin1String("main.cpp")), 13))
<< QString();
// same, with PCH remark
@@ -188,10 +188,9 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("\n")
<< (Tasks()
<< Task(Task::Error,
QLatin1String("identifier \"f\" is undefined\nf(0);"),
Utils::FilePath::fromUserInput(QLatin1String("main.cpp")), 13,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"identifier \"f\" is undefined\nf(0);",
FilePath::fromUserInput("main.cpp"), 13))
<< QString();
@@ -203,10 +202,9 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("\n")
<< (Tasks()
<< Task(Task::Error,
QLatin1String("function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\nb.privatefunc();"),
Utils::FilePath::fromUserInput(QLatin1String("main.cpp")), 53,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible\nb.privatefunc();",
FilePath::fromUserInput("main.cpp"), 53))
<< QString();
QTest::newRow("simple warning")
@@ -217,21 +215,19 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("\n")
<< (Tasks()
<< Task(Task::Warning,
QLatin1String("use of \"=\" where \"==\" may have been intended\nwhile (a = true)"),
Utils::FilePath::fromUserInput(QLatin1String("main.cpp")), 41,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"use of \"=\" where \"==\" may have been intended\nwhile (a = true)",
FilePath::fromUserInput("main.cpp"), 41))
<< 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,
Constants::TASK_CATEGORY_COMPILE)
)
<< CompileTask(Task::Unknown,
"Note: No relevant classes found. No output generated.",
FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), 0))
<< QString();
}

View File

@@ -39,8 +39,7 @@ void LldParser::stdError(const QString &line)
{
const QString trimmedLine = rightTrimmed(line);
if (trimmedLine.contains("error:") && trimmedLine.contains("lld")) {
emit addTask({Task::Error, trimmedLine, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE});
emit addTask(CompileTask(Task::Error, trimmedLine));
return;
}
static const QStringList prefixes{">>> referenced by ", ">>> defined at ", ">>> "};
@@ -65,8 +64,7 @@ void LldParser::stdError(const QString &line)
const int filePathLen = locOffset == -1 ? -1 : locOffset - filePathOffset;
const auto file = Utils::FilePath::fromUserInput(
trimmedLine.mid(filePathOffset, filePathLen).trimmed());
emit addTask({Task::Unknown, trimmedLine.mid(4).trimmed(), file, lineNo,
Constants::TASK_CATEGORY_COMPILE});
emit addTask(CompileTask(Task::Unknown, trimmedLine.mid(4).trimmed(), file, lineNo));
return;
}
IOutputParser::stdError(line);

View File

@@ -169,11 +169,7 @@ QString MakeStep::msgNoMakeCommand()
Task MakeStep::makeCommandMissingTask()
{
return Task(Task::Error,
msgNoMakeCommand(),
Utils::FilePath(),
-1,
Constants::TASK_CATEGORY_BUILDSYSTEM);
return BuildSystemTask(Task::Error, msgNoMakeCommand());
}
bool MakeStep::isJobCountSupported() const

View File

@@ -76,11 +76,7 @@ static bool handleNmakeJomMessage(const QString &line, Task *task)
if (!matchLength)
return false;
*task = Task(Task::Error,
line.mid(matchLength).trimmed(), /* description */
FilePath(), /* fileName */
-1, /* linenumber */
Constants::TASK_CATEGORY_COMPILE);
*task = CompileTask(Task::Error, line.mid(matchLength).trimmed());
return true;
}
@@ -145,10 +141,9 @@ void MsvcParser::stdOutput(const QString &line)
+ match.captured(4).trimmed();
if (!match.captured(1).isEmpty())
description.chop(1); // Remove trailing quote
m_lastTask = Task(Task::Unknown, description,
FilePath::fromUserInput(match.captured(2)), /* fileName */
match.captured(3).toInt(), /* linenumber */
Constants::TASK_CATEGORY_COMPILE);
m_lastTask = CompileTask(Task::Unknown, description,
FilePath::fromUserInput(match.captured(2)), /* fileName */
match.captured(3).toInt() /* linenumber */);
m_lines = 1;
return;
}
@@ -179,10 +174,9 @@ bool MsvcParser::processCompileLine(const QString &line)
QRegularExpressionMatch match = m_compileRegExp.match(line);
if (match.hasMatch()) {
QPair<FilePath, int> position = parseFileName(match.captured(1));
m_lastTask = Task(taskType(match.captured(2)),
match.captured(3) + match.captured(4).trimmed(), // description
position.first, position.second,
Constants::TASK_CATEGORY_COMPILE);
m_lastTask = CompileTask(taskType(match.captured(2)),
match.captured(3) + match.captured(4).trimmed(), // description
position.first, position.second);
m_lines = 1;
return true;
}
@@ -262,9 +256,8 @@ void ClangClParser::stdError(const QString &lineIn)
if (match.hasMatch()) {
doFlush();
const QPair<FilePath, int> position = parseFileName(match.captured(1));
m_lastTask = Task(taskType(match.captured(2)), match.captured(3).trimmed(),
position.first, position.second,
Constants::TASK_CATEGORY_COMPILE);
m_lastTask = CompileTask(taskType(match.captured(2)), match.captured(3).trimmed(),
position.first, position.second);
m_linkedLines = 1;
return;
}
@@ -326,10 +319,9 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54))
<< "";
QTest::newRow("labeled error-2015")
@@ -337,10 +329,9 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54))
<< "";
QTest::newRow("labeled error with number prefix")
@@ -348,10 +339,9 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"C4716: 'findUnresolvedModule' : must return a value",
FilePath::fromUserInput("qmlstandalone\\main.cpp"), 54))
<< "";
QTest::newRow("labeled warning")
@@ -359,10 +349,9 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69))
<< "";
@@ -371,10 +360,9 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"C4100: 'something' : unreferenced formal parameter",
FilePath::fromUserInput("x:\\src\\plugins\\projectexplorer\\msvcparser.cpp"), 69))
<< "";
QTest::newRow("additional information")
@@ -383,14 +371,12 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
"C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\icompletioncollector.h"), 50,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\icompletioncollector.h"), 50)
<< CompileTask(Task::Unknown,
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39))
<< "";
QTest::newRow("additional information with prefix")
@@ -399,14 +385,12 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
"C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\icompletioncollector.h"), 50,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"C4099: 'TextEditor::CompletionItem' : type name first seen using 'struct' now seen using 'class'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\icompletioncollector.h"), 50)
<< CompileTask(Task::Unknown,
"see declaration of 'TextEditor::CompletionItem'",
FilePath::fromUserInput("x:\\src\\plugins\\texteditor\\completionsupport.h"), 39))
<< "";
QTest::newRow("fatal linker error")
@@ -414,10 +398,8 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"LNK1146: no argument specified with option '/LIBPATH:'",
FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"LNK1146: no argument specified with option '/LIBPATH:'"))
<< "";
// This actually comes through stderr!
@@ -426,11 +408,10 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDERR
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
"D9002 : ignoring unknown option '-fopenmp'",
FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
"D9002 : ignoring unknown option '-fopenmp'"))
<< "";
QTest::newRow("complex error")
<< "..\\untitled\\main.cpp(19) : error C2440: 'initializing' : cannot convert from 'int' to 'std::_Tree<_Traits>::iterator'\n"
" with\n"
@@ -441,35 +422,34 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"C2440: 'initializing' : cannot convert from 'int' to 'std::_Tree<_Traits>::iterator'\n"
"with\n"
"[\n"
" _Traits=std::_Tmap_traits<int,double,std::less<int>,std::allocator<std::pair<const int,double>>,false>\n"
"]\n"
"No constructor could take the source type, or constructor overload resolution was ambiguous",
FilePath::fromUserInput("..\\untitled\\main.cpp"), 19,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"C2440: 'initializing' : cannot convert from 'int' to 'std::_Tree<_Traits>::iterator'\n"
"with\n"
"[\n"
" _Traits=std::_Tmap_traits<int,double,std::less<int>,std::allocator<std::pair<const int,double>>,false>\n"
"]\n"
"No constructor could take the source type, or constructor overload resolution was ambiguous",
FilePath::fromUserInput("..\\untitled\\main.cpp"), 19))
<< "";
QTest::newRow("Linker error 1")
<< "main.obj : error LNK2019: unresolved external symbol \"public: void __thiscall Data::doit(void)\" (?doit@Data@@QAEXXZ) referenced in function _main"
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"LNK2019: unresolved external symbol \"public: void __thiscall Data::doit(void)\" (?doit@Data@@QAEXXZ) referenced in function _main",
FilePath::fromUserInput("main.obj"), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"LNK2019: unresolved external symbol \"public: void __thiscall Data::doit(void)\" (?doit@Data@@QAEXXZ) referenced in function _main",
FilePath::fromUserInput("main.obj"), -1))
<< "";
QTest::newRow("Linker error 2")
<< "debug\\Experimentation.exe : fatal error LNK1120: 1 unresolved externals"
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"LNK1120: 1 unresolved externals",
FilePath::fromUserInput("debug\\Experimentation.exe"), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"LNK1120: 1 unresolved externals",
FilePath::fromUserInput("debug\\Experimentation.exe")))
<< "";
QTest::newRow("nmake error")
@@ -477,20 +457,17 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist.",
FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"dependent '..\\..\\..\\..\\creator-2.5\\src\\plugins\\coreplugin\\ifile.h' does not exist."))
<< "";
QTest::newRow("jom error")
<< "Error: dependent 'main.cpp' does not exist."
<< OutputParserTester::STDERR
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"dependent 'main.cpp' does not exist.",
FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"dependent 'main.cpp' does not exist."))
<< "";
QTest::newRow("Multiline error")
@@ -505,23 +482,20 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
<< CompileTask(Task::Warning,
"C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'",
FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2227,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2227)
<< CompileTask(Task::Unknown,
"see declaration of 'std::_Copy_impl'",
FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2212,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
FilePath::fromUserInput("c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"), 2212)
<< CompileTask(Task::Unknown,
"see reference to function template instantiation '_OutIt std::copy<const unsigned char*,unsigned short*>(_InIt,_InIt,_OutIt)' being compiled\n"
"with\n"
"[\n"
" _OutIt=unsigned short *,\n"
" _InIt=const unsigned char *\n"
"]",
FilePath::fromUserInput("symbolgroupvalue.cpp"), 2314,
Constants::TASK_CATEGORY_COMPILE))
FilePath::fromUserInput("symbolgroupvalue.cpp"), 2314))
<< "";
QTest::newRow("Ambiguous symbol")
@@ -531,19 +505,17 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
<< CompileTask(Task::Error,
"C2872: 'UINT64' : ambiguous symbol",
FilePath::fromUserInput("D:\\Project\\file.h"), 98,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
FilePath::fromUserInput("D:\\Project\\file.h"), 98)
<< CompileTask(Task::Unknown,
"could be unsigned __int64 UINT64",
FilePath::fromUserInput("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h"), 83,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
FilePath::fromUserInput("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\include\\basetsd.h"), 83)
<< CompileTask(Task::Unknown,
"or Types::UINT64",
FilePath::fromUserInput("D:\\Project\\types.h"), 71,
Constants::TASK_CATEGORY_COMPILE))
FilePath::fromUserInput("D:\\Project\\types.h"), 71))
<< "";
QTest::newRow("ignore moc note")
<< "/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated."
<< OutputParserTester::STDERR
@@ -557,14 +529,12 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDOUT
<< "" << ""
<< (Tasks()
<< Task(Task::Error,
"C2733: 'func': second C linkage of overloaded function not allowed",
FilePath::fromUserInput("main.cpp"), 7,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Unknown,
"see declaration of 'func'",
FilePath::fromUserInput("main.cpp"), 6,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
"C2733: 'func': second C linkage of overloaded function not allowed",
FilePath::fromUserInput("main.cpp"), 7)
<< CompileTask(Task::Unknown,
"see declaration of 'func'",
FilePath::fromUserInput("main.cpp"), 6))
<< "";
QTest::newRow("cyrillic warning") // QTCREATORBUG-20297
@@ -572,9 +542,8 @@ void ProjectExplorerPlugin::testMsvcOutputParsers_data()
<< OutputParserTester::STDERR
<< "" << ""
<< (Tasks()
<< Task(Task::Warning,
QString::fromUtf8("D9025: переопределение \"/MDd\" на \"/MTd\""),
FilePath(), -1, Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
QString::fromUtf8("D9025: переопределение \"/MDd\" на \"/MTd\"")))
<< "";
}
@@ -644,21 +613,16 @@ void ProjectExplorerPlugin::testClangClOutputParsers_data()
<< OutputParserTester::STDERR
<< "" << expectedStderr
<< (Tasks()
<< Task(Task::Warning, warning1.trimmed(),
FilePath::fromUserInput("./qwindowseglcontext.h"), 282,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning, warning2.trimmed(),
FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 60,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Warning, warning3.trimmed(),
FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 61,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error, expectedError1,
FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 48,
Constants::TASK_CATEGORY_COMPILE)
<< Task(Task::Error, error2.trimmed(),
FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 51,
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning, warning1.trimmed(),
FilePath::fromUserInput("./qwindowseglcontext.h"), 282)
<< CompileTask(Task::Warning, warning2.trimmed(),
FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 60)
<< CompileTask(Task::Warning, warning3.trimmed(),
FilePath::fromUserInput(".\\qwindowsclipboard.cpp"), 61)
<< CompileTask(Task::Error, expectedError1,
FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 48)
<< CompileTask(Task::Error, error2.trimmed(),
FilePath::fromUserInput(".\\qwindowsgdinativeinterface.cpp"), 51))
<< "";
}

View File

@@ -756,7 +756,7 @@ void MsvcToolChain::initEnvModWatcher(const QFuture<GenerateEnvResult> &future)
if (result.error) {
const QString &errorMessage = *result.error;
if (!errorMessage.isEmpty())
TaskHub::addTask(Task::Error, errorMessage, Constants::TASK_CATEGORY_COMPILE);
TaskHub::addTask(CompileTask(Task::Error, errorMessage));
} else {
updateEnvironmentModifications(result.environmentItems);
}
@@ -833,7 +833,7 @@ Utils::Environment MsvcToolChain::readEnvironmentSetting(const Utils::Environmen
if (result.error) {
const QString &errorMessage = *result.error;
if (!errorMessage.isEmpty())
TaskHub::addTask(Task::Error, errorMessage, Constants::TASK_CATEGORY_COMPILE);
TaskHub::addTask(CompileTask(Task::Error, errorMessage));
} else {
resultEnv.modify(result.environmentItems);
}

View File

@@ -40,10 +40,8 @@ void OsParser::stdError(const QString &line)
{
if (Utils::HostOsInfo::isLinuxHost()) {
const QString trimmed = line.trimmed();
if (trimmed.contains(QLatin1String(": error while loading shared libraries:"))) {
emit addTask(Task(Task::Error, trimmed, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_COMPILE));
}
if (trimmed.contains(QLatin1String(": error while loading shared libraries:")))
emit addTask(CompileTask(Task::Error, trimmed));
}
IOutputParser::stdError(line);
}
@@ -53,9 +51,9 @@ void OsParser::stdOutput(const QString &line)
if (Utils::HostOsInfo::isWindowsHost()) {
const QString trimmed = line.trimmed();
if (trimmed == QLatin1String("The process cannot access the file because it is being used by another process.")) {
emit addTask(Task(Task::Error, tr("The process cannot access the file because it is being used by another process.\n"
"Please close all running instances of your application before starting a build."),
Utils::FilePath(), -1, Constants::TASK_CATEGORY_COMPILE));
emit addTask(CompileTask(Task::Error, tr(
"The process cannot access the file because it is being used by another process.\n"
"Please close all running instances of your application before starting a build.")));
m_hasFatalError = true;
}
}

View File

@@ -275,7 +275,7 @@ void RunConfiguration::setUpdater(const Updater &updater)
Task RunConfiguration::createConfigurationIssue(const QString &description) const
{
return {Task::Error, description, FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM};
return BuildSystemTask(Task::Error, description);
}
QVariantMap RunConfiguration::toMap() const

View File

@@ -38,8 +38,9 @@
#include <QFileInfo>
#include <QTextStream>
namespace ProjectExplorer
{
using namespace Utils;
namespace ProjectExplorer {
static QIcon taskTypeIcon(Task::TaskType t)
{
@@ -74,24 +75,18 @@ Task::Task(TaskType type_, const QString &description_,
Task Task::compilerMissingTask()
{
return Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"%1 needs a compiler set up to build. "
"Configure a compiler in the kit options.")
.arg(Core::Constants::IDE_DISPLAY_NAME),
Utils::FilePath(), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM);
return BuildSystemTask(Task::Error,
tr("%1 needs a compiler set up to build. "
"Configure a compiler in the kit options.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
}
Task Task::buildConfigurationMissingTask()
{
return Task(Task::Error,
QCoreApplication::translate("ProjectExplorer::Task",
"%1 needs a build configuration set up to build. "
"Configure a build configuration in the project settings.")
.arg(Core::Constants::IDE_DISPLAY_NAME),
Utils::FilePath(), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM);
return BuildSystemTask(Task::Error,
tr("%1 needs a build configuration set up to build. "
"Configure a build configuration in the project settings.")
.arg(Core::Constants::IDE_DISPLAY_NAME));
}
void Task::setMark(TextEditor::TextMark *mark)
@@ -196,4 +191,22 @@ bool containsType(const Tasks &issues, Task::TaskType type)
return Utils::contains(issues, [type](const Task &t) { return t.type == type; });
}
// CompilerTask
CompileTask::CompileTask(TaskType type, const QString &desc, const FilePath &file, int line)
: Task(type, desc, file, line, ProjectExplorer::Constants::TASK_CATEGORY_COMPILE)
{}
// BuildSystemTask
BuildSystemTask::BuildSystemTask(Task::TaskType type, const QString &desc, const FilePath &file, int line)
: Task(type, desc, file, line, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)
{}
// DeploymentTask
DeploymentTask::DeploymentTask(Task::TaskType type, const QString &desc)
: Task(type, desc, {}, -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT)
{}
} // namespace ProjectExplorer

View File

@@ -45,6 +45,8 @@ class TaskHub;
// Documentation inside.
class PROJECTEXPLORER_EXPORT Task
{
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::Task)
public:
enum TaskType : char {
Unknown,
@@ -102,6 +104,30 @@ private:
friend class TaskHub;
};
class PROJECTEXPLORER_EXPORT CompileTask : public Task
{
public:
CompileTask(TaskType type,
const QString &description,
const Utils::FilePath &file = {},
int line = -1);
};
class PROJECTEXPLORER_EXPORT BuildSystemTask : public Task
{
public:
BuildSystemTask(TaskType type,
const QString &description,
const Utils::FilePath &file = {},
int line = -1);
};
class PROJECTEXPLORER_EXPORT DeploymentTask : public Task
{
public:
DeploymentTask(TaskType type, const QString &description);
};
using Tasks = QVector<Task>;
bool PROJECTEXPLORER_EXPORT operator==(const Task &t1, const Task &t2);

View File

@@ -144,9 +144,9 @@ TaskHub *TaskHub::instance()
return m_instance;
}
void TaskHub::addTask(Task::TaskType type, const QString &description, Core::Id category, const Utils::FilePath &file, int line)
void TaskHub::addTask(Task::TaskType type, const QString &description, Core::Id category)
{
addTask(Task(type, description, file, line, category));
addTask(Task(type, description, {}, -1, category));
}
void TaskHub::addTask(Task task)

View File

@@ -42,9 +42,7 @@ public:
// Convenience overload
static void addTask(Task::TaskType type, const QString &description,
Core::Id category,
const Utils::FilePath &file = Utils::FilePath(),
int line = -1);
Core::Id category);
public slots:
static void addTask(ProjectExplorer::Task task);

View File

@@ -32,6 +32,8 @@
#include <QCoreApplication>
using namespace Utils;
namespace ProjectExplorer {
static const char failureRe[] = "\\*\\* BUILD FAILED \\*\\*$";
@@ -70,13 +72,10 @@ void XcodebuildParser::stdOutput(const QString &line)
return;
}
if (lne.endsWith(QLatin1String(signatureChangeEndsWithPattern))) {
Task task(Task::Warning,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Replacing signature"),
Utils::FilePath::fromString(
lne.left(lne.size() - QLatin1String(signatureChangeEndsWithPattern).size())), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
CompileTask task(Task::Warning,
tr("Replacing signature"),
FilePath::fromString(
lne.left(lne.size() - QLatin1String(signatureChangeEndsWithPattern).size())));
taskAdded(task, 1);
return;
}
@@ -93,13 +92,7 @@ void XcodebuildParser::stdError(const QString &line)
++m_fatalErrorCount;
m_xcodeBuildParserState = UnknownXcodebuildState;
// unfortunately the m_lastTarget, m_lastProject might not be in sync
Task task(Task::Error,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Xcodebuild failed."),
Utils::FilePath(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE);
taskAdded(task);
taskAdded(CompileTask(Task::Error, tr("Xcodebuild failed.")));
return;
}
if (m_xcodeBuildParserState == OutsideXcodebuild) { // also forward if UnknownXcodebuildState ?
@@ -211,6 +204,7 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
<< Tasks()
<< QString()
<< XcodebuildParser::OutsideXcodebuild;
QTest::newRow("switch in->unknown")
<< XcodebuildParser::InXcodebuild
<< QString::fromLatin1("insideErr\n"
@@ -219,15 +213,11 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< Task(
Task::Error,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Xcodebuild failed."),
Utils::FilePath(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
XcodebuildParser::tr("Xcodebuild failed.")))
<< QString()
<< XcodebuildParser::UnknownXcodebuildState;
QTest::newRow("switch out->unknown")
<< XcodebuildParser::OutsideXcodebuild
<< QString::fromLatin1("outErr\n"
@@ -236,28 +226,22 @@ void ProjectExplorerPlugin::testXcodebuildParserParsing_data()
<< OutputParserTester::STDERR
<< QString() << QString::fromLatin1("outErr\n")
<< (Tasks()
<< Task(
Task::Error,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Xcodebuild failed."),
Utils::FilePath(), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Error,
XcodebuildParser::tr("Xcodebuild failed.")))
<< QString()
<< XcodebuildParser::UnknownXcodebuildState;
QTest::newRow("inside catch codesign replace signature")
<< XcodebuildParser::InXcodebuild
<< QString::fromLatin1("/somepath/somefile.app: replacing existing signature") << OutputParserTester::STDOUT
<< QString() << QString()
<< (Tasks()
<< Task(Task::Warning,
QCoreApplication::translate("ProjectExplorer::XcodebuildParser",
"Replacing signature"),
Utils::FilePath::fromString(QLatin1String("/somepath/somefile.app")), /* filename */
-1, /* line */
Constants::TASK_CATEGORY_COMPILE))
<< CompileTask(Task::Warning,
XcodebuildParser::tr("Replacing signature"),
FilePath::fromString("/somepath/somefile.app")))
<< QString()
<< XcodebuildParser::InXcodebuild;
QTest::newRow("outside forward codesign replace signature")
<< XcodebuildParser::OutsideXcodebuild
<< QString::fromLatin1("/somepath/somefile.app: replacing existing signature") << OutputParserTester::STDOUT

View File

@@ -400,10 +400,7 @@ void QbsBuildStep::handleProcessResult(
void QbsBuildStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message,
const QString &file, int line)
{
ProjectExplorer::Task task = ProjectExplorer::Task(type, message,
Utils::FilePath::fromString(file), line,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(type, message, FilePath::fromString(file), line), 1);
emit addOutput(message, OutputFormat::Stdout);
}

View File

@@ -147,9 +147,7 @@ void QbsCleanStep::handleProgress(int value)
void QbsCleanStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type, const QString &message, const QString &file, int line)
{
Task task(type, message, Utils::FilePath::fromString(file), line,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
emit addTask(task, 1);
emit addTask(CompileTask(type, message, Utils::FilePath::fromString(file), line), 1);
emit addOutput(message, OutputFormat::Stdout);
}

View File

@@ -202,9 +202,7 @@ void QbsInstallStep::handleProgress(int value)
void QbsInstallStep::createTaskAndOutput(ProjectExplorer::Task::TaskType type,
const QString &message, const QString &file, int line)
{
ProjectExplorer::Task task = ProjectExplorer::Task(type, message,
Utils::FilePath::fromString(file), line,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
const CompileTask task(type, message, Utils::FilePath::fromString(file), line);
emit addTask(task, 1);
emit addOutput(message, OutputFormat::Stdout);
}

View File

@@ -197,8 +197,8 @@ QbsBuildSystem::QbsBuildSystem(QbsBuildConfiguration *bc)
m_sourcesForGeneratedFiles.clear();
});
connect(m_session, &QbsSession::errorOccurred, this, [](QbsSession::Error e) {
TaskHub::addTask(Task::Error, tr("Fatal qbs error: %1").arg(QbsSession::errorString(e)),
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
const QString msg = tr("Fatal qbs error: %1").arg(QbsSession::errorString(e));
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
});
connect(m_session, &QbsSession::fileListUpdated, this, &QbsBuildSystem::delayParsing);
@@ -644,9 +644,8 @@ void QbsBuildSystem::updateAfterBuild()
void QbsBuildSystem::generateErrors(const ErrorInfo &e)
{
for (const ErrorInfoItem &item : e.items) {
TaskHub::addTask(Task::Error, item.description,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
item.filePath, item.line);
TaskHub::addTask(BuildSystemTask(Task::Error, item.description,
item.filePath, item.line));
}
}

View File

@@ -494,9 +494,8 @@ void QbsSession::handlePacket(const QJsonObject &packet)
// TODO: This loop occurs a lot. Factor it out.
for (const ErrorInfoItem &item : errorInfo.items) {
TaskHub::addTask(Task::Warning, item.description,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
item.filePath, item.line);
TaskHub::addTask(BuildSystemTask(Task::Warning, item.description,
item.filePath, item.line));
}
} else if (type == "task-started") {
emit taskStarted(packet.value("description").toString(),

View File

@@ -769,9 +769,8 @@ QmakeBuildConfigurationFactory::QmakeBuildConfigurationFactory()
if (QmakeSettings::warnAgainstUnalignedBuildDir()
&& !QmakeBuildConfiguration::isBuildDirAtSafeLocation(
QFileInfo(projectPath).absoluteDir().path(), QDir(buildDir).absolutePath())) {
issues.append(Task(Task::Warning, QmakeBuildConfiguration::unalignedBuildDirWarning(),
Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
issues.append(BuildSystemTask(Task::Warning,
QmakeBuildConfiguration::unalignedBuildDirWarning()));
}
return issues;
});

View File

@@ -99,11 +99,10 @@ Tasks QmakeKitAspect::validate(const Kit *k) const
const QString mkspec = QmakeKitAspect::mkspec(k);
if (!version && !mkspec.isEmpty())
result << Task(Task::Warning, tr("No Qt version set, so mkspec is ignored."),
FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
result << BuildSystemTask(Task::Warning, tr("No Qt version set, so mkspec is ignored."));
if (version && !version->hasMkspec(mkspec))
result << Task(Task::Error, tr("Mkspec not found for Qt version."),
FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
result << BuildSystemTask(Task::Error, tr("Mkspec not found for Qt version."));
return result;
}

View File

@@ -218,8 +218,7 @@ void QmakeMakeStep::finish(bool success)
&& QmakeSettings::warnAgainstUnalignedBuildDir()) {
const QString msg = tr("The build directory is not at the same level as the source "
"directory, which could be the reason for the build failure.");
emit addTask(Task(Task::Warning, msg, Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Warning, msg));
}
MakeStep::finish(success);
}

View File

@@ -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

View File

@@ -1228,14 +1228,13 @@ void QmakeBuildSystem::testToolChain(ToolChain *tc, const FilePath &path) const
return;
}
TaskHub::addTask(
Task(Task::Warning,
BuildSystemTask(Task::Warning,
QCoreApplication::translate(
"QmakeProjectManager",
"\"%1\" is used by qmake, but \"%2\" is configured in the kit.\n"
"Please update your kit (%3) or choose a mkspec for qmake that matches "
"your target environment better.")
.arg(path.toUserOutput()).arg(expected.toUserOutput()).arg(k->displayName()),
Utils::FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
.arg(path.toUserOutput()).arg(expected.toUserOutput()).arg(k->displayName())));
m_toolChainWarnings.insert(pair);
}

View File

@@ -501,12 +501,8 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
const Id dt = DeviceTypeKitAspect::deviceTypeId(k);
const QSet<Id> tdt = targetDeviceTypes();
if (!tdt.isEmpty() && !tdt.contains(dt)) {
result << Task(Task::Warning,
QCoreApplication::translate("BaseQtVersion",
"Device type is not supported by Qt version."),
FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
}
if (!tdt.isEmpty() && !tdt.contains(dt))
result << BuildSystemTask(Task::Warning, tr("Device type is not supported by Qt version."));
ToolChain *tc = ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (tc) {
@@ -529,21 +525,16 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
QString message;
if (!fullMatch) {
if (!fuzzyMatch)
message = QCoreApplication::translate("BaseQtVersion",
"The compiler \"%1\" (%2) cannot produce code for the Qt version \"%3\" (%4).");
message = tr("The compiler \"%1\" (%2) cannot produce code for the Qt version \"%3\" (%4).");
else
message = QCoreApplication::translate("BaseQtVersion",
"The compiler \"%1\" (%2) may not produce code compatible with the Qt version \"%3\" (%4).");
message = tr("The compiler \"%1\" (%2) may not produce code compatible with the Qt version \"%3\" (%4).");
message = message.arg(tc->displayName(), targetAbi.toString(),
version->displayName(), qtAbiString);
result << Task(fuzzyMatch ? Task::Warning : Task::Error, message, FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
result << BuildSystemTask(fuzzyMatch ? Task::Warning : Task::Error, message);
}
} else if (ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::C_LANGUAGE_ID)) {
const QString message = QCoreApplication::translate("BaseQtVersion",
"The kit has a Qt version, but no C++ compiler.");
result << Task(Task::Warning, message, FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
const QString message = tr("The kit has a Qt version, but no C++ compiler.");
result << BuildSystemTask(Task::Warning, message);
}
return result;
}
@@ -1680,8 +1671,7 @@ Tasks BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &bui
if (!isValid()) {
//: %1: Reason for being invalid
const QString msg = QCoreApplication::translate("QmakeProjectManager::QtVersion", "The Qt version is invalid: %1").arg(invalidReason());
results.append(Task(Task::Error, msg, FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
results.append(BuildSystemTask(Task::Error, msg));
}
QFileInfo qmakeInfo = qmakeCommand().toFileInfo();
@@ -1690,8 +1680,7 @@ Tasks BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &bui
//: %1: Path to qmake executable
const QString msg = QCoreApplication::translate("QmakeProjectManager::QtVersion",
"The qmake command \"%1\" was not found or is not executable.").arg(qmakeCommand().toUserOutput());
results.append(Task(Task::Error, msg, FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
results.append(BuildSystemTask(Task::Error, msg));
}
return results;

View File

@@ -87,6 +87,8 @@ class BaseQtVersionPrivate;
class QTSUPPORT_EXPORT BaseQtVersion
{
Q_DECLARE_TR_FUNCTIONS(QtSupport::BaseQtVersion)
public:
using Predicate = std::function<bool(const BaseQtVersion *)>;

View File

@@ -29,7 +29,7 @@
#include <projectexplorer/projectexplorerconstants.h>
using namespace QtSupport;
using ProjectExplorer::Task;
using namespace ProjectExplorer;
// opt. drive letter + filename: (2 brackets)
#define FILE_PATTERN "^(([A-Za-z]:)?[^:]+\\.[^:]+)"
@@ -57,10 +57,9 @@ void QtParser::stdError(const QString &line)
type = Task::Warning;
if (level.compare(QLatin1String("Note"), Qt::CaseInsensitive) == 0)
type = Task::Unknown;
Task task(type, m_mocRegExp.cap(5).trimmed() /* description */,
Utils::FilePath::fromUserInput(m_mocRegExp.cap(1)) /* filename */,
lineno,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
CompileTask task(type, m_mocRegExp.cap(5).trimmed() /* description */,
Utils::FilePath::fromUserInput(m_mocRegExp.cap(1)) /* filename */,
lineno);
emit addTask(task, 1);
return;
}
@@ -68,10 +67,8 @@ void QtParser::stdError(const QString &line)
Task::TaskType type = Task::Warning;
if (m_translationRegExp.cap(1) == QLatin1String("Error"))
type = Task::Error;
Task task(type, m_translationRegExp.cap(2),
Utils::FilePath::fromUserInput(m_translationRegExp.cap(3)) /* filename */,
-1,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE);
CompileTask task(type, m_translationRegExp.cap(2),
Utils::FilePath::fromUserInput(m_translationRegExp.cap(3)));
emit addTask(task, 1);
return;
}
@@ -129,55 +126,49 @@ void QtSupportPlugin::testQtOutputParser_data()
<< QString::fromLatin1("/home/user/dev/qt5/qtscript/src/script/api/qscriptengine.cpp:295: warning: Can't create link to 'Object Trees & Ownership'")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << Task(Task::Warning,
<< (Tasks() << CompileTask(Task::Warning,
QLatin1String("Can't create link to 'Object Trees & Ownership'"),
Utils::FilePath::fromUserInput(QLatin1String("/home/user/dev/qt5/qtscript/src/script/api/qscriptengine.cpp")), 295,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("/home/user/dev/qt5/qtscript/src/script/api/qscriptengine.cpp")), 295))
<< QString();
QTest::newRow("moc warning")
<< QString::fromLatin1("..\\untitled\\errorfile.h:0: Warning: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << Task(Task::Warning,
<< (Tasks() << CompileTask(Task::Warning,
QLatin1String("No relevant classes found. No output generated."),
Utils::FilePath::fromUserInput(QLatin1String("..\\untitled\\errorfile.h")), 0,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("..\\untitled\\errorfile.h")), 0))
<< QString();
QTest::newRow("moc warning 2")
<< QString::fromLatin1("c:\\code\\test.h(96): Warning: Property declaration ) has no READ accessor function. The property will be invalid.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << Task(Task::Warning,
<< (Tasks() << CompileTask(Task::Warning,
QLatin1String("Property declaration ) has no READ accessor function. The property will be invalid."),
Utils::FilePath::fromUserInput(QLatin1String("c:\\code\\test.h")), 96,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("c:\\code\\test.h")), 96))
<< 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,
<< (Tasks() << CompileTask(Task::Unknown,
QLatin1String("No relevant classes found. No output generated."),
Utils::FilePath::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("/home/qtwebkithelpviewer.h")), 0))
<< QString();
QTest::newRow("ninja with moc")
<< QString::fromLatin1("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h(54): Error: Undefined interface")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << Task(Task::Error,
<< (Tasks() << CompileTask(Task::Error,
QLatin1String("Undefined interface"),
Utils::FilePath::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54))
<< QString();
QTest::newRow("translation")
<< QString::fromLatin1("Warning: dropping duplicate messages in '/some/place/qtcreator_fr.qm'")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks() << Task(Task::Warning,
<< (Tasks() << CompileTask(Task::Warning,
QLatin1String("dropping duplicate messages"),
Utils::FilePath::fromUserInput(QLatin1String("/some/place/qtcreator_fr.qm")), -1,
ProjectExplorer::Constants::TASK_CATEGORY_COMPILE))
Utils::FilePath::fromUserInput(QLatin1String("/some/place/qtcreator_fr.qm")), -1))
<< QString();
}

View File

@@ -135,17 +135,13 @@ void AbstractPackagingStep::setDeploymentDataModified()
void AbstractPackagingStep::raiseError(const QString &errorMessage)
{
Task task = Task(Task::Error, errorMessage, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task);
emit addTask(DeploymentTask(Task::Error, errorMessage));
emit addOutput(errorMessage, BuildStep::OutputFormat::Stderr);
}
void AbstractPackagingStep::raiseWarning(const QString &warningMessage)
{
Task task = Task(Task::Warning, warningMessage, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task);
emit addTask(DeploymentTask(Task::Warning, warningMessage));
emit addOutput(warningMessage, OutputFormat::ErrorMessage);
}

View File

@@ -139,18 +139,14 @@ void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message
void AbstractRemoteLinuxDeployStep::handleErrorMessage(const QString &message)
{
ProjectExplorer::Task task = Task(Task::Error, message, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task, 1); // TODO correct?
emit addTask(DeploymentTask(Task::Error, message), 1); // TODO correct?
emit addOutput(message, OutputFormat::ErrorMessage);
d->hasError = true;
}
void AbstractRemoteLinuxDeployStep::handleWarningMessage(const QString &message)
{
ProjectExplorer::Task task = Task(Task::Warning, message, Utils::FilePath(), -1,
Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task, 1); // TODO correct?
emit addTask(DeploymentTask(Task::Warning, message), 1); // TODO correct?
emit addOutput(message, OutputFormat::ErrorMessage);
}

View File

@@ -131,28 +131,27 @@ bool MakeInstallStep::init()
return false;
const QString rootDirPath = installRoot().toString();
if (rootDirPath.isEmpty()) {
emit addTask(Task(Task::Error, tr("You must provide an install root."), FilePath(), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Error, tr("You must provide an install root.")));
return false;
}
QDir rootDir(rootDirPath);
if (cleanInstallRoot() && !rootDir.removeRecursively()) {
emit addTask(Task(Task::Error, tr("The install root \"%1\" could not be cleaned.")
.arg(installRoot().toUserOutput()),
FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Error,
tr("The install root \"%1\" could not be cleaned.")
.arg(installRoot().toUserOutput())));
return false;
}
if (!rootDir.exists() && !QDir::root().mkpath(rootDirPath)) {
emit addTask(Task(Task::Error, tr("The install root \"%1\" could not be created.")
.arg(installRoot().toUserOutput()),
FilePath(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM));
emit addTask(BuildSystemTask(Task::Error,
tr("The install root \"%1\" could not be created.")
.arg(installRoot().toUserOutput())));
return false;
}
if (this == deployConfiguration()->stepList()->steps().last()) {
emit addTask(Task(Task::Warning, tr("The \"make install\" step should probably not be "
emit addTask(BuildSystemTask(Task::Warning,
tr("The \"make install\" step should probably not be "
"last in the list of deploy steps. "
"Consider moving it up."), FilePath(), -1,
Constants::TASK_CATEGORY_BUILDSYSTEM));
"Consider moving it up.")));
}
const MakeInstallCommand cmd = target()->makeInstallCommand(installRoot().toString());
if (cmd.environment.size() > 0) {
@@ -189,9 +188,8 @@ void MakeInstallStep::finish(bool success)
}
buildSystem()->setDeploymentData(m_deploymentData);
} else if (m_noInstallTarget && m_isCmakeProject) {
emit addTask(Task(Task::Warning, tr("You need to add an install statement to your "
"CMakeLists.txt file for deployment to work."),
FilePath(), -1, ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
emit addTask(DeploymentTask(Task::Warning, tr("You need to add an install statement "
"to your CMakeLists.txt file for deployment to work.")));
}
MakeStep::finish(success);
}

View File

@@ -153,8 +153,8 @@ static bool parseTaskFile(QString *errorString, const FilePath &name)
}
description = unescape(description);
TaskHub::addTask(type, description, Constants::TASKLISTTASK_ID,
FilePath::fromUserInput(file), line);
TaskHub::addTask(Task(type, description, FilePath::fromUserInput(file), line,
Constants::TASKLISTTASK_ID));
}
return true;
}

View File

@@ -248,17 +248,13 @@ QString WinRtPackageDeploymentStep::defaultWinDeployQtArguments() const
void WinRtPackageDeploymentStep::raiseError(const QString &errorMessage)
{
ProjectExplorer::Task task = Task(Task::Error, errorMessage, Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task, 1);
emit addTask(DeploymentTask(Task::Error, errorMessage), 1);
emit addOutput(errorMessage, BuildStep::OutputFormat::ErrorMessage);
}
void WinRtPackageDeploymentStep::raiseWarning(const QString &warningMessage)
{
ProjectExplorer::Task task = Task(Task::Warning, warningMessage, Utils::FilePath(), -1,
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
emit addTask(task, 1);
emit addTask(DeploymentTask(Task::Warning, warningMessage), 1);
emit addOutput(warningMessage, BuildStep::OutputFormat::NormalMessage);
}