aboutsummaryrefslogtreecommitdiffstats
path: root/apkbuilder
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-01-21 12:30:36 -0800
committerXavier Ducrohet <xav@android.com>2010-01-21 15:18:44 -0800
commitccea4ad79984504212b29788bec9d42e54846c2b (patch)
treecaf3d6deb208f060fe7727e8c6a73ad727b3fa6d /apkbuilder
parent32cfca5838558c0beb9b771e3b2e880047eb8053 (diff)
downloadsdk-ccea4ad79984504212b29788bec9d42e54846c2b.zip
sdk-ccea4ad79984504212b29788bec9d42e54846c2b.tar.gz
sdk-ccea4ad79984504212b29788bec9d42e54846c2b.tar.bz2
Add support for packaging gdbserver in the apk in Ant.
This must only be done in debug so there's a new flag to detect debug mode. Support for this is added to the build script, the Ant task and ApkBuilder itself. Change-Id: Iaebdc60cc3e8fa08c8cb75c885a6a0db556bfd86
Diffstat (limited to 'apkbuilder')
-rw-r--r--apkbuilder/src/com/android/apkbuilder/ApkBuilder.java1
-rw-r--r--apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java21
2 files changed, 17 insertions, 5 deletions
diff --git a/apkbuilder/src/com/android/apkbuilder/ApkBuilder.java b/apkbuilder/src/com/android/apkbuilder/ApkBuilder.java
index db9f355..236ebbb 100644
--- a/apkbuilder/src/com/android/apkbuilder/ApkBuilder.java
+++ b/apkbuilder/src/com/android/apkbuilder/ApkBuilder.java
@@ -85,6 +85,7 @@ public final class ApkBuilder {
System.err.println(" [-f inputfile] [-rf input-folder] [-rj -input-path]");
System.err.println("");
System.err.println(" -v Verbose.");
+ System.err.println(" -d Debug Mode: Includes debug files in the APK file.");
System.err.println(" -u Creates an unsigned package.");
System.err.println(" -storetype Forces the KeyStore type. If ommited the default is used.");
System.err.println("");
diff --git a/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java b/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
index 404bd8c..d8e0123 100644
--- a/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
+++ b/apkbuilder/src/com/android/apkbuilder/internal/ApkBuilderImpl.java
@@ -49,6 +49,7 @@ public final class ApkBuilderImpl {
Pattern.CASE_INSENSITIVE);
private final static String NATIVE_LIB_ROOT = "lib/";
+ private final static String GDBSERVER_NAME = "gdbserver";
/**
* A File to be added to the APK archive.
@@ -67,6 +68,7 @@ public final class ApkBuilderImpl {
private JavaResourceFilter mResourceFilter = new JavaResourceFilter();
private boolean mVerbose = false;
private boolean mSignedPackage = true;
+ private boolean mDebugMode = false;
/** the optional type of the debug keystore. If <code>null</code>, the default */
private String mStoreType = null;
@@ -78,6 +80,10 @@ public final class ApkBuilderImpl {
mSignedPackage = signedPackage;
}
+ public void setDebugMode(boolean debugMode) {
+ mDebugMode = debugMode;
+ }
+
public void run(String[] args) throws WrongOptionException, FileNotFoundException,
ApkCreationException {
if (args.length < 1) {
@@ -99,6 +105,8 @@ public final class ApkBuilderImpl {
if ("-v".equals(argument)) {
mVerbose = true;
+ } else if ("-d".equals(argument)) {
+ mDebugMode = true;
} else if ("-u".equals(argument)) {
mSignedPackage = false;
} else if ("-z".equals(argument)) {
@@ -140,7 +148,7 @@ public final class ApkBuilderImpl {
throw new WrongOptionException("Missing value for -nf");
}
- processNativeFolder(new File(args[index++]), nativeLibraries);
+ processNativeFolder(new File(args[index++]), mDebugMode, nativeLibraries);
} else if ("-storetype".equals(argument)) {
// quick check on the next argument.
if (index == args.length) {
@@ -311,8 +319,8 @@ public final class ApkBuilderImpl {
* @param nativeLibraries the collection to add native libraries to.
* @throws ApkCreationException
*/
- public static void processNativeFolder(File root, Collection<ApkFile> nativeLibraries)
- throws ApkCreationException {
+ public static void processNativeFolder(File root, boolean debugMode,
+ Collection<ApkFile> nativeLibraries) throws ApkCreationException {
if (root.isDirectory() == false) {
throw new ApkCreationException(root.getAbsolutePath() + " is not a folder!");
}
@@ -325,8 +333,11 @@ public final class ApkBuilderImpl {
File[] libs = abi.listFiles();
if (libs != null) {
for (File lib : libs) {
- if (lib.isFile() && // ignore folders
- PATTERN_NATIVELIB_EXT.matcher(lib.getName()).matches()) {
+ // only consider files that are .so or, if in debug mode, that
+ // are gdbserver executables
+ if (lib.isFile() &&
+ (PATTERN_NATIVELIB_EXT.matcher(lib.getName()).matches() ||
+ (debugMode && GDBSERVER_NAME.equals(lib.getName())))) {
String path =
NATIVE_LIB_ROOT + abi.getName() + "/" + lib.getName();