diff options
author | Christopher Orr <chris@orr.me.uk> | 2011-10-28 13:03:05 +0200 |
---|---|---|
committer | Christopher Orr <chris@orr.me.uk> | 2012-02-14 16:43:27 +0100 |
commit | 07162980d69bc4b1b034a483d42d04153b1ef493 (patch) | |
tree | e10d1e4d7dbc15c99e11fa19de2ca6347f759872 /anttasks | |
parent | 121e7e305d8dc179bce1267b0ccef2741706262d (diff) | |
download | sdk-07162980d69bc4b1b034a483d42d04153b1ef493.zip sdk-07162980d69bc4b1b034a483d42d04153b1ef493.tar.gz sdk-07162980d69bc4b1b034a483d42d04153b1ef493.tar.bz2 |
Add --rename-manifest-package option to aapt Ant task.
Diffstat (limited to 'anttasks')
-rw-r--r-- | anttasks/src/com/android/ant/AaptExecTask.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/anttasks/src/com/android/ant/AaptExecTask.java b/anttasks/src/com/android/ant/AaptExecTask.java index c01afe2..9ca8830 100644 --- a/anttasks/src/com/android/ant/AaptExecTask.java +++ b/anttasks/src/com/android/ant/AaptExecTask.java @@ -50,6 +50,7 @@ import java.util.Set; * <tr><td>-0 extension</td><td><nocompress extension=""><br><nocompress></td><td>nested element(s)<br>with attribute (String)</td></tr> * <tr><td>-F apk-file</td><td>apkfolder<br>outfolder<br>apkbasename<br>basename</td><td>attribute (Path)<br>attribute (Path) deprecated<br>attribute (String)<br>attribute (String) deprecated</td></tr> * <tr><td>-J R-file-dir</td><td>rfolder</td><td>attribute (Path)<br>-m always enabled</td></tr> + * <tr><td>--rename-manifest-package package-name</td><td>manifestpackage</td><td>attribute (String)</td></tr> * <tr><td></td><td></td><td></td></tr> * </table> */ @@ -83,6 +84,7 @@ public final class AaptExecTask extends SingleDependencyTask { private int mVersionCode = 0; private String mVersionName; private String mManifest; + private String mManifestPackage; private ArrayList<Path> mResources; private String mAssets; private String mAndroidJar; @@ -211,6 +213,20 @@ public final class AaptExecTask extends SingleDependencyTask { } /** + * Sets a custom manifest package ID to be used during packaging.<p> + * The manifest will be rewritten so that its package ID becomes the value given here. + * Relative class names in the manifest (e.g. ".Foo") will be rewritten to absolute names based + * on the existing package name, meaning that no code changes need to be made. + * + * @param packageName The package ID the APK should have. + */ + public void setManifestpackage(String packageName) { + if (packageName != null && packageName.length() != 0) { + mManifestPackage = packageName; + } + } + + /** * Sets the value of the "resources" attribute. * @param resources the value. * @@ -536,6 +552,12 @@ public final class AaptExecTask extends SingleDependencyTask { task.createArg().setValue(mManifest); } + // Rename manifest package + if (mManifestPackage != null) { + task.createArg().setValue("--rename-manifest-package"); + task.createArg().setValue(mManifestPackage); + } + // resources locations. if (mResources.size() > 0) { for (Path pathList : mResources) { |