From: Tero Saarni Date: Thu, 2 Jun 2011 17:22:12 +0000 (+0300) Subject: Expose version.name property for aapt task. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8baa0f19ccfd5ea6d1c7e377d5cbc4dc1a71f2c7;p=android-x86%2Fsdk.git 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 Change-Id: Ia36632ae029785563fc7c1bc8937034963016852 --- diff --git a/anttasks/src/com/android/ant/AaptExecLoopTask.java b/anttasks/src/com/android/ant/AaptExecLoopTask.java index 6c98cbdbe..ebefde552 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 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 ff19add35..8404eb85c 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. --> + @@ -519,6 +520,7 @@