summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-05-19 11:00:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-19 13:29:32 +0200
commit3f24e2cc5bfc9fac7c1cfd6ab0dc9b0880e879ea (patch)
treeb46f808230ca7b1312e7da486f720d255a0b2eb7
parentd3f406dfe113f0a7f7b1dcd3fada4c2b7e7cd23c (diff)
downloadqttools-3f24e2cc5bfc9fac7c1cfd6ab0dc9b0880e879ea.tar.gz
androiddeployqt: Add option to reinstall apk
Mainly for consistency with the old deployment method in Qt Creator, androiddeployqt will uninstall any previously installed instances of the application before installing it. This will remove any caches or user data stored by the application. In many cases (most) it would be more convenient to just overwrite the existing instance, but keep all caches intact. This patch adds the --reinstall option, symmetrical to --install. If enabled, the uninstall step will be skipped. [ChangeLog][androiddeployqt] Added option to install an APK without uninstalling previous instances of same application. Task-number: QTBUG-35845 Change-Id: I93bed4fefda6ed5295f333002a4958654b3f911c Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
-rw-r--r--src/androiddeployqt/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index cfb4617df..f81f77e37 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -90,6 +90,7 @@ struct Options
, sectionsOnly(false)
, protectedAuthenticationPath(false)
, installApk(false)
+ , uninstallApk(false)
, fetchedRemoteModificationDates(false)
{}
@@ -159,6 +160,7 @@ struct Options
// Installation information
bool installApk;
+ bool uninstallApk;
QString installLocation;
// Collected information
@@ -266,6 +268,10 @@ Options parseOptions()
options.inputFileName = arguments.at(++i);
} else if (argument.compare(QLatin1String("--install"), Qt::CaseInsensitive) == 0) {
options.installApk = true;
+ options.uninstallApk = true;
+ } else if (argument.compare(QLatin1String("--reinstall"), Qt::CaseInsensitive) == 0) {
+ options.installApk = true;
+ options.uninstallApk = false;
} else if (argument.compare(QLatin1String("--android-platform"), Qt::CaseInsensitive) == 0) {
if (i + 1 == arguments.size())
options.helpRequested = true;
@@ -402,7 +408,12 @@ void printHelp()
" ministro: Use the Ministro service to manage Qt files.\n"
" debug: Copy Qt files to device for quick debugging.\n"
" --install: Installs apk to device/emulator. By default this step is\n"
- " not taken.\n"
+ " not taken. If the application has previously been installed on\n"
+ " the device, it will be uninstalled first.\n"
+ " --reinstall: Installs apk to device/emulator. By default this step\n"
+ " is not taken. If the application has previously been installed on\n"
+ " the device, it will be overwritten, but its data will be left\n"
+ " intact.\n"
" --device [device ID]: Use specified device for deployment. Default\n"
" is the device selected by default by adb.\n"
" --android-platform <platform>: Builds against the given android\n"
@@ -1896,7 +1907,8 @@ QString apkName(const Options &options)
bool installApk(const Options &options)
{
// Uninstall if necessary
- uninstallApk(options);
+ if (options.uninstallApk)
+ uninstallApk(options);
if (options.verbose)
fprintf(stdout, "Installing Android package to device.\n");