Send errors to TaskHub
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectmacroexpander.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <qmljs/qmljssimplereader.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
@@ -146,7 +148,10 @@ void SnapcraftProject::asyncUpdate()
|
||||
try {
|
||||
YAML::Node yaml = YAML::LoadFile(m_fileName.toString().toStdString());
|
||||
if (!m_rootNode->syncFromYAMLNode(yaml)) {
|
||||
if(debug) qDebug()<<"Invalid YAML file";
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: file is invalid"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath());
|
||||
}
|
||||
|
||||
QStringList commandList;
|
||||
@@ -154,7 +159,10 @@ void SnapcraftProject::asyncUpdate()
|
||||
try {
|
||||
YAML::Node commands = yaml["apps"];
|
||||
if (!commands.IsMap()) {
|
||||
if(debug) qDebug()<<"apps is not a map";
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: apps is not a map"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath());
|
||||
} else {
|
||||
for (auto it = commands.begin(); it != commands.end(); ++it) {
|
||||
if(!it->second.IsMap() || it->second["daemon"])
|
||||
@@ -174,7 +182,11 @@ void SnapcraftProject::asyncUpdate()
|
||||
}
|
||||
|
||||
} catch (const YAML::Exception &e) {
|
||||
if(debug) qDebug()<<"Error while parsing the command list: "<<e.what();
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing the command list: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath(),
|
||||
e.mark.line);
|
||||
}
|
||||
|
||||
if (m_commands != commandList) {
|
||||
@@ -183,7 +195,11 @@ void SnapcraftProject::asyncUpdate()
|
||||
}
|
||||
|
||||
} catch (const YAML::Exception &e) {
|
||||
if(debug) qDebug() << e.what();
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing the project file: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath(),
|
||||
e.mark.line);
|
||||
}
|
||||
|
||||
if (oldDisplayName != displayName())
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "snapcraftprojectnode.h"
|
||||
#include "snapcraftproject.h"
|
||||
|
||||
#include <projectexplorer/nodesvisitor.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
|
||||
@@ -73,9 +76,6 @@ SnapcraftProjectNode::SnapcraftProjectNode(SnapcraftProject *rootProject, const
|
||||
|
||||
SnapcraftProjectNode::~SnapcraftProjectNode()
|
||||
{
|
||||
if (m_watcher) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
@@ -87,7 +87,10 @@ bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
|
||||
YAML::Node parts = rootNode["parts"];
|
||||
if (!parts.IsMap()) {
|
||||
if(debug) qDebug()<<"Parts is not a map";
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: parts is not a map"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
m_rootProject->projectFilePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,7 +170,11 @@ bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
removeFolderNodes(nodesToRemove);
|
||||
addFolderNodes(nodesToAdd);
|
||||
} catch (const YAML::Exception &e) {
|
||||
if(debug) qDebug()<<"ERRROR ERROR ERROR "<<e.what();
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
m_rootProject->projectFilePath(),
|
||||
e.mark.line);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user