Skip to content

Commit

Permalink
Merge branch 'jb46800' into 'mer-5.6'
Browse files Browse the repository at this point in the history
[qtdeclarative] Dump types reachable through internal dependencies. Contributes to JB#46800

See merge request mer-core/qtdeclarative!29
  • Loading branch information
pvuorela committed Feb 7, 2020
2 parents 7bd6917 + 57292c9 commit eb5d511
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tools/qmlplugindump/main.cpp
Expand Up @@ -1197,6 +1197,14 @@ int main(int argc, char *argv[])
importCode += QString("\nimport \".\" %2\n").arg(pluginImportVersion).toLatin1();
}

// collect QMetaObjects that are reachable through dependencies but only become registered
// after the specified modules is imported
QSet<const QMetaObject *> defaultReachableNotExported;
foreach (const QMetaObject *mo, defaultReachable) {
if (!QQmlMetaType::qmlType(mo))
defaultReachableNotExported.insert(mo);
}

// create a component with these imports to make sure the imports are valid
// and to populate the declarative meta type system
{
Expand All @@ -1213,6 +1221,24 @@ int main(int argc, char *argv[])
}
}

// only keep those that really became registered (exported)
for (auto i = defaultReachableNotExported.begin(); i != defaultReachableNotExported.end(); ) {
QQmlType *ty = QQmlMetaType::qmlType(*i);
if (!ty || ty->module().isEmpty())
i = defaultReachableNotExported.erase(i);
else
++i;
}

if (verbose && !defaultReachableNotExported.isEmpty()) {
std::cerr << "Objects reachable through dependencies, but only exported by "
<< qPrintable( pluginImportUri ) << ":" << std::endl;
foreach (const QMetaObject *mo, defaultReachableNotExported)
std::cerr << " " << qPrintable( mo->className() ) << std::endl;
}

defaultReachable.subtract(defaultReachableNotExported);

QSet<const QMetaObject *> candidates = collectReachableMetaObjects(&engine, uncreatableMetas, singletonMetas, defaultTypes);
candidates.subtract(defaultReachable);

Expand Down

0 comments on commit eb5d511

Please sign in to comment.