diff options
author | Moody Liu <mooodyhunter@outlook.com> | 2022-05-18 01:17:56 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-06-28 17:14:44 +0000 |
commit | ec4149a240e9737287114c1e656873c91062192f (patch) | |
tree | a79f323d69930825d8bf5a3c0c7a390f6d92468b /src | |
parent | 2b1be235e0c2288d1e074e71d068589a680d5245 (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
Change-Id: I8af76bd38cd55700e17794cf2fff0e50a90ac87e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 8a96c8a22ca2c81969bb5e06249c06143b7f8249)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-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 8cdaf162ae..14a0b795a7 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -1930,7 +1930,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) { @@ -2068,7 +2069,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; @@ -2160,10 +2163,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; |