From 0ea77446251902c2514c521465355c1050cb6902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Sat, 12 Jun 2010 17:56:19 +0200 Subject: [PATCH] Changed default name of built apk from out.apk to a name of original apk. --- src/brut/androlib/Androlib.java | 10 ++++++---- src/brut/androlib/ApkDecoder.java | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/brut/androlib/Androlib.java b/src/brut/androlib/Androlib.java index b8eac992..050ca94a 100644 --- a/src/brut/androlib/Androlib.java +++ b/src/brut/androlib/Androlib.java @@ -153,12 +153,16 @@ public class Androlib { Object t1 = meta.get("isFrameworkApk"); boolean framework = t1 == null ? false : (Boolean) t1; + String outFileName = (String) meta.get("apkFileName"); + File outFile = new File(appDir, "dist" + File.separator + + (outFileName == null ? "out" : outFileName)); + new File(appDir, APK_DIRNAME).mkdirs(); buildSources(appDir, forceBuildAll, debug); buildResources(appDir, forceBuildAll, framework, (Map) meta.get("usesFramework")); buildLib(appDir, forceBuildAll); - buildApk(appDir, framework); + buildApk(appDir, outFile, framework); } public void buildSources(File appDir, boolean forceBuildAll, boolean debug) @@ -324,10 +328,9 @@ public class Androlib { } } - public void buildApk(File appDir, boolean framework) + public void buildApk(File appDir, File outApk, boolean framework) throws AndrolibException { LOGGER.info("Building apk file..."); - File outApk = new File(appDir, OUT_APK_FILENAME); if (outApk.exists()) { outApk.delete(); } else { @@ -418,7 +421,6 @@ public class Androlib { private final static String SMALI_DIRNAME = "smali"; private final static String APK_DIRNAME = "build/apk"; - private final static String OUT_APK_FILENAME = "dist/out.apk"; private final static String[] APK_RESOURCES_FILENAMES = new String[]{"resources.arsc", "AndroidManifest.xml", "res"}; private final static String[] APK_RESOURCES_WITHOUT_RES_FILENAMES = diff --git a/src/brut/androlib/ApkDecoder.java b/src/brut/androlib/ApkDecoder.java index b6de62bc..ca46d178 100644 --- a/src/brut/androlib/ApkDecoder.java +++ b/src/brut/androlib/ApkDecoder.java @@ -174,6 +174,7 @@ public class ApkDecoder { private void writeMetaFile() throws AndrolibException { Map meta = new LinkedHashMap(); meta.put("version", Androlib.getVersion()); + meta.put("apkFileName", mApkFile.getName()); if (hasResources()) { meta.put("isFrameworkApk",