]> git.saurik.com Git - android/aapt.git/blobdiff - Resource.cpp
Add dependency generation to Aapt for R.java
[android/aapt.git] / Resource.cpp
index 0a4f24f26df217860a9c3bea381debae888bfd9f..a603314709ab9c1c1a31da4a052e5f3e77d8da4b 100644 (file)
@@ -51,6 +51,12 @@ ResourceTypeSet::ResourceTypeSet()
 {
 }
 
+FilePathStore::FilePathStore()
+    :RefBase(),
+     Vector<String8>()
+{
+}
+
 class ResourceDirIterator
 {
 public:
@@ -1849,6 +1855,16 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
             return err;
         }
         fclose(fp);
+
+        if (bundle->getGenDependencies()) {
+            // Add this R.java to the dependency file
+            String8 dependencyFile(bundle->getRClassDir());
+            dependencyFile.appendPath("R.d");
+
+            fp = fopen(dependencyFile.string(), "a");
+            fprintf(fp,"%s \\\n", dest.string());
+            fclose(fp);
+        }
     }
 
     return NO_ERROR;
@@ -2170,3 +2186,16 @@ writeProguardFile(Bundle* bundle, const sp<AaptAssets>& assets)
 
     return err;
 }
+
+status_t
+writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets, FILE* fp)
+{
+    status_t deps = -1;
+    sp<FilePathStore> files = assets->getFullResPaths();
+    for (size_t file_i = 0; file_i < files->size(); ++file_i) {
+        // Add the full file path to the dependency file
+        fprintf(fp, "%s \\\n", files->itemAt(file_i).string());
+        deps++;
+    }
+    return deps;
+}
\ No newline at end of file