Add --noinstantiate to qmlplugindump
This flag allows you to run qmlplugindump on plugins which cannot safely create objects, such as plugins with unusual requirements or missing essential dependencies. Change-Id: Ifcc542b8dec5358fc8a76d78a2a272c9cbf5d78a Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
parent
ba0899542c
commit
0462193b6f
|
@ -71,6 +71,7 @@
|
||||||
|
|
||||||
QString pluginImportPath;
|
QString pluginImportPath;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
bool creatable = true;
|
||||||
|
|
||||||
QString currentProperty;
|
QString currentProperty;
|
||||||
QString inObjectInstantiation;
|
QString inObjectInstantiation;
|
||||||
|
@ -225,46 +226,48 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, const
|
||||||
qmlTypesByCppName[baseCpp] = baseExports;
|
qmlTypesByCppName[baseCpp] = baseExports;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find even more QMetaObjects by instantiating QML types and running
|
if (creatable) {
|
||||||
// over the instances
|
// find even more QMetaObjects by instantiating QML types and running
|
||||||
foreach (QQmlType *ty, QQmlMetaType::qmlTypes()) {
|
// over the instances
|
||||||
if (skip.contains(ty))
|
foreach (QQmlType *ty, QQmlMetaType::qmlTypes()) {
|
||||||
continue;
|
if (skip.contains(ty))
|
||||||
if (ty->isExtendedType())
|
continue;
|
||||||
continue;
|
if (ty->isExtendedType())
|
||||||
if (!ty->isCreatable())
|
continue;
|
||||||
continue;
|
if (!ty->isCreatable())
|
||||||
if (ty->typeName() == "QQmlComponent")
|
continue;
|
||||||
continue;
|
if (ty->typeName() == "QQmlComponent")
|
||||||
|
continue;
|
||||||
|
|
||||||
QString tyName = ty->qmlTypeName();
|
QString tyName = ty->qmlTypeName();
|
||||||
tyName = tyName.mid(tyName.lastIndexOf(QLatin1Char('/')) + 1);
|
tyName = tyName.mid(tyName.lastIndexOf(QLatin1Char('/')) + 1);
|
||||||
if (tyName.isEmpty())
|
if (tyName.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
inObjectInstantiation = tyName;
|
inObjectInstantiation = tyName;
|
||||||
QObject *object = 0;
|
QObject *object = 0;
|
||||||
|
|
||||||
if (ty->isSingleton()) {
|
if (ty->isSingleton()) {
|
||||||
QQmlType::SingletonInstanceInfo *siinfo = ty->singletonInstanceInfo();
|
QQmlType::SingletonInstanceInfo *siinfo = ty->singletonInstanceInfo();
|
||||||
if (siinfo->qobjectCallback) {
|
if (siinfo->qobjectCallback) {
|
||||||
siinfo->init(engine);
|
siinfo->init(engine);
|
||||||
collectReachableMetaObjects(object, &metas);
|
collectReachableMetaObjects(object, &metas);
|
||||||
object = siinfo->qobjectApi(engine);
|
object = siinfo->qobjectApi(engine);
|
||||||
|
} else {
|
||||||
|
inObjectInstantiation.clear();
|
||||||
|
continue; // we don't handle QJSValue singleton types.
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
inObjectInstantiation.clear();
|
object = ty->create();
|
||||||
continue; // we don't handle QJSValue singleton types.
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
object = ty->create();
|
inObjectInstantiation.clear();
|
||||||
|
|
||||||
|
if (object)
|
||||||
|
collectReachableMetaObjects(object, &metas);
|
||||||
|
else
|
||||||
|
qWarning() << "Could not create" << tyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inObjectInstantiation.clear();
|
|
||||||
|
|
||||||
if (object)
|
|
||||||
collectReachableMetaObjects(object, &metas);
|
|
||||||
else
|
|
||||||
qWarning() << "Could not create" << tyName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return metas;
|
return metas;
|
||||||
|
@ -540,8 +543,8 @@ void sigSegvHandler(int) {
|
||||||
void printUsage(const QString &appName)
|
void printUsage(const QString &appName)
|
||||||
{
|
{
|
||||||
qWarning() << qPrintable(QString(
|
qWarning() << qPrintable(QString(
|
||||||
"Usage: %1 [-v] [-[non]relocatable] module.uri version [module/import/path]\n"
|
"Usage: %1 [-v] [-noinstantiate] [-[non]relocatable] module.uri version [module/import/path]\n"
|
||||||
" %1 [-v] -path path/to/qmldir/directory [version]\n"
|
" %1 [-v] [-noinstantiate] -path path/to/qmldir/directory [version]\n"
|
||||||
" %1 [-v] -builtins\n"
|
" %1 [-v] -builtins\n"
|
||||||
"Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg(
|
"Example: %1 Qt.labs.folderlistmodel 2.0 /home/user/dev/qt-install/imports").arg(
|
||||||
appName));
|
appName));
|
||||||
|
@ -598,6 +601,9 @@ int main(int argc, char *argv[])
|
||||||
} else if (arg == QLatin1String("--relocatable")
|
} else if (arg == QLatin1String("--relocatable")
|
||||||
|| arg == QLatin1String("-relocatable")) {
|
|| arg == QLatin1String("-relocatable")) {
|
||||||
relocatable = true;
|
relocatable = true;
|
||||||
|
} else if (arg == QLatin1String("--noinstantiate")
|
||||||
|
|| arg == QLatin1String("-noinstantiate")) {
|
||||||
|
creatable = false;
|
||||||
} else if (arg == QLatin1String("--path")
|
} else if (arg == QLatin1String("--path")
|
||||||
|| arg == QLatin1String("-path")) {
|
|| arg == QLatin1String("-path")) {
|
||||||
action = Path;
|
action = Path;
|
||||||
|
|
Loading…
Reference in New Issue