Meson: Use new message manager API

Avoid bringing general messages pane to front.
Flash when starting a process, write output silently afterwards.
Put an error into issues pane if parsing fails
Also don't log debug messages by default.

Task-number: QTCREATORBUG-24430
Change-Id: If4cbc1f48b0749b44410e2ac14d6796d63e4610e
Reviewed-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2020-12-01 14:57:54 +01:00
parent 91395f1334
commit db2b085010
3 changed files with 11 additions and 7 deletions

View File

@@ -32,6 +32,7 @@
#include "settings/tools/kitaspect/mesontoolkitaspect.h" #include "settings/tools/kitaspect/mesontoolkitaspect.h"
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/taskhub.h>
#include <qtsupport/qtcppkitinfo.h> #include <qtsupport/qtcppkitinfo.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
@@ -56,9 +57,11 @@
m_parseGuard = {}; \ m_parseGuard = {}; \
}; };
using namespace ProjectExplorer;
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
static Q_LOGGING_CATEGORY(mesonBuildSystemLog, "qtc.meson.buildsystem", QtDebugMsg); static Q_LOGGING_CATEGORY(mesonBuildSystemLog, "qtc.meson.buildsystem", QtWarningMsg);
MesonBuildSystem::MesonBuildSystem(MesonBuildConfiguration *bc) MesonBuildSystem::MesonBuildSystem(MesonBuildConfiguration *bc)
: ProjectExplorer::BuildSystem{bc} : ProjectExplorer::BuildSystem{bc}
@@ -101,6 +104,7 @@ void MesonBuildSystem::parsingCompleted(bool success)
UNLOCK(true); UNLOCK(true);
emitBuildSystemUpdated(); emitBuildSystemUpdated();
} else { } else {
TaskHub::addTask(BuildSystemTask(Task::Error, tr("Meson build: Parsing failed")));
UNLOCK(false); UNLOCK(false);
emitBuildSystemUpdated(); emitBuildSystemUpdated();
} }

View File

@@ -40,7 +40,7 @@
namespace MesonProjectManager { namespace MesonProjectManager {
namespace Internal { namespace Internal {
static Q_LOGGING_CATEGORY(mesonProcessLog, "qtc.meson.buildsystem", QtDebugMsg); static Q_LOGGING_CATEGORY(mesonProcessLog, "qtc.meson.buildsystem", QtWarningMsg);
MesonProcess::MesonProcess() MesonProcess::MesonProcess()
{ {
@@ -107,7 +107,7 @@ void MesonProcess::handleProcessFinished(int code, QProcess::ExitStatus status)
m_future.reportFinished(); m_future.reportFinished();
} }
const QString elapsedTime = Utils::formatElapsedTime(m_elapsed.elapsed()); const QString elapsedTime = Utils::formatElapsedTime(m_elapsed.elapsed());
Core::MessageManager::write(elapsedTime); Core::MessageManager::writeSilently(elapsedTime);
emit finished(code, status); emit finished(code, status);
} }
@@ -183,7 +183,7 @@ void MesonProcess::setupProcess(const Command &command,
m_process->setWorkingDirectory(command.workDir().toString()); m_process->setWorkingDirectory(command.workDir().toString());
m_process->setEnvironment(env); m_process->setEnvironment(env);
Core::MessageManager::write( Core::MessageManager::writeFlashing(
tr("Running %1 in %2.").arg(command.toUserOutput()).arg(command.workDir().toUserOutput())); tr("Running %1 in %2.").arg(command.toUserOutput()).arg(command.workDir().toUserOutput()));
m_process->setCommand(command.cmdLine()); m_process->setCommand(command.cmdLine());
} }
@@ -213,7 +213,7 @@ void MesonProcess::processStandardOutput()
{ {
QTC_ASSERT(m_process, return ); QTC_ASSERT(m_process, return );
auto data = m_process->readAllStandardOutput(); auto data = m_process->readAllStandardOutput();
Core::MessageManager::write(QString::fromLocal8Bit(data)); Core::MessageManager::writeSilently(QString::fromLocal8Bit(data));
emit readyReadStandardOutput(data); emit readyReadStandardOutput(data);
} }
@@ -221,7 +221,7 @@ void MesonProcess::processStandardError()
{ {
QTC_ASSERT(m_process, return ); QTC_ASSERT(m_process, return );
Core::MessageManager::write(QString::fromLocal8Bit(m_process->readAllStandardError())); Core::MessageManager::writeSilently(QString::fromLocal8Bit(m_process->readAllStandardError()));
} }
} // namespace Internal } // namespace Internal
} // namespace MesonProjectManager } // namespace MesonProjectManager

View File

@@ -305,7 +305,7 @@ void MesonProjectParser::processFinished(int exitCode, QProcess::ExitStatus exit
} else { } else {
if (m_introType == IntroDataType::stdo) { if (m_introType == IntroDataType::stdo) {
auto data = m_process.stdErr(); auto data = m_process.stdErr();
Core::MessageManager::write(QString::fromLocal8Bit(data)); Core::MessageManager::writeSilently(QString::fromLocal8Bit(data));
m_outputParser.readStdo(data); m_outputParser.readStdo(data);
} }
emit parsingCompleted(false); emit parsingCompleted(false);