Add --no-rcc-bundle-cleanup option to androiddeployqt tool

Add --no-rcc-bundle-cleanup option to androiddeployqt tool that helps
to debug android build procedures and check the raw rcc bundle for
missing items. Also add the QT_INTERNAL_NO_ANDROID_RCC_BUNDLE_CLEANUP
CMake variable that adds the option when configuring projects for
Android.

Change-Id: I1f30ba979f9fb3274e44a53fdc5ebde4e65f0843
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Alexey Edelev 2021-10-18 13:27:55 +02:00 committed by Alexey Edelev
parent a670839c61
commit 388136e860
2 changed files with 19 additions and 2 deletions

View File

@ -338,6 +338,10 @@ function(qt6_android_add_apk_target target)
COMMENT "Copying ${target} binary to apk folder"
)
set(extra_args "")
if(QT_INTERNAL_NO_ANDROID_RCC_BUNDLE_CLEANUP)
list(APPEND extra_args "--no-rcc-bundle-cleanup")
endif()
# The DEPFILE argument to add_custom_command is only available with Ninja or CMake>=3.20 and make.
if (CMAKE_GENERATOR MATCHES "Ninja" OR
(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20 AND CMAKE_GENERATOR MATCHES "Makefiles"))
@ -354,6 +358,7 @@ function(qt6_android_add_apk_target target)
--apk "${apk_intermediate_file_path}"
--depfile "${dep_intermediate_file_path}"
--builddir "${CMAKE_BINARY_DIR}"
${extra_args}
COMMENT "Creating APK for ${target}"
DEPENDS "${target}" "${deployment_file}"
DEPFILE "${dep_intermediate_file_path}")
@ -371,6 +376,7 @@ function(qt6_android_add_apk_target target)
--input ${deployment_file}
--output ${apk_final_dir}
--apk ${apk_final_file_path}
${extra_args}
COMMENT "Creating APK for ${target}"
)
endif()

View File

@ -134,6 +134,7 @@ struct Options
bool timing;
bool build;
bool auxMode;
bool noRccBundleCleanup = false;
QElapsedTimer timer;
// External tools
@ -559,6 +560,9 @@ Options parseOptions()
options.auxMode = true;
} else if (argument.compare(QLatin1String("--qml-importscanner-binary"), Qt::CaseInsensitive) == 0) {
options.qmlImportScannerBinaryPath = arguments.at(++i).trimmed();
} else if (argument.compare(QLatin1String("--no-rcc-bundle-cleanup"),
Qt::CaseInsensitive) == 0) {
options.noRccBundleCleanup = true;
}
}
@ -678,6 +682,11 @@ void printHelp()
" --builddir <path/to/build/directory>: build directory. Necessary when\n"
" generating a depfile because ninja requires relative paths.\n"
"\n"
" --no-rcc-bundle-cleanup: skip cleaning rcc bundle directory after\n"
" running androiddeployqt. This option simplifies debugging of\n"
" the resource bundle content, but it should not be used when deploying\n"
" a project, since it litters the 'assets' directory.\n"
"\n"
" --help: Displays this information.\n",
qPrintable(QCoreApplication::arguments().at(0))
);
@ -2191,8 +2200,10 @@ bool createRcc(const Options &options)
fprintf(stderr, "Cannot set current dir to: %s\n", qPrintable(currentDir));
return false;
}
QFile::remove(QLatin1String("%1/android_rcc_bundle.qrc").arg(assetsDir));
QDir{QLatin1String("%1/android_rcc_bundle").arg(assetsDir)}.removeRecursively();
if (!options.noRccBundleCleanup) {
QFile::remove(QLatin1String("%1/android_rcc_bundle.qrc").arg(assetsDir));
QDir{QLatin1String("%1/android_rcc_bundle").arg(assetsDir)}.removeRecursively();
}
return res;
}