aboutsummaryrefslogtreecommitdiffstats
path: root/anttasks
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-04-27 17:05:04 -0700
committerXavier Ducrohet <xav@android.com>2010-04-27 17:21:30 -0700
commitb2e132cffd83c46aa836d0b06ca2c66de87fff2e (patch)
treeb8cdc8b3f0f41d7ae9fed692d83ea10fc6a7ae2f /anttasks
parent0fd2efc6912586032d5dbe6d5c63e242cf65a31a (diff)
downloadsdk-b2e132cffd83c46aa836d0b06ca2c66de87fff2e.zip
sdk-b2e132cffd83c46aa836d0b06ca2c66de87fff2e.tar.gz
sdk-b2e132cffd83c46aa836d0b06ca2c66de87fff2e.tar.bz2
Add ABI filtering and version code injection in the Ant rules and tasks.
Change-Id: Ic8e41c1ad5343b32d2766427ba271a79c88b3b66
Diffstat (limited to 'anttasks')
-rw-r--r--anttasks/src/com/android/ant/AaptExecLoopTask.java17
-rw-r--r--anttasks/src/com/android/ant/ApkBuilderTask.java18
2 files changed, 34 insertions, 1 deletions
diff --git a/anttasks/src/com/android/ant/AaptExecLoopTask.java b/anttasks/src/com/android/ant/AaptExecLoopTask.java
index 9fe2170..09354c0 100644
--- a/anttasks/src/com/android/ant/AaptExecLoopTask.java
+++ b/anttasks/src/com/android/ant/AaptExecLoopTask.java
@@ -79,6 +79,7 @@ public final class AaptExecLoopTask extends Task {
private String mCommand;
private boolean mForce = true; // true due to legacy reasons
private boolean mVerbose = false;
+ private int mVersionCode = 0;
private String mManifest;
private ArrayList<Path> mResources;
private String mAssets;
@@ -120,6 +121,17 @@ public final class AaptExecLoopTask extends Task {
mVerbose = verbose;
}
+ public void setVersioncode(String versionCode) {
+ if (versionCode.length() > 0) {
+ try {
+ mVersionCode = Integer.decode(versionCode);
+ } catch (NumberFormatException e) {
+ System.out.println(String.format(
+ "WARNING: Ignoring invalid version code value '%s'.", versionCode));
+ }
+ }
+ }
+
/**
* Sets the value of the "manifest" attribute.
* @param manifest the value.
@@ -356,6 +368,11 @@ public final class AaptExecLoopTask extends Task {
task.createArg().setValue("--auto-add-overlay");
}
+ if (mVersionCode != 0) {
+ task.createArg().setValue("--version-code");
+ task.createArg().setValue(Integer.toString(mVersionCode));
+ }
+
// manifest location
if (mManifest != null) {
task.createArg().setValue("-M");
diff --git a/anttasks/src/com/android/ant/ApkBuilderTask.java b/anttasks/src/com/android/ant/ApkBuilderTask.java
index 3fdf4d5..9067ec7 100644
--- a/anttasks/src/com/android/ant/ApkBuilderTask.java
+++ b/anttasks/src/com/android/ant/ApkBuilderTask.java
@@ -46,6 +46,7 @@ public class ApkBuilderTask extends Task {
private boolean mVerbose = false;
private boolean mSigned = true;
private boolean mDebug = false;
+ private String mAbiFilter = null;
private final ArrayList<Path> mZipList = new ArrayList<Path>();
private final ArrayList<Path> mFileList = new ArrayList<Path>();
@@ -101,6 +102,21 @@ public class ApkBuilderTask extends Task {
}
/**
+ * Sets an ABI filter. If non <code>null</code>, then only native libraries matching the given
+ * ABI will be packaged with the APK.
+ * @param abiFilter the ABI to accept (and reject all other). If null or empty string, no ABIs
+ * are rejected. This must be a single ABI name as defined by the Android NDK. For a list
+ * of valid ABI names, see $NDK/docs/CPU-ARCH-ABIS.TXT
+ */
+ public void setAbifilter(String abiFilter) {
+ if (abiFilter != null && abiFilter.length() > 0) {
+ mAbiFilter = abiFilter.trim();
+ } else {
+ mAbiFilter = null;
+ }
+ }
+
+ /**
* Returns an object representing a nested <var>zip</var> element.
*/
public Object createZip() {
@@ -208,7 +224,7 @@ public class ApkBuilderTask extends Task {
for (Path pathList : mNativeList) {
for (String path : pathList.list()) {
ApkBuilderImpl.processNativeFolder(new File(path), mDebug,
- mNativeLibraries);
+ mNativeLibraries, mVerbose, mAbiFilter);
}
}