AndroidDeployQt: Remove not satisfied dependencies

In 438837ce274fdc1457b66179b25df40f33b23a15 commit, we stopped to copy
all dependent libs that are kept in plugin directory. This change sounds
reasonable, as we do not want to deploy unused libs.

Due to the mentioned change, when dependencies.xml contains *.so
libraries, they are not copied at all now. They are added to localLibs
(later pasted into libs.xml), but are not shipped with the apk.
So at the end we have dependencies in libs.xml on some libraries that
were not delievered.

This commit cleans up the localLibs to not add dependencies to the
libs.xml file as they will not be satisfied

Fixes: QTBUG-129946
Change-Id: I7157e2e65cb928adbe9d7c077e50b2ebcac94490
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7499fd0229d63f969bf6ca58d3b764b96395bed2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Bartlomiej Moskal 2024-10-29 09:25:20 +01:00 committed by Qt Cherry-pick Bot
parent 683d839f14
commit e2e20c19f6

View File

@ -1755,10 +1755,21 @@ bool updateLibsXml(Options *options)
QStringList localLibs;
localLibs = options->localLibs[it.key()];
const QList<QtDependency>& deps = options->qtDependencies[it.key()];
auto notExistsInDependencies = [&deps] (const QString &lib) {
return std::none_of(deps.begin(), deps.end(), [&lib] (const QtDependency &dep) {
return QFileInfo(dep.absolutePath).fileName() == QFileInfo(lib).fileName();
});
};
// Clean up localLibs: remove libs that were not added to qtDependecies
localLibs.erase(std::remove_if(localLibs.begin(), localLibs.end(), notExistsInDependencies),
localLibs.end());
// If .pro file overrides dependency detection, we need to see which platform plugin they picked
if (localLibs.isEmpty()) {
QString plugin;
for (const QtDependency &qtDependency : options->qtDependencies[it.key()]) {
for (const QtDependency &qtDependency : deps) {
if (qtDependency.relativePath.contains("libplugins_platforms_qtforandroid_"_L1))
plugin = qtDependency.relativePath;