diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2021-12-08 19:26:29 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2021-12-21 13:17:37 +0100 |
commit | bde2764ab0a1bfdd253426ab466583e229be93f9 (patch) | |
tree | 69f89f355c5ec9d11e8ef9e4b2e71beb656a14d4 /src/tools/androiddeployqt/main.cpp | |
parent | 153ded9b957cd9f906ca8d6c2d6d88bc85407246 (diff) | |
download | qtbase-bde2764ab0a1bfdd253426ab466583e229be93f9.tar.gz |
Check if QML plugin has the embedded QML files before copying to the Android bundle
We can detect if QML module has the embedded into the plugin QML files
using the 'prefer' record from qmldir files. No need to duplicate QML
files inside the android_rcc_bundle if 'prefer' record starts
with ':/'.
Pick-to: 6.3
Fixes: QTBUG-95984
Change-Id: Iee4f2248e3c0239c4f95a5db6e8fb3f16be636c5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/tools/androiddeployqt/main.cpp')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index d80fdc4398..4c79463ebf 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -2131,24 +2131,30 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) collectQmlDependency(qmldirFileInfo.absoluteFilePath()); } - QVariantList qmlFiles = - object.value(QLatin1String("components")).toArray().toVariantList(); - qmlFiles.append(object.value(QLatin1String("scripts")).toArray().toVariantList()); - bool qmlFilesMissing = false; - for (const auto &qmlFileEntry : qmlFiles) { - QFileInfo fileInfo(qmlFileEntry.toString()); - if (!fileInfo.exists()) { - qmlFilesMissing = true; - break; + QString prefer = object.value(QLatin1String("prefer")).toString(); + // If the preferred location of Qml files points to the Qt resources, this means + // that all Qml files has been embedded into plugin and we should not copy them to the + // android rcc bundle + if (!prefer.startsWith(QLatin1String(":/"))) { + QVariantList qmlFiles = + object.value(QLatin1String("components")).toArray().toVariantList(); + qmlFiles.append(object.value(QLatin1String("scripts")).toArray().toVariantList()); + bool qmlFilesMissing = false; + for (const auto &qmlFileEntry : qmlFiles) { + QFileInfo fileInfo(qmlFileEntry.toString()); + if (!fileInfo.exists()) { + qmlFilesMissing = true; + break; + } + collectQmlDependency(fileInfo.absoluteFilePath()); } - collectQmlDependency(fileInfo.absoluteFilePath()); - } - if (qmlFilesMissing) { - if (options->verbose) - fprintf(stdout, - " -- Skipping because the required qml files are missing.\n"); - continue; + if (qmlFilesMissing) { + if (options->verbose) + fprintf(stdout, + " -- Skipping because the required qml files are missing.\n"); + continue; + } } options->qtDependencies[options->currentArchitecture].append(qmlImportsDependencies); |