diff options
author | Christian Kandeler <[email protected]> | 2020-04-16 13:53:05 +0200 |
---|---|---|
committer | Christian Kandeler <[email protected]> | 2020-04-23 08:47:08 +0000 |
commit | 1c6e4fbd3211bc180b0de95d232226825bcb124d (patch) | |
tree | c9adce875a62a7fa980eb8a99231034585ae8fbf /src/plugins/qmakeprojectmanager/qmakeparser.cpp | |
parent | b7851eeb55fd284bd647b7042e7f94a1ea1d3490 (diff) |
Merge output formatters and output parsers
Now only one piece of code needs to be written to both linkify output in
an output pane and create tasks for it in the issues pane.
The calling sites are also simplified. For instance, until now, build
steps had to feed their output parsers manually and then push the
created tasks up the signal stack in parallel with the actual output,
which the build manager relied upon for cross-linking the output pane
content. Afterwards, the output would get forwarded to the formatter
(and parsed for ANSI escape codes a second time). In contrast, a build
step now just forwards the process output, and task parsing as well as
output formatting is done centrally further up the stack.
Concrete user-visible improvements so far:
- File paths in compiler/linker messages are clickable links now.
- QtTest applications now create clickable links also when run
as part of a build step, not just in the app output pane.
Task-number: QTCREATORBUG-22665
Change-Id: Ic9fb95b2d97f2520ab3ec653315e9219466ec08d
Reviewed-by: Christian Kandeler <[email protected]>
Reviewed-by: hjk <[email protected]>
Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/qmakeprojectmanager/qmakeparser.cpp')
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakeparser.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakeparser.cpp b/src/plugins/qmakeprojectmanager/qmakeparser.cpp index 20633f397df..64e08bf675a 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparser.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparser.cpp @@ -40,7 +40,7 @@ QMakeParser::QMakeParser() : m_error(QLatin1String("^(.+):(\\d+):\\s(.+)$")) m_error.setMinimal(true); } -OutputTaskParser::Status QMakeParser::handleLine(const QString &line, OutputFormat type) +OutputLineParser::Result QMakeParser::handleLine(const QString &line, OutputFormat type) { if (type != Utils::StdErrFormat) return Status::NotHandled; @@ -49,11 +49,14 @@ OutputTaskParser::Status QMakeParser::handleLine(const QString &line, OutputForm QString fileName = m_error.cap(1); Task::TaskType type = Task::Error; const QString description = m_error.cap(3); + int fileNameOffset = m_error.pos(1); if (fileName.startsWith(QLatin1String("WARNING: "))) { type = Task::Warning; fileName = fileName.mid(9); + fileNameOffset += 9; } else if (fileName.startsWith(QLatin1String("ERROR: "))) { fileName = fileName.mid(7); + fileNameOffset += 7; } if (description.startsWith(QLatin1String("note:"), Qt::CaseInsensitive)) type = Task::Unknown; @@ -61,23 +64,25 @@ OutputTaskParser::Status QMakeParser::handleLine(const QString &line, OutputForm type = Task::Warning; else if (description.startsWith(QLatin1String("error:"), Qt::CaseInsensitive)) type = Task::Error; - emit addTask(BuildSystemTask(type, - description, - absoluteFilePath(FilePath::fromUserInput(fileName)), - m_error.cap(2).toInt() /* line */), - 1); - return Status::Done; + + BuildSystemTask t(type, description, absoluteFilePath(FilePath::fromUserInput(fileName)), + m_error.cap(2).toInt() /* line */); + LinkSpecs linkSpecs; + addLinkSpecForAbsoluteFilePath(linkSpecs, t.file, t.line, fileNameOffset, + fileName.length()); + scheduleTask(t, 1); + return {Status::Done, linkSpecs}; } if (lne.startsWith(QLatin1String("Project ERROR: ")) || lne.startsWith(QLatin1String("ERROR: "))) { const QString description = lne.mid(lne.indexOf(QLatin1Char(':')) + 2); - emit addTask(BuildSystemTask(Task::Error, description), 1); + scheduleTask(BuildSystemTask(Task::Error, description), 1); return Status::Done; } if (lne.startsWith(QLatin1String("Project WARNING: ")) || lne.startsWith(QLatin1String("WARNING: "))) { const QString description = lne.mid(lne.indexOf(QLatin1Char(':')) + 2); - emit addTask(BuildSystemTask(Task::Warning, description), 1); + scheduleTask(BuildSystemTask(Task::Warning, description), 1); return Status::Done; } return Status::NotHandled; @@ -174,7 +179,7 @@ void QmakeProjectManagerPlugin::testQmakeOutputParsers_data() << (Tasks() << BuildSystemTask(Task::Unknown, "Note: No relevant classes found. No output generated.", - FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), 0)) + FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), -1)) << QString(); } |