Commit ba8e7d11 authored by Tobias Hunger's avatar Tobias Hunger

CMake: Report more cmake errors in server mode

Handle more kinds of errors in CMake server-mode.

Task-number: QTCREATORBUG-18318
Change-Id: I43fff7f3cfbd86d01ff05a0936261b8d91aa5d70
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent 7e81d330
......@@ -73,6 +73,17 @@ ServerModeReader::ServerModeReader()
if (m_cmakeFiles.contains(document->filePath()))
emit dirty();
});
connect(&m_parser, &CMakeParser::addOutput,
this, [](const QString &m) { Core::MessageManager::write(m); });
connect(&m_parser, &CMakeParser::addTask, this, [this](const Task &t) {
Task editable(t);
if (!editable.file.isEmpty()) {
QDir srcDir(m_parameters.sourceDirectory.toString());
editable.file = FileName::fromString(srcDir.absoluteFilePath(editable.file.toString()));
}
TaskHub::addTask(editable);
});
}
ServerModeReader::~ServerModeReader()
......@@ -98,8 +109,13 @@ void ServerModeReader::setParameters(const BuildDirReader::Parameters &p)
this, &ServerModeReader::handleProgress);
connect(m_cmakeServer.get(), &ServerMode::cmakeSignal,
this, &ServerModeReader::handleSignal);
connect(m_cmakeServer.get(), &ServerMode::cmakeMessage,
this, [this](const QString &m) { Core::MessageManager::write(m); });
connect(m_cmakeServer.get(), &ServerMode::cmakeMessage, [this](const QString &m) {
const QStringList lines = m.split('\n');
for (const QString &l : lines) {
m_parser.stdError(l);
Core::MessageManager::write(l + "\n");
}
});
connect(m_cmakeServer.get(), &ServerMode::message,
this, [](const QString &m) { Core::MessageManager::write(m); });
connect(m_cmakeServer.get(), &ServerMode::connected,
......@@ -168,6 +184,7 @@ void ServerModeReader::stop()
m_future->reportFinished();
m_future.reset();
}
m_parser.flush();
}
bool ServerModeReader::isReady() const
......
......@@ -27,6 +27,7 @@
#include "builddirreader.h"
#include "servermode.h"
#include "cmakeparser.h"
#include <memory>
......@@ -148,6 +149,8 @@ private:
QList<Project *> m_projects;
mutable QList<Target *> m_targets;
QList<FileGroup *> m_fileGroups;
CMakeParser m_parser;
};
} // namespace Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment