Commit 3a110439 authored by Christian Kamm's avatar Christian Kamm Committed by Leandro T. C. Melo

QmlJS: Only try qmldump on Desktop and Simulator Qt.

In particular, don't complain about a missing qmldump binary on other
platforms.

Change-Id: Ie2e96bcb67e609aa5aed31510b06139d2d9ce77e
Reviewed-on: http://codereview.qt-project.org/5327Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarLeandro T. C. Melo <leandro.melo@nokia.com>
parent b9772e5c
......@@ -61,6 +61,7 @@ public:
{
public:
ProjectInfo()
: tryQmlDump(false)
{ }
ProjectInfo(QPointer<ProjectExplorer::Project> project)
......@@ -80,8 +81,12 @@ public:
QPointer<ProjectExplorer::Project> project;
QStringList sourceFiles;
QStringList importPaths;
// whether trying to run qmldump makes sense
bool tryQmlDump;
QString qmlDumpPath;
Utils::Environment qmlDumpEnvironment;
QString qtImportsPath;
QString qtVersionString;
};
......
......@@ -220,31 +220,34 @@ void PluginDumper::dumpAllPlugins()
}
}
static QString qmldumpErrorPreamble()
static QString noTypeinfoError(const QString &libraryPath)
{
return PluginDumper::tr("QML module does not contain information about components contained in plugins.\n"
"See \"Using QML Modules with Plugins\" in the documentation.") + QLatin1String("\n\n");
return PluginDumper::tr("QML module at:\n"
"%1\n"
"does not contain information about components contained in plugins.\n"
"See \"Using QML Modules with Plugins\" in the documentation.").arg(
libraryPath);
}
static QString qmldumpErrorMessage(const QString &libraryPath, const QString &error)
{
return qmldumpErrorPreamble() +
PluginDumper::tr("Automatic type dump of QML module in %1 failed.\nErrors:\n%2\n").
arg(libraryPath, error);
return noTypeinfoError(libraryPath) + QLatin1String("\n\n") +
PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1\n").
arg(error);
}
static QString qmldumpFailedMessage(const QString &libraryPath, const QString &error)
{
QString firstLines =
QStringList(error.split(QLatin1Char('\n')).mid(0, 10)).join(QLatin1String("\n"));
return qmldumpErrorPreamble() +
PluginDumper::tr("Automatic type dump of QML module in %1 failed.\n"
return noTypeinfoError(libraryPath) + QLatin1String("\n\n") +
PluginDumper::tr("Automatic type dump of QML module failed.\n"
"First 10 lines or errors:\n"
"\n"
"%2"
"%1"
"\n"
"Check 'General Messages' output pane for details."
).arg(libraryPath, firstLines);
).arg(firstLines);
}
static void printParseWarnings(const QString &libraryPath, const QString &warning)
......@@ -400,16 +403,22 @@ void PluginDumper::dump(const Plugin &plugin)
ModelManagerInterface::ProjectInfo info = m_modelManager->projectInfo(activeProject);
if (info.qmlDumpPath.isEmpty()) {
if (!info.tryQmlDump || info.qmlDumpPath.isEmpty()) {
const Snapshot snapshot = m_modelManager->snapshot();
LibraryInfo libraryInfo = snapshot.libraryInfo(plugin.qmldirPath);
if (!libraryInfo.isValid())
return;
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError,
qmldumpErrorMessage(plugin.qmldirPath,
QString errorMessage;
if (!info.tryQmlDump) {
errorMessage = noTypeinfoError(plugin.qmldirPath);
} else {
errorMessage = qmldumpErrorMessage(plugin.qmldirPath,
tr("Could not locate the helper application for dumping type information from C++ plugins.\n"
"Please build the qmldump applcation on the Qt version options page.")));
"Please build the qmldump applcation on the Qt version options page."));
}
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, errorMessage);
m_modelManager->updateLibraryInfo(plugin.qmldirPath, libraryInfo);
return;
}
......
......@@ -63,6 +63,7 @@
#include <qtsupport/qmldumptool.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/profilereader.h>
#include <qtsupport/qtsupportconstants.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
......@@ -615,23 +616,34 @@ void Qt4Project::updateQmlJSCodeModel()
foreach (Qt4ProFileNode *node, proFiles) {
projectInfo.importPaths.append(node->variableValue(QmlImportPathVar));
}
bool preferDebugDump = false;
projectInfo.tryQmlDump = false;
if (activeTarget() && activeTarget()->activeBuildConfiguration()) {
preferDebugDump = activeTarget()->activeQt4BuildConfiguration()->qmakeBuildConfiguration() & QtSupport::BaseQtVersion::DebugBuild;
QtSupport::BaseQtVersion *qtVersion = activeTarget()->activeQt4BuildConfiguration()->qtVersion();
if (qtVersion && qtVersion->isValid()) {
projectInfo.tryQmlDump = qtVersion->type() == QtSupport::Constants::DESKTOPQT
|| qtVersion->type() == QtSupport::Constants::SIMULATORQT;
projectInfo.qtImportsPath = qtVersion->versionInfo().value("QT_INSTALL_IMPORTS");
if (!projectInfo.qtImportsPath.isEmpty())
projectInfo.importPaths += projectInfo.qtImportsPath;
projectInfo.qtVersionString = qtVersion->qtVersionString();
}
}
const Qt4BuildConfiguration *bc = activeTarget()->activeQt4BuildConfiguration();
QtSupport::QmlDumpTool::pathAndEnvironment(this, bc->qtVersion(), bc->toolChain(),
preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
projectInfo.importPaths.removeDuplicates();
if (projectInfo.tryQmlDump) {
const Qt4BuildConfiguration *bc = activeTarget()->activeQt4BuildConfiguration();
if (bc) {
QtSupport::QmlDumpTool::pathAndEnvironment(this, bc->qtVersion(), bc->toolChain(),
preferDebugDump, &projectInfo.qmlDumpPath, &projectInfo.qmlDumpEnvironment);
}
} else {
projectInfo.qmlDumpPath.clear();
projectInfo.qmlDumpEnvironment.clear();
}
modelManager->updateProjectInfo(projectInfo);
}
......
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