]> git.saurik.com Git - android/aapt.git/blobdiff - Package.cpp
am 8c71784e: Merge "Initialize mJunkPath to false"
[android/aapt.git] / Package.cpp
index 57e20b38a66411b1121239c74d63e33dff57e7f2..3930117b67a2126a2fca50498cac1a523e01a3db 100644 (file)
@@ -6,6 +6,7 @@
 #include "Main.h"
 #include "AaptAssets.h"
 #include "ResourceTable.h"
+#include "ResourceFilter.h"
 
 #include <utils/Log.h>
 #include <utils/threads.h>
@@ -50,6 +51,11 @@ ssize_t processJarFiles(Bundle* bundle, ZipFile* zip);
 status_t writeAPK(Bundle* bundle, const sp<AaptAssets>& assets,
                        const String8& outputFile)
 {
+    #if BENCHMARK
+    fprintf(stdout, "BENCHMARK: Starting APK Bundling \n");
+    long startAPKTime = clock();
+    #endif /* BENCHMARK */
+
     status_t result = NO_ERROR;
     ZipFile* zip = NULL;
     int count;
@@ -172,12 +178,17 @@ status_t writeAPK(Bundle* bundle, const sp<AaptAssets>& assets,
         }
     }
 
+    // If we've been asked to generate a dependency file for the .ap_ package,
+    // do so here
     if (bundle->getGenDependencies()) {
-        // Add this file to the dependency file
-        String8 dependencyFile = outputFile.getBasePath();
+        // The dependency file gets output to the same directory
+        // as the specified output file with an additional .d extension.
+        // e.g. bin/resources.ap_.d
+        String8 dependencyFile = outputFile;
         dependencyFile.append(".d");
 
         FILE* fp = fopen(dependencyFile.string(), "a");
+        // Add this file to the dependency file
         fprintf(fp, "%s \\\n", outputFile.string());
         fclose(fp);
     }
@@ -197,6 +208,10 @@ bail:
 
     if (result == NO_ERROR && bundle->getVerbose())
         printf("Done!\n");
+
+    #if BENCHMARK
+    fprintf(stdout, "BENCHMARK: End APK Bundling. Time Elapsed: %f ms \n",(clock() - startAPKTime)/1000.0);
+    #endif /* BENCHMARK */
     return result;
 }