diff options
author | Moody Liu <mooodyhunter@outlook.com> | 2022-05-18 01:17:56 +0100 |
---|---|---|
committer | Moody Liu <mooodyhunter@outlook.com> | 2022-06-28 17:06:33 +0100 |
commit | 8a96c8a22ca2c81969bb5e06249c06143b7f8249 (patch) | |
tree | f23603b5b9143cf8e7a2440b179773c885231d2f /src/tools/androiddeployqt | |
parent | aefb5c5a56dd6882179130b98fc44ac0fb366b03 (diff) |
fix androiddeployqt with user application with in-tree QML modules
when deploying user applications with QML modules located under user's
subdirectories, (e.g. some third-party QML components used as git
submomdule). The qmldir for such QML modules will be, typically,
generated under BUILD_DIR/android-qml.
if a BUILD_DIR is under the source directory, androiddeployqt will skip
those QML modules incorrectly because they "appeared to be under the
QML root path so that seems can be imported", however without deploying
them, it's impossible to import those modules on an Android device.
this patch adds a check that also tests if a root path plus the module's
url can actually lead to the correct module path, so a QML module under
android-qml subdir would not pass the test, and thus won't be skipped.
Task-number: QTBUG-103593
Pick-to: 6.4 6.3
Change-Id: I8af76bd38cd55700e17794cf2fff0e50a90ac87e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'src/tools/androiddeployqt')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index f42bd86fae..3db00ad01f 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1927,7 +1927,8 @@ bool readDependenciesFromElf(Options *options, } bool goodToCopy(const Options *options, const QString &file, QStringList *unmetDependencies); -bool checkQmlFileInRootPaths(const Options *options, const QString &absolutePath); +bool checkCanImportFromRootPaths(const Options *options, const QString &absolutePath, + const QUrl &moduleUrl); bool scanImports(Options *options, QSet<QString> *usedDependencies) { @@ -2065,7 +2066,9 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) if (!absolutePath.endsWith(u'/')) absolutePath += u'/'; - if (checkQmlFileInRootPaths(options, absolutePath)) { + const QUrl url(object.value("name"_L1).toString()); + + if (checkCanImportFromRootPaths(options, info.absolutePath(), url)) { if (options->verbose) fprintf(stdout, " -- Skipping because path is in QML root path.\n"); continue; @@ -2157,10 +2160,12 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies) return true; } -bool checkQmlFileInRootPaths(const Options *options, const QString &absolutePath) +bool checkCanImportFromRootPaths(const Options *options, const QString &absolutePath, + const QUrl &moduleUrl) { + const QString pathFromUrl = u"/"_s + moduleUrl.toString().replace(u'.', u'/'); for (auto rootPath : options->rootPaths) { - if (absolutePath.startsWith(rootPath)) + if ((rootPath + pathFromUrl) == absolutePath) return true; } return false; |