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
diff --git a/tools/aapt/Bundle.h b/tools/aapt/Bundle.h
index cbeaae8..49b8b55 100644
--- a/tools/aapt/Bundle.h
+++ b/tools/aapt/Bundle.h
@@ -59,10 +59,10 @@
mAndroidManifestFile(NULL), mPublicOutputFile(NULL),
mRClassDir(NULL), mResourceIntermediatesDir(NULL), mManifestMinSdkVersion(NULL),
mMinSdkVersion(NULL), mTargetSdkVersion(NULL), mMaxSdkVersion(NULL),
- mVersionCode(NULL), mVersionName(NULL), mCustomPackage(NULL), mExtraPackages(NULL),
- mMaxResVersion(NULL), mDebugMode(false), mNonConstantId(false), mProduct(NULL),
- mUseCrunchCache(false), mErrorOnFailedInsert(false), mErrorOnMissingConfigEntry(false),
- mOutputTextSymbols(NULL),
+ mVersionCode(NULL), mVersionName(NULL), mReplaceVersion(false), mCustomPackage(NULL),
+ mExtraPackages(NULL), mMaxResVersion(NULL), mDebugMode(false), mNonConstantId(false),
+ mProduct(NULL), mUseCrunchCache(false), mErrorOnFailedInsert(false),
+ mErrorOnMissingConfigEntry(false), mOutputTextSymbols(NULL),
mSingleCrunchInputFile(NULL), mSingleCrunchOutputFile(NULL),
mArgc(0), mArgv(NULL)
{}
@@ -166,6 +166,8 @@
void setVersionCode(const char* val) { mVersionCode = val; }
const char* getVersionName() const { return mVersionName; }
void setVersionName(const char* val) { mVersionName = val; }
+ bool getReplaceVersion() { return mReplaceVersion; }
+ void setReplaceVersion(bool val) { mReplaceVersion = val; }
const char* getCustomPackage() const { return mCustomPackage; }
void setCustomPackage(const char* val) { mCustomPackage = val; }
const char* getExtraPackages() const { return mExtraPackages; }
@@ -285,6 +287,7 @@
const char* mMaxSdkVersion;
const char* mVersionCode;
const char* mVersionName;
+ bool mReplaceVersion;
const char* mCustomPackage;
const char* mExtraPackages;
const char* mMaxResVersion;