Add the json option to disable the zstd based compression
Need to disable zstd compression if its support is not built in Qt for Android. The flag is dected when configuring user's project and is a part of the deployment settings. This partially fixes loading of android_rcc_bundle.rcc. Pick-to: 6.2 Task-number: QTBUG-93340 Task-number: QTBUG-95969 Change-Id: I635afb3f9e182a559d53e9344e07f62788f9837d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
86d338383e
commit
f037357232
@ -234,6 +234,14 @@ function(qt6_android_generate_deployment_settings target)
|
||||
string(APPEND file_contents
|
||||
" \"extraPrefixDirs\" : [ ${extra_prefix_list} ],\n")
|
||||
|
||||
if(QT_FEATURE_zstd)
|
||||
set(is_zstd_enabled "true")
|
||||
else()
|
||||
set(is_zstd_enabled "false")
|
||||
endif()
|
||||
string(APPEND file_contents
|
||||
" \"zstdCompression\": ${is_zstd_enabled},\n")
|
||||
|
||||
# Last item in json file
|
||||
|
||||
# base location of stdlibc++, will be suffixed by androiddeploy qt
|
||||
|
@ -195,6 +195,7 @@ struct Options
|
||||
QString toolchainPrefix;
|
||||
QString ndkHost;
|
||||
bool buildAAB = false;
|
||||
bool isZstdCompressionEnabled = false;
|
||||
|
||||
|
||||
// Package information
|
||||
@ -1108,6 +1109,12 @@ bool readInputFile(Options *options)
|
||||
const QJsonValue qrcFiles = jsonObject.value(QLatin1String("qrcFiles"));
|
||||
options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), Qt::SkipEmptyParts);
|
||||
}
|
||||
{
|
||||
const QJsonValue zstdCompressionFlag = jsonObject.value(QLatin1String("zstdCompression"));
|
||||
if (zstdCompressionFlag.isBool()) {
|
||||
options->isZstdCompressionEnabled = zstdCompressionFlag.toBool();
|
||||
}
|
||||
}
|
||||
options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QLatin1String("/AndroidManifest.xml"));
|
||||
if (options->packageName.isEmpty())
|
||||
options->packageName = cleanPackageName(QLatin1String("org.qtproject.example.%1").arg(options->applicationBinary));
|
||||
@ -2086,9 +2093,14 @@ bool createRcc(const Options &options)
|
||||
if (!res)
|
||||
return false;
|
||||
|
||||
QLatin1String noZstd;
|
||||
if (!options.isZstdCompressionEnabled)
|
||||
noZstd = QLatin1String("--no-zstd");
|
||||
|
||||
QFile::rename(QLatin1String("%1/android_rcc_bundle.qrc").arg(assetsDir), QLatin1String("%1/android_rcc_bundle/android_rcc_bundle.qrc").arg(assetsDir));
|
||||
|
||||
res = runCommand(options, QLatin1String("%1 %2 --binary -o %3 android_rcc_bundle.qrc").arg(rcc, shellQuote(QLatin1String("--root=/android_rcc_bundle/")),
|
||||
res = runCommand(options, QLatin1String("%1 %2 %3 --binary -o %4 android_rcc_bundle.qrc").arg(rcc, shellQuote(QLatin1String("--root=/android_rcc_bundle/")),
|
||||
noZstd,
|
||||
shellQuote(QLatin1String("%1/android_rcc_bundle.rcc").arg(assetsDir))));
|
||||
if (!QDir::setCurrent(currentDir)) {
|
||||
fprintf(stderr, "Cannot set current dir to: %s\n", qPrintable(currentDir));
|
||||
|
Loading…
Reference in New Issue
Block a user