Android: Don't reparse same paths in QML to Java codegen

appImports can have the same directory added multiple times - first if
it's found in the xxx_conf.rsp file and secondly for the inner qmldir
scanner. This is because the xxx_conf.rsp file can have both the
qmlModule directory and the parent of that directory as importPaths. For
example like this (the paths are truncated to save characters):

-importPath
.../build/qt_generated/qtquickview/qmlModule
-importPath
.../build/qt_generated/qtquickview

In this case when the "inner qmldir" finder processes the later path,
it would go to ./qmlModule, find the qmldir and add another
.../build/qt_generated/qtquickview/qmlModule to appImports. Also, if
there were other qmldir files somewhere under qmlModule those would
also get added twice, which would increase generation time yet again.

This commits solves the issue by removing duplicates from appImports.

Amends 7ed88eb565d40b195aa868e67777872ef07a5ea2.

Pick-to: 6.8
Fixes: QTBUG-137316
Change-Id: I641065479aec0f3d9ae1a8727a03bf62eb169ad6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3bf9047a342ed2699339c29f84f4d60e39353102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 44913432ce1193ec5b08f6882939a377b38cc73a)
This commit is contained in:
Olli Vuolteenaho 2025-06-02 14:06:46 +03:00 committed by Qt Cherry-pick Bot
parent 501434a464
commit e92a7fc932

View File

@ -3572,6 +3572,7 @@ int generateJavaQmlComponents(const Options &options)
}
}
appImports << qmldirDirectories.values();
appImports.removeDuplicates();
return appImports.count() + externalImports.count();
};