summaryrefslogtreecommitdiff
path: root/tools/aapt/AaptAssets.cpp
diff options
context:
space:
mode:
author Xavier Ducrohet <xav@android.com> 2011-07-19 10:03:16 -0700
committer Android Code Review <code-review@android.com> 2011-07-19 10:03:16 -0700
commitd40c93f61ca5b3f2351b8db716f67b58f1625e85 (patch)
tree49a75df29d44fe6f3d69635f40f91c7dacf54d38 /tools/aapt/AaptAssets.cpp
parent42755155d6e8ddc3201b08def2bf262a64fa25f2 (diff)
parent9bf34ca6f85309c65b0ebdf614cb8266401b49ba (diff)
Merge "Add dependency generation to Aapt for R.java"
Diffstat (limited to 'tools/aapt/AaptAssets.cpp')
-rw-r--r--tools/aapt/AaptAssets.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/aapt/AaptAssets.cpp b/tools/aapt/AaptAssets.cpp
index 2b2ec7b3e9a7..9c5a51400465 100644
--- a/tools/aapt/AaptAssets.cpp
+++ b/tools/aapt/AaptAssets.cpp
@@ -1393,10 +1393,10 @@ status_t AaptDir::addLeafFile(const String8& leafName, const sp<AaptFile>& file)
}
ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
- const AaptGroupEntry& kind, const String8& resType)
+ const AaptGroupEntry& kind, const String8& resType,
+ sp<FilePathStore>& fullResPaths)
{
Vector<String8> fileNames;
-
{
DIR* dir = NULL;
@@ -1419,9 +1419,14 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
if (isHidden(srcDir.string(), entry->d_name))
continue;
- fileNames.add(String8(entry->d_name));
+ String8 name(entry->d_name);
+ fileNames.add(name);
+ // Add fully qualified path for dependency purposes
+ // if we're collecting them
+ if (fullResPaths != NULL) {
+ fullResPaths->add(srcDir.appendPathCopy(name));
+ }
}
-
closedir(dir);
}
@@ -1448,7 +1453,7 @@ ssize_t AaptDir::slurpFullTree(Bundle* bundle, const String8& srcDir,
notAdded = true;
}
ssize_t res = subdir->slurpFullTree(bundle, pathName, kind,
- resType);
+ resType, fullResPaths);
if (res < NO_ERROR) {
return res;
}
@@ -1680,7 +1685,7 @@ ssize_t AaptAssets::slurpFromArgs(Bundle* bundle)
sp<AaptDir> assetAaptDir = makeDir(String8(kAssetDir));
AaptGroupEntry group;
count = assetAaptDir->slurpFullTree(bundle, assetRoot, group,
- String8());
+ String8(), mFullResPaths);
if (count < 0) {
totalCount = count;
goto bail;
@@ -1711,6 +1716,7 @@ ssize_t AaptAssets::slurpFromArgs(Bundle* bundle)
sp<AaptAssets> nextOverlay = new AaptAssets();
current->setOverlay(nextOverlay);
current = nextOverlay;
+ current->setFullResPaths(mFullResPaths);
}
count = current->slurpResourceTree(bundle, String8(res));
@@ -1753,7 +1759,7 @@ ssize_t AaptAssets::slurpFromArgs(Bundle* bundle)
* guarantees about ordering, so we're okay with an inorder search
* using whatever order the OS happens to hand back to us.
*/
- count = slurpFullTree(bundle, assetRoot, AaptGroupEntry(), String8());
+ count = slurpFullTree(bundle, assetRoot, AaptGroupEntry(), String8(), mFullResPaths);
if (count < 0) {
/* failure; report error and remove archive */
totalCount = count;
@@ -1779,9 +1785,10 @@ bail:
ssize_t AaptAssets::slurpFullTree(Bundle* bundle, const String8& srcDir,
const AaptGroupEntry& kind,
- const String8& resType)
+ const String8& resType,
+ sp<FilePathStore>& fullResPaths)
{
- ssize_t res = AaptDir::slurpFullTree(bundle, srcDir, kind, resType);
+ ssize_t res = AaptDir::slurpFullTree(bundle, srcDir, kind, resType, fullResPaths);
if (res > 0) {
mGroupEntries.add(kind);
}
@@ -1843,7 +1850,7 @@ ssize_t AaptAssets::slurpResourceTree(Bundle* bundle, const String8& srcDir)
if (type == kFileTypeDirectory) {
sp<AaptDir> dir = makeDir(String8(entry->d_name));
ssize_t res = dir->slurpFullTree(bundle, subdirName, group,
- resType);
+ resType, mFullResPaths);
if (res < 0) {
count = res;
goto bail;