aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlplugindump/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qmlplugindump/main.cpp')
-rw-r--r--tools/qmlplugindump/main.cpp71
1 files changed, 41 insertions, 30 deletions
diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp
index 393abc8883..d821c25b4e 100644
--- a/tools/qmlplugindump/main.cpp
+++ b/tools/qmlplugindump/main.cpp
@@ -1,31 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
-** 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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -80,6 +75,12 @@
static const uint qtQmlMajorVersion = 2;
static const uint qtQmlMinorVersion = 2;
+static const uint qtQuickMajorVersion = 2;
+static const uint qtQuickMinorVersion = 7;
+
+const QString qtQuickQualifiedName = QString::fromLatin1("QtQuick %1.%2")
+ .arg(qtQuickMajorVersion)
+ .arg(qtQuickMinorVersion);
QString pluginImportPath;
bool verbose = false;
@@ -243,10 +244,10 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
// For each export of a base object there can be a single extension object overriding it.
// Example: QDeclarativeGraphicsWidget overrides the QtQuick/QGraphicsWidget export
// of QGraphicsWidget.
- foreach (const QByteArray &baseCpp, extensions.keys()) {
- QSet<const QQmlType *> baseExports = qmlTypesByCppName.value(baseCpp);
+ for (auto it = extensions.cbegin(), end = extensions.cend(); it != end; ++it) {
+ QSet<const QQmlType *> baseExports = qmlTypesByCppName.value(it.key());
- const QSet<QByteArray> extensionCppNames = extensions.value(baseCpp);
+ const QSet<QByteArray> extensionCppNames = it.value();
foreach (const QByteArray &extensionCppName, extensionCppNames) {
const QSet<const QQmlType *> extensionExports = qmlTypesByCppName.value(extensionCppName);
@@ -268,7 +269,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine,
}
baseExports = newBaseExports;
}
- qmlTypesByCppName[baseCpp] = baseExports;
+ qmlTypesByCppName[it.key()] = baseExports;
}
if (creatable) {
@@ -735,7 +736,7 @@ void sigSegvHandler(int) {
void printUsage(const QString &appName)
{
std::cerr << qPrintable(QString(
- "Usage: %1 [-v] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] module.uri version [module/import/path]\n"
+ "Usage: %1 [-v] [-noinstantiate] [-defaultplatform] [-[non]relocatable] [-dependencies <dependencies.json>] [-merge <file-to-merge.qmltypes>] [-noforceqtquick] module.uri version [module/import/path]\n"
" %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n"
" %1 [-v] -builtins\n"
"Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg(
@@ -743,7 +744,8 @@ void printUsage(const QString &appName)
}
static bool readDependenciesData(QString dependenciesFile, const QByteArray &fileData,
- QStringList *dependencies, const QStringList &urisToSkip) {
+ QStringList *dependencies, const QStringList &urisToSkip,
+ bool forceQtQuickDependency = true) {
if (verbose) {
std::cerr << "parsing "
<< qPrintable( dependenciesFile ) << " skipping";
@@ -776,7 +778,7 @@ static bool readDependenciesData(QString dependenciesFile, const QByteArray &fil
QString version = obj.value(QStringLiteral("version")).toString();
if (name.isEmpty() || urisToSkip.contains(name) || version.isEmpty())
continue;
- if (name.endsWith(QLatin1String("Private"))) {
+ if (name.endsWith(QLatin1String("Private"), Qt::CaseInsensitive)) {
if (verbose)
std::cerr << "skipping private dependecy "
<< qPrintable( name ) << " " << qPrintable(version) << std::endl;
@@ -798,8 +800,8 @@ static bool readDependenciesData(QString dependenciesFile, const QByteArray &fil
// qmlplugindump used to import QtQuick, so all types defined in QtQuick used to be skipped when dumping.
// Now that it imports only Qt, it is no longer the case: if no dependency is found all the types defined
// in QtQuick will be dumped, causing conflicts.
- if (dependencies->isEmpty())
- dependencies->push_back(QLatin1String("QtQuick 2.0"));
+ if (forceQtQuickDependency && dependencies->isEmpty())
+ dependencies->push_back(qtQuickQualifiedName);
return true;
}
@@ -817,11 +819,12 @@ static bool readDependenciesFile(const QString &dependenciesFile, QStringList *d
return false;
}
QByteArray fileData = f.readAll();
- return readDependenciesData(dependenciesFile, fileData, dependencies, urisToSkip);
+ return readDependenciesData(dependenciesFile, fileData, dependencies, urisToSkip, false);
}
static bool getDependencies(const QQmlEngine &engine, const QString &pluginImportUri,
- const QString &pluginImportVersion, QStringList *dependencies)
+ const QString &pluginImportVersion, QStringList *dependencies,
+ bool forceQtQuickDependency)
{
QFileInfo selfExe(QCoreApplication::applicationFilePath());
QString command = selfExe.absoluteDir().filePath(QLatin1String("qmlimportscanner")
@@ -854,7 +857,7 @@ static bool getDependencies(const QQmlEngine &engine, const QString &pluginImpor
}
QByteArray depencenciesData = importScanner.readAllStandardOutput();
if (!readDependenciesData(QLatin1String("<outputOfQmlimportscanner>"), depencenciesData,
- dependencies, QStringList(pluginImportUri))) {
+ dependencies, QStringList(pluginImportUri), forceQtQuickDependency)) {
std::cerr << "failed to proecess output of qmlimportscanner" << std::endl;
return false;
}
@@ -977,6 +980,7 @@ int main(int argc, char *argv[])
if (!requireWindowManager)
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("minimal"));
+ QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QGuiApplication app(argc, argv);
const QStringList args = app.arguments();
const QString appName = QFileInfo(app.applicationFilePath()).baseName();
@@ -990,6 +994,7 @@ int main(int argc, char *argv[])
bool relocatable = true;
QString dependenciesFile;
QString mergeFile;
+ bool forceQtQuickDependency = true;
enum Action { Uri, Path, Builtins };
Action action = Uri;
{
@@ -1034,6 +1039,9 @@ int main(int argc, char *argv[])
action = Builtins;
} else if (arg == QLatin1String("-v")) {
verbose = true;
+ } else if (arg == QLatin1String("--noforceqtquick")
+ || arg == QLatin1String("-noforceqtquick")){
+ forceQtQuickDependency = false;
} else if (arg == QLatin1String("--defaultplatform")
|| arg == QLatin1String("-defaultplatform")) {
continue;
@@ -1102,9 +1110,12 @@ int main(int argc, char *argv[])
calculateDependencies = !readDependenciesFile(dependenciesFile, &dependencies,
QStringList(pluginImportUri)) && calculateDependencies;
if (calculateDependencies)
- getDependencies(engine, pluginImportUri, pluginImportVersion, &dependencies);
+ getDependencies(engine, pluginImportUri, pluginImportVersion, &dependencies,
+ forceQtQuickDependency);
+
compactDependencies(&dependencies);
+
QString qtQmlImportString = QString::fromLatin1("import QtQml %1.%2")
.arg(qtQmlMajorVersion)
.arg(qtQmlMinorVersion);