Skip to content

Commit

Permalink
Move '--sign' argument to the end of the androiddeployqt command
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
semlanik committed Jan 2, 2023
1 parent 644036b commit 9c56a77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/corelib/Qt6AndroidMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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()

Expand Down
8 changes: 7 additions & 1 deletion src/tools/androiddeployqt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,22 @@ 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 "
"environment variables.\n");
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
Expand Down

0 comments on commit 9c56a77

Please sign in to comment.