diff options
author | 2011-10-13 16:26:02 -0700 | |
---|---|---|
committer | 2011-10-16 11:52:17 -0700 | |
commit | e6b680364dd992907a8d2037685a2e500d188dfb (patch) | |
tree | 3d931a3139f058da9ae934e5cf50cd6dc50f7e64 /tools/aapt/Resource.cpp | |
parent | d814d4fa0c76a0384f7e32816e1ca36f237911c6 (diff) |
New aapt feature to do smarter filtering of configurations.
This adds a --preferred-configurations flag that specifies the
specific configurations you would like to have.
It is smarter than "-c" because it will avoid stripping a
configuration if that would result in there being no value
for the resource.
It is dumber than "-c" because it can't process as many kinds
of resources. It is really only intended for bitmaps and use
with density configs.
This required re-arranging AaptAssets to group files together
by config again, like they used to be. I think this hasn't
broken anything. Hopefully.
Change-Id: I4e9d12ff6e6dbd1abb8fd4cb1814c6674b19d0e5
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r-- | tools/aapt/Resource.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 2e796a2f66aa..887fa7465be9 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -352,18 +352,27 @@ static void collect_files(const sp<AaptDir>& dir, if (index < 0) { sp<ResourceTypeSet> set = new ResourceTypeSet(); + NOISY(printf("Creating new resource type set for leaf %s with group %s (%p)\n", + leafName.string(), group->getPath().string(), group.get())); set->add(leafName, group); resources->add(resType, set); } else { sp<ResourceTypeSet> set = resources->valueAt(index); index = set->indexOfKey(leafName); if (index < 0) { + NOISY(printf("Adding to resource type set for leaf %s group %s (%p)\n", + leafName.string(), group->getPath().string(), group.get())); set->add(leafName, group); } else { sp<AaptGroup> existingGroup = set->valueAt(index); - int M = files.size(); - for (int j=0; j<M; j++) { - existingGroup->addFile(files.valueAt(j)); + NOISY(printf("Extending to resource type set for leaf %s group %s (%p)\n", + leafName.string(), group->getPath().string(), group.get())); + for (size_t j=0; j<files.size(); j++) { + NOISY(printf("Adding file %s in group %s resType %s\n", + files.valueAt(j)->getSourceFile().string(), + files.keyAt(j).toDirName(String8()).string(), + resType.string())); + status_t err = existingGroup->addFile(files.valueAt(j)); } } } @@ -378,9 +387,12 @@ static void collect_files(const sp<AaptAssets>& ass, for (int i=0; i<N; i++) { sp<AaptDir> d = dirs.itemAt(i); + NOISY(printf("Collecting dir #%d %p: %s, leaf %s\n", i, d.get(), d->getPath().string(), + d->getLeaf().string())); collect_files(d, resources); // don't try to include the res dir + NOISY(printf("Removing dir leaf %s\n", d->getLeaf().string())); ass->removeDir(d->getLeaf()); } } @@ -570,7 +582,7 @@ static bool applyFileOverlay(Bundle *bundle, size_t baseFileIndex = baseGroup->getFiles().indexOfKey(overlayFiles. keyAt(overlayGroupIndex)); - if(baseFileIndex < UNKNOWN_ERROR) { + if (baseFileIndex < UNKNOWN_ERROR) { if (bundle->getVerbose()) { printf("found a match (%zd) for overlay file %s, for flavor %s\n", baseFileIndex, @@ -580,6 +592,11 @@ static bool applyFileOverlay(Bundle *bundle, baseGroup->removeFile(baseFileIndex); } else { // didn't find a match fall through and add it.. + if (true || bundle->getVerbose()) { + printf("nothing matches overlay file %s, for flavor %s\n", + overlayGroup->getLeaf().string(), + overlayFiles.keyAt(overlayGroupIndex).toString().string()); + } } baseGroup->addFile(overlayFiles.valueAt(overlayGroupIndex)); assets->addGroupEntry(overlayFiles.keyAt(overlayGroupIndex)); |