summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceTable.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2015-10-13 11:37:10 -0700
committerAdam Lesinski <adamlesinski@google.com>2015-10-16 15:50:58 -0700
commit9ba47d813075fcb05c5e1532c137c93b394631cb (patch)
tree1eb9f7adc315ab8ad640249f8ac1888951520f3f /tools/aapt2/ResourceTable.cpp
parent072c5bdff77e354bdf333c0c1d460cdd1c2e76ae (diff)
Filter products during compile phase
Unfortunately there is no good way to deal with products in the link phase. Products are like preprocessor defines in that they are processed early and change the composition of the compiled unit. Change-Id: I6d5e15ef60d29df8e83e059ba857c09333993779
Diffstat (limited to 'tools/aapt2/ResourceTable.cpp')
-rw-r--r--tools/aapt2/ResourceTable.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp
index a1e7d36d91d9..e32fb5ee22ea 100644
--- a/tools/aapt2/ResourceTable.cpp
+++ b/tools/aapt2/ResourceTable.cpp
@@ -62,17 +62,17 @@ ResourceTablePackage* ResourceTable::findPackageById(uint8_t id) {
return nullptr;
}
-ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, uint8_t id) {
+ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, Maybe<uint8_t> id) {
ResourceTablePackage* package = findOrCreatePackage(name);
- if (!package->id) {
+ if (id && !package->id) {
package->id = id;
return package;
}
- if (package->id.value() == id) {
- return package;
+ if (id && package->id && package->id.value() != id.value()) {
+ return nullptr;
}
- return nullptr;
+ return package;
}
ResourceTablePackage* ResourceTable::findOrCreatePackage(const StringPiece16& name) {