summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2023-09-12 15:09:05 +0200
committerAlexey Edelev <alexey.edelev@qt.io>2023-09-15 12:48:57 +0200
commit630d3328ddc35a02c42fa6501636eaee6eb76a37 (patch)
treea0990f3060a44c2e8f8f344399962ccd7f73156c /src/tools
parent9fe47cf2e11d7c9ad4f72e6fc5e53f10a9743b03 (diff)
Iterate over all extraPrefixDirs when collecting "directories"
When collecting plugins required for the android application according to linked targets we should take into account all prefix directories. But not only the first one. Otherwise the order we use when adding paths to extraPrefixDirs will affect collecting of the plugins. This specifically leads to the issue if the user project builds custom Qt plugins. The plugin directory from user project build tree will be found first and all plugins from Qt installation directory are discarded. Pick-to: 6.6 6.5 Fixes: QTBUG-116920 Change-Id: Id94ebaf5ccd1a279a74b38b59ff535f45230e1b4 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/androiddeployqt/main.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index cba1dc61fe..134f8b2db5 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -1849,14 +1849,31 @@ QList<QtDependency> findFilesRecursively(const Options &options, const QFileInfo
QList<QtDependency> findFilesRecursively(const Options &options, const QString &fileName)
{
+ // We try to find the fileName in extraPrefixDirs first. The function behaves differently
+ // depending on what the fileName points to. If fileName is a file then we try to find the
+ // first occurrence in extraPrefixDirs and return this file. If fileName is directory function
+ // iterates over it and looks for deployment artifacts in each 'extraPrefixDirs' entry.
+ // Also we assume that if the fileName is recognized as a directory once it will be directory
+ // for every 'extraPrefixDirs' entry.
+ QList<QtDependency> deps;
for (const auto &prefix : options.extraPrefixDirs) {
QFileInfo info(prefix + u'/' + fileName);
- if (info.exists())
- return findFilesRecursively(options, info, prefix + u'/');
+ if (info.exists()) {
+ if (info.isDir())
+ deps.append(findFilesRecursively(options, info, prefix + u'/'));
+ else
+ return findFilesRecursively(options, info, prefix + u'/');
+ }
+ }
+
+ // Usually android deployment settings contain Qt install directory in extraPrefixDirs.
+ if (std::find(options.extraPrefixDirs.begin(), options.extraPrefixDirs.end(),
+ options.qtInstallDirectory) == options.extraPrefixDirs.end()) {
+ QFileInfo info(options.qtInstallDirectory + "/"_L1 + fileName);
+ QFileInfo rootPath(options.qtInstallDirectory + "/"_L1);
+ deps.append(findFilesRecursively(options, info, rootPath.absolutePath()));
}
- QFileInfo info(options.qtInstallDirectory + "/"_L1 + fileName);
- QFileInfo rootPath(options.qtInstallDirectory + "/"_L1);
- return findFilesRecursively(options, info, rootPath.absolutePath() + u'/');
+ return deps;
}
bool readAndroidDependencyXml(Options *options,