summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2020-08-06 19:25:47 +0300
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2020-08-25 10:07:16 +0300
commit862ac16ab16a7a7d5d299e8d71188b379d8f2baa (patch)
treeef828b0c1dd1fac4131316952718198af72bb9dc /src/tools
parent3a4153766eb98a530c0d7ed71ac6930ff7b1cf26 (diff)
Android: add the option to set package signing information from env vars
Use the following env vars to help conceal private signing information: - QT_ANDROID_KEYSTORE_PATH - QT_ANDROID_KEYSTORE_ALIAS - QT_ANDROID_KEYSTORE_STORE_PASS - QT_ANDROID_KEYSTORE_KEY_PASS [ChangeLog][Platform Specific Changes][Android] Added the option to conceal package signing information using environment variables. Task-number: QTBUG-84922 Change-Id: I1fac51ed9e88ef42c761bc916ba1c3bf439806e8 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/androiddeployqt/main.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index f9a40715d4..9415554608 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -478,12 +478,35 @@ Options parseOptions()
options.apkPath = arguments.at(++i);
} else if (argument.compare(QLatin1String("--sign"), Qt::CaseInsensitive) == 0) {
if (i + 2 >= arguments.size()) {
- options.helpRequested = true;
+ const QString keyStore = qEnvironmentVariable("QT_ANDROID_KEYSTORE_PATH");
+ const QString storeAlias = qEnvironmentVariable("QT_ANDROID_KEYSTORE_ALIAS");
+ if (keyStore.isEmpty() || storeAlias.isEmpty()) {
+ options.helpRequested = true;
+ } else {
+ fprintf(stdout,
+ "Using package signing path and alias values found from the "
+ "environment variables.\n");
+ options.releasePackage = true;
+ options.keyStore = keyStore;
+ options.keyStoreAlias = storeAlias;
+ }
} else {
options.releasePackage = true;
options.keyStore = arguments.at(++i);
options.keyStoreAlias = arguments.at(++i);
}
+
+ // Do not override if the passwords are provided through arguments
+ if (options.keyStorePassword.isEmpty()) {
+ fprintf(stdout, "Using package signing store password found from the environment "
+ "variable.\n");
+ options.keyStorePassword = qEnvironmentVariable("QT_ANDROID_KEYSTORE_STORE_PASS");
+ }
+ if (options.keyPass.isEmpty()) {
+ fprintf(stdout, "Using package signing key password found from the environment "
+ "variable.\n");
+ options.keyPass = qEnvironmentVariable("QT_ANDROID_KEYSTORE_KEY_PASS");
+ }
} else if (argument.compare(QLatin1String("--storepass"), Qt::CaseInsensitive) == 0) {
if (i + 1 == arguments.size())
options.helpRequested = true;
@@ -606,6 +629,12 @@ void printHelp()
" --protected: Keystore has protected authentication path.\n"
" --jarsigner: Force jarsigner usage, otherwise apksigner will be\n"
" used if available.\n"
+ " NOTE: To conceal the keystore information, the environment variables\n"
+ " QT_ANDROID_KEYSTORE_PATH, and QT_ANDROID_KEYSTORE_ALIAS are used to\n"
+ " set the values keysotore and alias respectively.\n"
+ " Also the environment variables QT_ANDROID_KEYSTORE_STORE_PASS,\n"
+ " and QT_ANDROID_KEYSTORE_KEY_PASS are used to set the store and key\n"
+ " passwords respectively. This option needs only the --sign parameter.\n"
" --jdk <path/to/jdk>: Used to find the jarsigner tool when used\n"
" in combination with the --release argument. By default,\n"
" an attempt is made to detect the tool using the JAVA_HOME and\n"