diff options
author | Xavier Ducrohet <xav@android.com> | 2012-03-07 16:51:07 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-07 16:51:07 -0800 |
commit | a4ddc9f83003ac4dad261cecd77f6b331c53728e (patch) | |
tree | 481d090654b6d6a206a5d3d7d4aee739c0f8c32b /sdkmanager/libs/sdklib | |
parent | f2bff009b2380b6fa2c4110e53cb15b5ce8bee2c (diff) | |
parent | bcf44e9429811b3e1f97d21ea92816957bce2601 (diff) | |
download | sdk-a4ddc9f83003ac4dad261cecd77f6b331c53728e.zip sdk-a4ddc9f83003ac4dad261cecd77f6b331c53728e.tar.gz sdk-a4ddc9f83003ac4dad261cecd77f6b331c53728e.tar.bz2 |
Merge "Figure out DX input path based on actual classpath."
Diffstat (limited to 'sdkmanager/libs/sdklib')
-rw-r--r-- | sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java index 5c95b81..3c749c4 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/build/ApkBuilder.java @@ -586,12 +586,25 @@ public final class ApkBuilder implements IArchiveBuilder { throw new SealedApkException("APK is already sealed"); } + addSourceFolder(this, sourceFolder); + } + + /** + * Adds the resources from a source folder to a given {@link IArchiveBuilder} + * @param sourceFolder the source folder. + * @throws ApkCreationException if an error occurred + * @throws SealedApkException if the APK is already sealed. + * @throws DuplicateFileException if a file conflicts with another already added to the APK + * at the same location inside the APK archive. + */ + public static void addSourceFolder(IArchiveBuilder builder, File sourceFolder) + throws ApkCreationException, DuplicateFileException { if (sourceFolder.isDirectory()) { try { // file is a directory, process its content. File[] files = sourceFolder.listFiles(); for (File file : files) { - processFileForResource(file, null); + processFileForResource(builder, file, null); } } catch (DuplicateFileException e) { throw e; @@ -799,9 +812,11 @@ public final class ApkBuilder implements IArchiveBuilder { * @throws IOException * @throws DuplicateFileException if a file conflicts with another already added * to the APK at the same location inside the APK archive. + * @throws SealedApkException if the APK is already sealed. + * @throws ApkCreationException if an error occurred */ - private void processFileForResource(File file, String path) - throws IOException, DuplicateFileException { + private static void processFileForResource(IArchiveBuilder builder, File file, String path) + throws IOException, DuplicateFileException, ApkCreationException, SealedApkException { if (file.isDirectory()) { // a directory? we check it if (checkFolderForPackaging(file.getName())) { @@ -815,7 +830,7 @@ public final class ApkBuilder implements IArchiveBuilder { // and process its content. File[] files = file.listFiles(); for (File contentFile : files) { - processFileForResource(contentFile, path); + processFileForResource(builder, contentFile, path); } } } else { @@ -829,7 +844,7 @@ public final class ApkBuilder implements IArchiveBuilder { } // and add it to the apk - doAddFile(file, path); + builder.addFile(file, path); } } } |