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>
This commit is contained in:
Alexey Edelev 2023-09-12 15:09:05 +02:00
parent 9fe47cf2e1
commit 630d3328dd

View File

@ -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'/');
}
}
QFileInfo info(options.qtInstallDirectory + "/"_L1 + fileName);
QFileInfo rootPath(options.qtInstallDirectory + "/"_L1);
return findFilesRecursively(options, info, rootPath.absolutePath() + 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()));
}
return deps;
}
bool readAndroidDependencyXml(Options *options,