Move '--sign' argument to the end of the androiddeployqt command

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.

Fixes: QTBUG-109619
Change-Id: I4ee7fe953e5378c00760d84ec58f9e89e4348944
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9c56a77027db2fedfc2b50f96ceaee5003a7d383)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Alexey Edelev 2022-12-23 13:54:28 +01:00
parent 1f323d2167
commit 9d7131f5ef
2 changed files with 10 additions and 3 deletions

View File

@ -440,8 +440,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}"
@ -458,9 +458,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()

View File

@ -423,6 +423,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 "
@ -431,10 +432,15 @@ Options parseOptions()
options.keyStore = keyStore;
options.keyStoreAlias = storeAlias;
}
} else {
} else if (!arguments.at(i + 1).startsWith("--"_L1) &&
!arguments.at(i + 2).startsWith("--"_L1)) {
options.releasePackage = true;
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