qmake: Do not bring general messages pane to front

- message(): Print to general messages and blink
- warning(), error(): create item in Issues pane
- parse error and other errors: create item in Issues pane

Task-number: QTCREATORBUG-24430
Change-Id: I6b37cef0b9e53e2207341bd179e2c60a40da9ee0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2020-11-27 14:36:32 +01:00
parent d3412cfcdc
commit 18e3e70887
4 changed files with 26 additions and 12 deletions

View File

@@ -39,6 +39,7 @@
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <qtsupport/profilereader.h> #include <qtsupport/profilereader.h>
#include <texteditor/icodestylepreferences.h> #include <texteditor/icodestylepreferences.h>
#include <texteditor/tabsettings.h> #include <texteditor/tabsettings.h>
@@ -774,7 +775,7 @@ QPair<ProFile *, QStringList> QmakePriFile::readProFile()
&contents, &contents,
&m_textFormat, &m_textFormat,
&errorMsg) != TextFileFormat::ReadSuccess) { &errorMsg) != TextFileFormat::ReadSuccess) {
QmakeBuildSystem::proFileParseError(errorMsg); QmakeBuildSystem::proFileParseError(errorMsg, filePath());
return qMakePair(includeFile, lines); return qMakePair(includeFile, lines);
} }
lines = contents.split('\n'); lines = contents.split('\n');
@@ -1655,7 +1656,7 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
} }
foreach (const QString &error, evalResult->errors) foreach (const QString &error, evalResult->errors)
QmakeBuildSystem::proFileParseError(error); QmakeBuildSystem::proFileParseError(error, filePath());
// we are changing what is executed in that case // we are changing what is executed in that case
if (result->state == QmakeEvalResult::EvalFail || m_buildSystem->wasEvaluateCanceled()) { if (result->state == QmakeEvalResult::EvalFail || m_buildSystem->wasEvaluateCanceled()) {
@@ -1666,8 +1667,10 @@ void QmakeProFile::applyEvaluate(QmakeEvalResult *evalResult)
if (result->state == QmakeEvalResult::EvalFail) { if (result->state == QmakeEvalResult::EvalFail) {
QmakeBuildSystem::proFileParseError( QmakeBuildSystem::proFileParseError(
QCoreApplication::translate("QmakeProFile", "Error while parsing file %1. Giving up.") QCoreApplication::translate("QmakeProFile",
.arg(filePath().toUserOutput())); "Error while parsing file %1. Giving up.")
.arg(filePath().toUserOutput()),
filePath());
if (m_projectType == ProjectType::Invalid) if (m_projectType == ProjectType::Invalid)
return; return;

View File

@@ -646,6 +646,7 @@ bool QmakeBuildSystem::wasEvaluateCanceled()
void QmakeBuildSystem::asyncUpdate() void QmakeBuildSystem::asyncUpdate()
{ {
TaskHub::clearTasks(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
setParseDelay(UPDATE_INTERVAL); setParseDelay(UPDATE_INTERVAL);
TRACE(""); TRACE("");
@@ -671,7 +672,7 @@ void QmakeBuildSystem::asyncUpdate()
"have a valid Qt.") "have a valid Qt.")
.arg(project()->displayName(), k->displayName()) .arg(project()->displayName(), k->displayName())
: tr("Cannot parse project \"%1\": No kit selected.").arg(project()->displayName()); : tr("Cannot parse project \"%1\": No kit selected.").arg(project()->displayName());
proFileParseError(errorMessage); proFileParseError(errorMessage, project()->projectFilePath());
m_asyncUpdateFutureInterface.reportCanceled(); m_asyncUpdateFutureInterface.reportCanceled();
m_asyncUpdateFutureInterface.reportFinished(); m_asyncUpdateFutureInterface.reportFinished();
return; return;
@@ -761,9 +762,9 @@ FilePath QmakeBuildSystem::buildDir(const FilePath &proFilePath) const
return FilePath::fromString(QDir::cleanPath(QDir(buildDir).absoluteFilePath(relativeDir))); return FilePath::fromString(QDir::cleanPath(QDir(buildDir).absoluteFilePath(relativeDir)));
} }
void QmakeBuildSystem::proFileParseError(const QString &errorMessage) void QmakeBuildSystem::proFileParseError(const QString &errorMessage, const FilePath &filePath)
{ {
Core::MessageManager::write(errorMessage); TaskHub::addTask(BuildSystemTask(Task::Error, errorMessage, filePath));
} }
QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFile *qmakeProFile) QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFile *qmakeProFile)

View File

@@ -158,7 +158,7 @@ public:
void watchFolders(const QStringList &l, QmakePriFile *file); void watchFolders(const QStringList &l, QmakePriFile *file);
void unwatchFolders(const QStringList &l, QmakePriFile *file); void unwatchFolders(const QStringList &l, QmakePriFile *file);
static void proFileParseError(const QString &errorMessage); static void proFileParseError(const QString &errorMessage, const Utils::FilePath &filePath);
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown }; enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
AsyncUpdateState asyncUpdateState() const; AsyncUpdateState asyncUpdateState() const;

View File

@@ -26,10 +26,12 @@
#include "profilereader.h" #include "profilereader.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/taskhub.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
using namespace ProjectExplorer;
using namespace QtSupport; using namespace QtSupport;
static QString format(const QString &fileName, int lineNo, const QString &msg) static QString format(const QString &fileName, int lineNo, const QString &msg)
@@ -53,7 +55,7 @@ ProMessageHandler::ProMessageHandler(bool verbose, bool exact)
ProMessageHandler::~ProMessageHandler() ProMessageHandler::~ProMessageHandler()
{ {
if (!m_messages.isEmpty()) if (!m_messages.isEmpty())
Core::MessageManager::writeMessages(m_messages); Core::MessageManager::writeMessages(m_messages, Core::MessageManager::Flash);
} }
@@ -61,14 +63,22 @@ ProMessageHandler::~ProMessageHandler()
void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo) void ProMessageHandler::message(int type, const QString &msg, const QString &fileName, int lineNo)
{ {
if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) { if ((type & CategoryMask) == ErrorMessage && ((type & SourceMask) == SourceParser || m_verbose)) {
appendMessage(format(fileName, lineNo, msg)); // parse error in qmake files
TaskHub::addTask(
BuildSystemTask(Task::Error, msg, Utils::FilePath::fromString(fileName), lineNo));
} }
} }
void ProMessageHandler::fileMessage(int type, const QString &msg) void ProMessageHandler::fileMessage(int type, const QString &msg)
{ {
Q_UNUSED(type) // message(), warning() or error() calls in qmake files
if (m_verbose) if (!m_verbose)
return;
if (type == QMakeHandler::ErrorMessage)
TaskHub::addTask(BuildSystemTask(Task::Error, msg));
else if (type == QMakeHandler::WarningMessage)
TaskHub::addTask(BuildSystemTask(Task::Warning, msg));
else
appendMessage(msg); appendMessage(msg);
} }