summaryrefslogtreecommitdiff
path: root/tools/aapt/Main.cpp
diff options
context:
space:
mode:
authorJeff Davidson <jpd@google.com>2014-02-25 12:28:08 -0800
committerJeff Davidson <jpd@google.com>2014-02-25 13:42:12 -0800
commitdf08d1c24dbbc242978ee33416d1e54998f88915 (patch)
tree1f933fa448fcac027fb3b7bb0fc9cba1e273c510 /tools/aapt/Main.cpp
parentc1970190549519acde6719c777f53611674058cb (diff)
Add --replace-version flag to aapt.
Motivation: we'd like to programmatically specify the version name/code (i.e. to include the build number from the build server). However, this means that we cannot specify version info in the AndroidManifest.xml file, as this takes precedence. Not doing so makes IDE use more difficult, as the IDE gets version code 0 and won't install over an existing non-IDE version unless you first force a downgrade to an IDE build from the command line. This flag allows us to specify a very high version code in the AndroidManifest.xml file, making IDE builds take precedence, while still allowing us to override this info when performing command-line (official) builds. Change-Id: I5d01048698af5c26bdf19066c6cd4eca1115112a
Diffstat (limited to 'tools/aapt/Main.cpp')
-rw-r--r--tools/aapt/Main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 1ed46308fb30..33711fa5ba9b 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -153,6 +153,11 @@ void usage(void)
" inserts android:versionCode in to manifest.\n"
" --version-name\n"
" inserts android:versionName in to manifest.\n"
+ " --replace-version\n"
+ " If --version-code and/or --version-name are specified, these\n"
+ " values will replace any value already in the manifest. By\n"
+ " default, nothing is changed if the manifest already defines\n"
+ " these attributes.\n"
" --custom-package\n"
" generates R.java into a different package.\n"
" --extra-packages\n"
@@ -532,6 +537,8 @@ int main(int argc, char* const argv[])
goto bail;
}
bundle.setVersionName(argv[0]);
+ } else if (strcmp(cp, "-replace-version") == 0) {
+ bundle.setReplaceVersion(true);
} else if (strcmp(cp, "-values") == 0) {
bundle.setValues(true);
} else if (strcmp(cp, "-include-meta-data") == 0) {