summaryrefslogtreecommitdiff
path: root/tools/aapt/Resource.cpp
diff options
context:
space:
mode:
author Josiah Gaskin <josiahgaskin@google.com> 2011-06-27 16:26:02 -0700
committer Josiah Gaskin <josiahgaskin@google.com> 2011-07-18 16:37:55 -0700
commit03589cc65355220e0a4a0c816189a9fa25cc81fc (patch)
treeebe98e64c530708e8709025e8ad051c714eab9a3 /tools/aapt/Resource.cpp
parent9bf34ca6f85309c65b0ebdf614cb8266401b49ba (diff)
Add generation of dependency file for .ap_ package
Make Aapt generate a dependency file in the same directory as the output ap_ file if the --generate-dependencies flag is set. This dependency file can then be read by the ant exec loop task to see whether to repackage resources. Change-Id: I763679414daf76369700aa599c26dcf78d4de099
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r--tools/aapt/Resource.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index a603314709ab..6e86112a3756 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -2187,15 +2187,26 @@ writeProguardFile(Bundle* bundle, const sp<AaptAssets>& assets)
return err;
}
-status_t
-writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets, FILE* fp)
+// Loops through the string paths and writes them to the file pointer
+// Each file path is written on its own line with a terminating backslash.
+status_t writePathsToFile(const sp<FilePathStore>& files, 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
+}
+
+status_t
+writeDependencyPreReqs(Bundle* bundle, const sp<AaptAssets>& assets, FILE* fp, bool includeRaw)
+{
+ status_t deps = -1;
+ deps += writePathsToFile(assets->getFullResPaths(), fp);
+ if (includeRaw) {
+ deps += writePathsToFile(assets->getFullAssetPaths(), fp);
+ }
+ return deps;
+}