Add the support of the qt_import_plugins functionality to androiddeployqt
qt_import_plugins allows to control application deployment on non-Android platforms. This adds support for the pre-defined plugin list that is computed using the qt_import_plugins input. Pick-to: 6.5 Task-number: QTBUG-118829 Change-Id: Iaa9c3f600533a4b5a3079ab228fabf212d9ce5a5 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 438837ce274fdc1457b66179b25df40f33b23a15) (cherry picked from commit 4dfaabce579c42443a8f9b4425b62c20fe275052) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
82fff69aaa
commit
6763644c3f
@ -253,7 +253,8 @@ function(qt_internal_android_dependencies target)
|
|||||||
# Module plugins
|
# Module plugins
|
||||||
if(module_plugin_types)
|
if(module_plugin_types)
|
||||||
foreach(plugin IN LISTS module_plugin_types)
|
foreach(plugin IN LISTS module_plugin_types)
|
||||||
string(APPEND file_contents "<bundled file=\"${INSTALL_PLUGINSDIR}/${plugin}\" />\n")
|
string(APPEND file_contents
|
||||||
|
"<bundled file=\"${INSTALL_PLUGINSDIR}/${plugin}\" type=\"plugin_dir\"/>\n")
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -236,6 +236,10 @@ function(qt6_android_generate_deployment_settings target)
|
|||||||
_qt_internal_add_android_deployment_property(file_contents "android-no-deploy-qt-libs"
|
_qt_internal_add_android_deployment_property(file_contents "android-no-deploy-qt-libs"
|
||||||
${target} "QT_ANDROID_NO_DEPLOY_QT_LIBS")
|
${target} "QT_ANDROID_NO_DEPLOY_QT_LIBS")
|
||||||
|
|
||||||
|
__qt_internal_collect_plugin_targets_from_dependencies("${target}" plugin_targets)
|
||||||
|
__qt_internal_collect_plugin_library_files("${target}" "${plugin_targets}" plugin_targets)
|
||||||
|
string(APPEND file_contents " \"android-deploy-plugins\":\"${plugin_targets}\",\n")
|
||||||
|
|
||||||
# App binary
|
# App binary
|
||||||
string(APPEND file_contents
|
string(APPEND file_contents
|
||||||
" \"application-binary\": \"${target_output_name}\",\n")
|
" \"application-binary\": \"${target_output_name}\",\n")
|
||||||
@ -303,7 +307,7 @@ function(qt6_android_generate_deployment_settings target)
|
|||||||
# content end
|
# content end
|
||||||
string(APPEND file_contents "}\n")
|
string(APPEND file_contents "}\n")
|
||||||
|
|
||||||
file(GENERATE OUTPUT ${deploy_file} CONTENT ${file_contents})
|
file(GENERATE OUTPUT ${deploy_file} CONTENT "${file_contents}")
|
||||||
|
|
||||||
set_target_properties(${target}
|
set_target_properties(${target}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
|
@ -144,6 +144,7 @@ struct Options
|
|||||||
QString qtQmlDirectory;
|
QString qtQmlDirectory;
|
||||||
QString qtHostDirectory;
|
QString qtHostDirectory;
|
||||||
std::vector<QString> extraPrefixDirs;
|
std::vector<QString> extraPrefixDirs;
|
||||||
|
QStringList androidDeployPlugins;
|
||||||
// Unlike 'extraPrefixDirs', the 'extraLibraryDirs' key doesn't expect the 'lib' subfolder
|
// Unlike 'extraPrefixDirs', the 'extraLibraryDirs' key doesn't expect the 'lib' subfolder
|
||||||
// when looking for dependencies.
|
// when looking for dependencies.
|
||||||
std::vector<QString> extraLibraryDirs;
|
std::vector<QString> extraLibraryDirs;
|
||||||
@ -1010,6 +1011,11 @@ bool readInputFile(Options *options)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto androidDeployPlugins = jsonObject.value("android-deploy-plugins"_L1).toString();
|
||||||
|
options->androidDeployPlugins = androidDeployPlugins.split(";"_L1, Qt::SkipEmptyParts);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto extraLibraryDirs = jsonObject.value("extraLibraryDirs"_L1).toArray();
|
const auto extraLibraryDirs = jsonObject.value("extraLibraryDirs"_L1).toArray();
|
||||||
options->extraLibraryDirs.reserve(extraLibraryDirs.size());
|
options->extraLibraryDirs.reserve(extraLibraryDirs.size());
|
||||||
@ -1881,6 +1887,32 @@ QList<QtDependency> findFilesRecursively(const Options &options, const QString &
|
|||||||
return deps;
|
return deps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void readDependenciesFromFiles(Options *options, const QList<QtDependency> &files,
|
||||||
|
QSet<QString> &usedDependencies,
|
||||||
|
QSet<QString> &remainingDependencies)
|
||||||
|
{
|
||||||
|
for (const QtDependency &fileName : files) {
|
||||||
|
if (usedDependencies.contains(fileName.absolutePath))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (fileName.absolutePath.endsWith(".so"_L1)) {
|
||||||
|
if (!readDependenciesFromElf(options, fileName.absolutePath, &usedDependencies,
|
||||||
|
&remainingDependencies)) {
|
||||||
|
fprintf(stdout, "Skipping file dependency: %s\n",
|
||||||
|
qPrintable(fileName.relativePath));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usedDependencies.insert(fileName.absolutePath);
|
||||||
|
|
||||||
|
if (options->verbose) {
|
||||||
|
fprintf(stdout, "Appending file dependency: %s\n", qPrintable(fileName.relativePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
options->qtDependencies[options->currentArchitecture].append(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool readAndroidDependencyXml(Options *options,
|
bool readAndroidDependencyXml(Options *options,
|
||||||
const QString &moduleName,
|
const QString &moduleName,
|
||||||
QSet<QString> *usedDependencies,
|
QSet<QString> *usedDependencies,
|
||||||
@ -1911,29 +1943,15 @@ bool readAndroidDependencyXml(Options *options,
|
|||||||
|
|
||||||
QString file = reader.attributes().value("file"_L1).toString();
|
QString file = reader.attributes().value("file"_L1).toString();
|
||||||
|
|
||||||
const QList<QtDependency> fileNames = findFilesRecursively(*options, file);
|
if (reader.attributes().hasAttribute("type"_L1)
|
||||||
|
&& reader.attributes().value("type"_L1) == "plugin_dir"_L1
|
||||||
for (const QtDependency &fileName : fileNames) {
|
&& !options->androidDeployPlugins.isEmpty()) {
|
||||||
if (usedDependencies->contains(fileName.absolutePath))
|
continue;
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fileName.absolutePath.endsWith(".so"_L1)) {
|
|
||||||
QSet<QString> remainingDependencies;
|
|
||||||
if (!readDependenciesFromElf(options, fileName.absolutePath,
|
|
||||||
usedDependencies,
|
|
||||||
&remainingDependencies)) {
|
|
||||||
fprintf(stdout, "Skipping dependencies from xml: %s\n",
|
|
||||||
qPrintable(fileName.relativePath));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
usedDependencies->insert(fileName.absolutePath);
|
|
||||||
|
|
||||||
if (options->verbose)
|
|
||||||
fprintf(stdout, "Appending dependency from xml: %s\n", qPrintable(fileName.relativePath));
|
|
||||||
|
|
||||||
options->qtDependencies[options->currentArchitecture].append(fileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QList<QtDependency> fileNames = findFilesRecursively(*options, file);
|
||||||
|
readDependenciesFromFiles(options, fileNames, *usedDependencies,
|
||||||
|
*remainingDependencies);
|
||||||
} else if (reader.name() == "jar"_L1) {
|
} else if (reader.name() == "jar"_L1) {
|
||||||
int bundling = reader.attributes().value("bundling"_L1).toInt();
|
int bundling = reader.attributes().value("bundling"_L1).toInt();
|
||||||
QString fileName = QDir::cleanPath(reader.attributes().value("file"_L1).toString());
|
QString fileName = QDir::cleanPath(reader.attributes().value("file"_L1).toString());
|
||||||
@ -2410,6 +2428,14 @@ bool readDependencies(Options *options)
|
|||||||
if (!readDependenciesFromElf(options, "%1/libs/%2/lib%3_%2.so"_L1.arg(options->outputDirectory, options->currentArchitecture, options->applicationBinary), &usedDependencies, &remainingDependencies))
|
if (!readDependenciesFromElf(options, "%1/libs/%2/lib%3_%2.so"_L1.arg(options->outputDirectory, options->currentArchitecture, options->applicationBinary), &usedDependencies, &remainingDependencies))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
QList<QtDependency> pluginDeps;
|
||||||
|
for (const auto &pluginPath : options->androidDeployPlugins) {
|
||||||
|
pluginDeps.append(findFilesRecursively(*options, QFileInfo(pluginPath),
|
||||||
|
options->qtInstallDirectory + "/"_L1));
|
||||||
|
}
|
||||||
|
|
||||||
|
readDependenciesFromFiles(options, pluginDeps, usedDependencies, remainingDependencies);
|
||||||
|
|
||||||
while (!remainingDependencies.isEmpty()) {
|
while (!remainingDependencies.isEmpty()) {
|
||||||
QSet<QString>::iterator start = remainingDependencies.begin();
|
QSet<QString>::iterator start = remainingDependencies.begin();
|
||||||
QString fileName = absoluteFilePath(options, *start);
|
QString fileName = absoluteFilePath(options, *start);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user