diff options
author | Tero Saarni <tero.saarni@gmail.com> | 2011-06-02 20:22:12 +0300 |
---|---|---|
committer | Tero Saarni <tero.saarni@gmail.com> | 2011-08-15 22:16:57 +0300 |
commit | 8baa0f19ccfd5ea6d1c7e377d5cbc4dc1a71f2c7 (patch) | |
tree | c45c8dc18de208800061fcdeeebba59158e0c2ff | |
parent | e3a869ad43f272c7804ad8cacb5bf4e9f00e2328 (diff) | |
download | sdk-8baa0f19ccfd5ea6d1c7e377d5cbc4dc1a71f2c7.zip sdk-8baa0f19ccfd5ea6d1c7e377d5cbc4dc1a71f2c7.tar.gz sdk-8baa0f19ccfd5ea6d1c7e377d5cbc4dc1a71f2c7.tar.bz2 |
Expose version.name property for aapt task.
The new property makes it possible to create ant build scripts
that programmatically determine and set the versionName attribute
during build. Similar property already exists for versionCode.
Signed-off-by: Tero Saarni <tero.saarni@gmail.com>
Change-Id: Ia36632ae029785563fc7c1bc8937034963016852
-rw-r--r-- | anttasks/src/com/android/ant/AaptExecLoopTask.java | 14 | ||||
-rw-r--r-- | files/ant/main_rules.xml | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/anttasks/src/com/android/ant/AaptExecLoopTask.java b/anttasks/src/com/android/ant/AaptExecLoopTask.java index 6c98cbd..ebefde5 100644 --- a/anttasks/src/com/android/ant/AaptExecLoopTask.java +++ b/anttasks/src/com/android/ant/AaptExecLoopTask.java @@ -78,6 +78,7 @@ public final class AaptExecLoopTask extends BaseTask { private boolean mVerbose = false; private boolean mUseCrunchCache = false; private int mVersionCode = 0; + private String mVersionName; private String mManifest; private ArrayList<Path> mResources; private String mAssets; @@ -139,6 +140,14 @@ public final class AaptExecLoopTask extends BaseTask { } } + /** + * Sets the value of the "versionName" attribute + * @param versionName the value + */ + public void setVersionname(String versionName) { + mVersionName = versionName; + } + public void setDebug(boolean value) { mDebug = value; } @@ -418,6 +427,11 @@ public final class AaptExecLoopTask extends BaseTask { task.createArg().setValue(Integer.toString(mVersionCode)); } + if ((mVersionName != null) && (mVersionName.length() > 0)) { + task.createArg().setValue("--version-name"); + task.createArg().setValue(mVersionName); + } + // manifest location if (mManifest != null) { task.createArg().setValue("-M"); diff --git a/files/ant/main_rules.xml b/files/ant/main_rules.xml index ff19add..8404eb8 100644 --- a/files/ant/main_rules.xml +++ b/files/ant/main_rules.xml @@ -120,6 +120,7 @@ before, then this will create them with empty values, which are then ignored by the custom tasks receiving them. --> <property name="version.code" value="" /> + <property name="version.name" value="" /> <property name="aapt.resource.filter" value="" /> <property name="filter.abi" value="" /> @@ -519,6 +520,7 @@ <aapt executable="${aapt}" command="package" versioncode="${version.code}" + versionname="${version.name}" debug="${build.packaging.debug}" manifest="AndroidManifest.xml" assets="${asset.absolute.dir}" |