From 9bf34ca6f85309c65b0ebdf614cb8266401b49ba Mon Sep 17 00:00:00 2001 From: Josiah Gaskin Date: Tue, 14 Jun 2011 13:57:09 -0700 Subject: Add dependency generation to Aapt for R.java Make Aapt generate a dependency file in the location specified by RClassDir for R.java if the --generate-dependencies flag is set. This dependency file is then read by the ant exec loop task to see whether to recreate R.java. Change-Id: I7152dac86b6ea0e448ef65e3a95694afe233c789 --- tools/aapt/Resource.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tools/aapt/Resource.cpp') diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 0a4f24f26df2..a603314709ab 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -51,6 +51,12 @@ ResourceTypeSet::ResourceTypeSet() { } +FilePathStore::FilePathStore() + :RefBase(), + Vector() +{ +} + class ResourceDirIterator { public: @@ -1849,6 +1855,16 @@ status_t writeResourceSymbols(Bundle* bundle, const sp& 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& assets) return err; } + +status_t +writeDependencyPreReqs(Bundle* bundle, const sp& assets, FILE* fp) +{ + status_t deps = -1; + sp 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 -- cgit v1.2.3-59-g8ed1b