summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qt4projectmanager/makestep.cpp17
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/qt-s60.pri2
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp8
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/sbsv2parser.cpp228
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/sbsv2parser.h72
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp1
-rw-r--r--src/plugins/qt4projectmanager/qt4projectmanagerplugin.h4
7 files changed, 326 insertions, 6 deletions
diff --git a/src/plugins/qt4projectmanager/makestep.cpp b/src/plugins/qt4projectmanager/makestep.cpp
index 6ca7e21078..e49ccb539c 100644
--- a/src/plugins/qt4projectmanager/makestep.cpp
+++ b/src/plugins/qt4projectmanager/makestep.cpp
@@ -35,6 +35,8 @@
#include "qt4buildconfiguration.h"
#include "qt4projectmanagerconstants.h"
#include "qtparser.h"
+#include "qt-s60/abldparser.h"
+#include "qt-s60/sbsv2parser.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/gnumakeparser.h>
@@ -171,8 +173,19 @@ bool MakeStep::init()
setEnabled(true);
setArguments(args);
- setOutputParser(new QtParser);
- appendOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory));
+ if (bc->qtVersion()->supportsTargetId(Qt4ProjectManager::Constants::S60_DEVICE_TARGET_ID) ||
+ bc->qtVersion()->supportsTargetId(Qt4ProjectManager::Constants::S60_EMULATOR_TARGET_ID)) {
+ if (bc->qtVersion()->isBuildWithSymbianSbsV2()) {
+ setOutputParser(new SbsV2Parser);
+ } else {
+ setOutputParser(new AbldParser);
+ appendOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory));
+ }
+ } else {
+ setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory));
+ }
+ appendOutputParser(new QtParser);
+
if (toolchain)
appendOutputParser(toolchain->outputParser());
diff --git a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
index 428376e509..1dfbb5d8af 100644
--- a/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
+++ b/src/plugins/qt4projectmanager/qt-s60/qt-s60.pri
@@ -4,6 +4,7 @@
SOURCES += $$PWD/s60devices.cpp \
$$PWD/s60devicespreferencepane.cpp \
$$PWD/s60manager.cpp \
+ $$PWD/sbsv2parser.cpp \
$$PWD/winscwtoolchain.cpp \
$$PWD/gccetoolchain.cpp \
$$PWD/s60emulatorrunconfiguration.cpp \
@@ -22,6 +23,7 @@ SOURCES += $$PWD/s60devices.cpp \
HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h \
+ $$PWD/sbsv2parser.h \
$$PWD/winscwtoolchain.h \
$$PWD/gccetoolchain.h \
$$PWD/s60emulatorrunconfiguration.h \
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
index f5856ad29a..e876e4f1db 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60createpackagestep.cpp
@@ -34,6 +34,7 @@
#include "qt4nodes.h"
#include "qt4project.h"
#include "abldparser.h"
+#include "sbsv2parser.h"
#include "signsisparser.h"
#include "passphraseforkeydialog.h"
@@ -190,8 +191,11 @@ bool S60CreatePackageStep::init()
}
delete m_outputParserChain;
- m_outputParserChain = new ProjectExplorer::GnuMakeParser;
- m_outputParserChain->appendOutputParser(new Qt4ProjectManager::AbldParser);
+ if (qt4BuildConfiguration()->qtVersion()->isBuildWithSymbianSbsV2())
+ m_outputParserChain = new Qt4ProjectManager::SbsV2Parser;
+ else
+ m_outputParserChain = new Qt4ProjectManager::AbldParser;
+ m_outputParserChain->appendOutputParser(new ProjectExplorer::GnuMakeParser);
m_outputParserChain->appendOutputParser(new Qt4ProjectManager::SignsisParser);
connect(m_outputParserChain, SIGNAL(addOutput(QString, ProjectExplorer::BuildStep::OutputFormat)),
diff --git a/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.cpp b/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.cpp
new file mode 100644
index 0000000000..8d0fa8f949
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.cpp
@@ -0,0 +1,228 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#include "sbsv2parser.h"
+
+#include <extensionsystem/pluginmanager.h>
+#include <projectexplorer/gnumakeparser.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/taskhub.h>
+#include <projectexplorer/taskwindow.h>
+
+#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+
+using namespace Qt4ProjectManager;
+using namespace ProjectExplorer;
+using namespace ProjectExplorer::Constants;
+
+/*
+ * This parser takes a somewhat unusal approach of just eating most of its
+ * input :-)
+ *
+ * Only when the XML-based log file generated by SBSv2 is announced it will
+ * open that file and parse that. Tasks will then get generated by passing
+ * any CDATA found in the XML file on to its child parsers (using STDERR).
+ *
+ * In additon <error> and <warning> tags are reported, too.
+ */
+
+SbsV2Parser::SbsV2Parser() :
+ m_hub(0)
+{
+ setObjectName(QLatin1String("SbsV2Parser"));
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ m_hub = pm->getObject<TaskHub>();
+}
+
+void SbsV2Parser::stdOutput(const QString &line)
+{
+ // Eat most output!
+ if (line.startsWith(QLatin1String("sbs: build log in "))) {
+ QString logfile = line.mid(18).trimmed();
+ parseLogFile(logfile);
+ addTask(ProjectExplorer::Task(Task::Unknown, tr("SBSv2 build log"),
+ logfile, -1,
+ QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)));
+ }
+}
+
+void SbsV2Parser::stdError(const QString &line)
+{
+ // Eat all output!
+ Q_UNUSED(line);
+}
+
+void SbsV2Parser::taskAdded(const ProjectExplorer::Task &task)
+{
+ // Fix pathes:
+ ProjectExplorer::Task tmp(task);
+
+ if (!tmp.file.isEmpty()) {
+ QFileInfo fi(tmp.file);
+ if (!fi.isAbsolute()) {
+ if (m_currentSource.exists(tmp.file))
+ tmp.file = m_currentSource.absoluteFilePath(tmp.file);
+ else if (m_currentTarget.exists(tmp.file))
+ tmp.file = m_currentTarget.absoluteFilePath(tmp.file);
+ }
+ }
+
+ // Do not report tasks from our children via the normal channel:
+ // We do not want them get registered with the Compile output window!
+ m_hub->addTask(tmp);
+}
+
+void SbsV2Parser::parseLogFile(const QString &file)
+{
+ QFile logFile(file);
+ logFile.open(QIODevice::ReadOnly);
+ m_log.setDevice(&logFile);
+
+ if (m_log.readNextStartElement()) {
+ if (m_log.name() == QLatin1String("buildlog"))
+ readBuildLog();
+ else
+ m_log.raiseError(QObject::tr("The file is not SBSv2 log file."));
+ }
+}
+
+void SbsV2Parser::readBuildLog()
+{
+ Q_ASSERT(m_log.isStartElement() && m_log.name() == QLatin1String("buildlog"));
+
+ while (m_log.readNextStartElement()) {
+ if (m_log.name() == QLatin1String("error"))
+ readError();
+ else if (m_log.name() == QLatin1String("warning"))
+ readWarning();
+ else if (m_log.name() == QLatin1String("recipe"))
+ readRecipe();
+ else
+ m_log.skipCurrentElement();
+ }
+}
+
+void SbsV2Parser::readError()
+{
+ Q_ASSERT(m_log.isStartElement() && m_log.name() == QLatin1String("error"));
+
+ QString error = m_log.readElementText();
+ addTask(Task(Task::Error, error, QString(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM));
+}
+
+void SbsV2Parser::readWarning()
+{
+ Q_ASSERT(m_log.isStartElement() && m_log.name() == QLatin1String("warning"));
+
+ QString warning = m_log.readElementText();
+ addTask(Task(Task::Warning, warning, QString(), -1, Constants::TASK_CATEGORY_BUILDSYSTEM));
+}
+
+void SbsV2Parser::readRecipe()
+{
+ Q_ASSERT(m_log.isStartElement() && m_log.name() == QLatin1String("recipe"));
+ const QString name = m_log.attributes().value(QLatin1String("name")).toString();
+
+ if (name == QLatin1String("compile") ||
+ name == QLatin1String("qmake_extra_pre_targetdep")) {
+ m_currentSource = QDir(m_log.attributes().value("source").toString()).absolutePath();
+ m_currentTarget = QDir(m_log.attributes().value("target").toString()).absolutePath();
+ qDebug() << "SOURCE:" << m_currentSource.absolutePath();
+ qDebug() << "TARGET:" << m_currentTarget.absolutePath();
+
+ QStringList output = m_log.readElementText().split(QChar('\n'));
+ foreach (const QString &line, output) {
+ if (line.isEmpty() || line.startsWith(QChar('+')))
+ continue;
+ IOutputParser::stdError(line);
+ }
+ } else {
+ m_log.skipCurrentElement();
+ }
+}
+
+// Unit tests:
+
+#ifdef WITH_TESTS
+# include <QTest>
+
+# include "qt4projectmanagerplugin.h"
+
+# include "projectexplorer/outputparser_test.h"
+
+using namespace Qt4ProjectManager::Internal;
+
+void Qt4ProjectManagerPlugin::testSbsV2OutputParsers_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<OutputParserTester::Channel>("inputChannel");
+ QTest::addColumn<QString>("childStdOutLines");
+ QTest::addColumn<QString>("childStdErrLines");
+ QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
+ QTest::addColumn<QString>("outputLines");
+
+
+ QTest::newRow("eat stdout")
+ << QString::fromLatin1(" Sometext") << OutputParserTester::STDOUT
+ << QString() << QString()
+ << QList<ProjectExplorer::Task>()
+ << QString();
+ QTest::newRow("eat stderr")
+ << QString::fromLatin1(" Sometext") << OutputParserTester::STDERR
+ << QString() << QString()
+ << QList<ProjectExplorer::Task>()
+ << QString();
+
+ QTest::newRow("build log")
+ << QString::fromLatin1("sbs: build log in X:/epoc32/build/Makefile.2010-08-10-15-25-52.log") << OutputParserTester::STDOUT
+ << QString() << QString()
+ << (QList<ProjectExplorer::Task>()
+ << ProjectExplorer::Task(Task::Unknown, QLatin1String("SBSv2 build log"),
+ QLatin1String("X:/epoc32/build/Makefile.2010-08-10-15-25-52.log"), -1,
+ QLatin1String(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)))
+ << QString();
+}
+
+void Qt4ProjectManagerPlugin::testSbsV2OutputParsers()
+{
+ OutputParserTester testbench;
+ testbench.appendOutputParser(new SbsV2Parser);
+ QFETCH(QString, input);
+ QFETCH(OutputParserTester::Channel, inputChannel);
+ QFETCH(QList<Task>, tasks);
+ QFETCH(QString, childStdOutLines);
+ QFETCH(QString, childStdErrLines);
+ QFETCH(QString, outputLines);
+
+ testbench.testParsing(input, inputChannel,
+ tasks, childStdOutLines, childStdErrLines,
+ outputLines);
+}
+#endif
diff --git a/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.h b/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.h
new file mode 100644
index 0000000000..f6bf1e21fc
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qt-s60/sbsv2parser.h
@@ -0,0 +1,72 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** Commercial Usage
+**
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://qt.nokia.com/contact.
+**
+**************************************************************************/
+
+#ifndef SBSV2PARSER_H
+#define SBSV2PARSER_H
+
+#include <projectexplorer/ioutputparser.h>
+
+#include <QtCore/QDir>
+#include <QtXml/QXmlStreamReader>
+
+namespace ProjectExplorer {
+class TaskHub;
+}
+
+namespace Qt4ProjectManager {
+
+class SbsV2Parser : public ProjectExplorer::IOutputParser
+{
+ Q_OBJECT
+
+public:
+ SbsV2Parser();
+
+ virtual void stdOutput(const QString & line);
+ virtual void stdError(const QString & line);
+
+public slots:
+ virtual void taskAdded(const ProjectExplorer::Task &task);
+
+private:
+ void parseLogFile(const QString &file);
+ void readBuildLog();
+ void readError();
+ void readWarning();
+ void readRecipe();
+
+ QXmlStreamReader m_log;
+ QDir m_currentSource;
+ QDir m_currentTarget;
+ ProjectExplorer::TaskHub *m_hub;
+};
+
+} // namespace Qt4ProjectExplorer
+
+#endif // SBSV2PARSER_H
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
index 1015ea4989..8fc4b18e64 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
@@ -286,7 +286,6 @@ void Qt4ProjectManagerPlugin::buildStateChanged(ProjectExplorer::Project *pro)
#ifdef WITH_TESTS
void Qt4ProjectManagerPlugin::testBasicProjectLoading()
{
-
QString testDirectory = ExtensionSystem::PluginManager::instance()->testDataDirectory() + "/qt4projectmanager/";
QString test1 = testDirectory + "test1/test1.pro";
m_projectExplorer->openProject(test1);
diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
index 0a771d4db2..b5c41ecc71 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
+++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
@@ -76,12 +76,14 @@ private slots:
void buildStateChanged(ProjectExplorer::Project *pro);
#ifdef WITH_TESTS
- void testBasicProjectLoading();
+ void testBasicProjectLoading(); // Test fails!
void testAbldOutputParsers_data();
void testAbldOutputParsers();
void testQtOutputParser_data();
void testQtOutputParser();
+ void testSbsV2OutputParsers_data();
+ void testSbsV2OutputParsers();
#endif
private: