forked from qt-creator/qt-creator
Suppress issues for .pro files that are excluded from exact parse
If a subdir in a subdir .pro file is excluded from the build with a
scope, it still is parsed with an exact parser
(in case cumulative parsing fails? see e.g.
440c40f534
)
In that case we may not add issues to the issues pane from the exact
parser though, since for the subdir it is unexpected to be handled in
that situation. Post to messages pane like before (without popping it up
though).
Fixes: QTCREATORBUG-25201
Change-Id: If626a5cbc0001170f28bce89ae17394323af2a7b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -34,6 +34,16 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace QtSupport;
|
||||
|
||||
static QString format(const QString &fileName, int lineNo, const QString &msg)
|
||||
{
|
||||
if (lineNo > 0)
|
||||
return QString::fromLatin1("%1(%2): %3").arg(fileName, QString::number(lineNo), msg);
|
||||
else if (lineNo)
|
||||
return QString::fromLatin1("%1: %3").arg(fileName, msg);
|
||||
else
|
||||
return msg;
|
||||
}
|
||||
|
||||
ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
|
||||
: m_verbose(verbose)
|
||||
, m_exact(exact)
|
||||
@@ -54,8 +64,12 @@ void ProMessageHandler::message(int type, const QString &msg, const QString &fil
|
||||
{
|
||||
if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) {
|
||||
// parse error in qmake files
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo));
|
||||
if (m_exact) {
|
||||
TaskHub::addTask(
|
||||
BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo));
|
||||
} else {
|
||||
appendMessage(format(fileName, lineNo, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,9 +78,9 @@ void ProMessageHandler::fileMessage(int type, const QString &msg)
|
||||
// message(), warning() or error() calls in qmake files
|
||||
if (!m_verbose)
|
||||
return;
|
||||
if (type == QMakeHandler::ErrorMessage)
|
||||
if (m_exact && type == QMakeHandler::ErrorMessage)
|
||||
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
|
||||
else if (type == QMakeHandler::WarningMessage)
|
||||
else if (m_exact && type == QMakeHandler::WarningMessage)
|
||||
TaskHub::addTask(BuildSystemTask(Task::Warning, msg));
|
||||
else
|
||||
appendMessage(msg);
|
||||
|
Reference in New Issue
Block a user