From 9c56a77027db2fedfc2b50f96ceaee5003a7d383 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Fri, 23 Dec 2022 13:54:28 +0100 Subject: [PATCH] Move '--sign' argument to the end of the androiddeployqt command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The '--sign' argument may and may not accept two follow arguments to specify signing path and alias from the command line. This functionality breaks the parsing of command line arguments that follow the '--sign' argument and expect that '--sign' is used with no follow arguments. It does make sense to check if the arguments passed after the --sign staring with '--' to make sure that '--sign' with no arguments is meant to be used. Pick-to: 6.4 6.5 Fixes: QTBUG-109619 Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944 Reviewed-by: Jörg Bornemann --- src/corelib/Qt6AndroidMacros.cmake | 5 +++-- src/tools/androiddeployqt/main.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index 90349aad872..48abb907a01 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -475,8 +475,8 @@ function(qt6_android_add_apk_target target) --apk "${apk_final_file_path}" --depfile "${dep_file_path}" --builddir "${relative_to_dir}" - ${sign_apk} ${extra_args} + ${sign_apk} COMMENT "Creating APK for ${target}" DEPENDS "${target}" "${deployment_file}" ${extra_deps} DEPFILE "${dep_file_path}" @@ -493,9 +493,10 @@ function(qt6_android_add_apk_target target) --input ${deployment_file} --output ${apk_final_dir} --apk ${apk_final_file_path} - ${sign_apk} ${extra_args} + ${sign_apk} COMMENT "Creating APK for ${target}" + VERBATIM ) endif() diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index c9c7f12d0cb..787c2f405c9 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -428,6 +428,7 @@ Options parseOptions() const QString storeAlias = qEnvironmentVariable("QT_ANDROID_KEYSTORE_ALIAS"); if (keyStore.isEmpty() || storeAlias.isEmpty()) { options.helpRequested = true; + fprintf(stderr, "Package signing path and alias values are not specified.\n"); } else { fprintf(stdout, "Using package signing path and alias values found from the " @@ -435,9 +436,14 @@ Options parseOptions() options.keyStore = keyStore; options.keyStoreAlias = storeAlias; } - } else { + } else if (!arguments.at(i + 1).startsWith("--"_L1) && + !arguments.at(i + 2).startsWith("--"_L1)) { options.keyStore = arguments.at(++i); options.keyStoreAlias = arguments.at(++i); + } else { + options.helpRequested = true; + fprintf(stderr, "Package signing path and alias values are not " + "specified.\n"); } // Do not override if the passwords are provided through arguments