summaryrefslogtreecommitdiffstats
path: root/tools/aapt2/ResourceTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/ResourceTable.cpp')
-rw-r--r--tools/aapt2/ResourceTable.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp
index 02be651..9468860 100644
--- a/tools/aapt2/ResourceTable.cpp
+++ b/tools/aapt2/ResourceTable.cpp
@@ -299,16 +299,12 @@ bool ResourceTable::markPublic(const ResourceNameRef& name, const ResourceId res
type->publicStatus.isPublic = true;
entry->publicStatus.isPublic = true;
+ entry->publicStatus.source = source;
if (resId.isValid()) {
type->typeId = resId.typeId();
entry->entryId = resId.entryId();
}
-
- if (entry->values.empty()) {
- entry->values.push_back(ResourceConfigValue{ {}, source, {},
- util::make_unique<Sentinel>() });
- }
return true;
}
@@ -318,12 +314,16 @@ bool ResourceTable::merge(ResourceTable&& other) {
for (auto& otherType : other) {
std::unique_ptr<ResourceTableType>& type = findOrCreateType(otherType->type);
- if (type->publicStatus.isPublic && otherType->publicStatus.isPublic &&
- type->typeId != otherType->typeId) {
- Logger::error() << "can not merge type '" << type->type << "': conflicting public IDs "
- << "(" << type->typeId << " vs " << otherType->typeId << ")."
- << std::endl;
- return false;
+ if (otherType->publicStatus.isPublic) {
+ if (type->publicStatus.isPublic && type->typeId != otherType->typeId) {
+ Logger::error() << "can not merge type '" << type->type
+ << "': conflicting public IDs "
+ << "(" << type->typeId << " vs " << otherType->typeId << ")."
+ << std::endl;
+ return false;
+ }
+ type->publicStatus = std::move(otherType->publicStatus);
+ type->typeId = otherType->typeId;
}
for (auto& otherEntry : otherType->entries) {
@@ -335,13 +335,16 @@ bool ResourceTable::merge(ResourceTable&& other) {
}
std::unique_ptr<ResourceEntry>& entry = findOrCreateEntry(type, *nameToAdd);
- if (entry->publicStatus.isPublic && otherEntry->publicStatus.isPublic &&
- entry->entryId != otherEntry->entryId) {
- Logger::error() << "can not merge entry '" << type->type << "/" << entry->name
- << "': conflicting public IDs "
- << "(" << entry->entryId << " vs " << entry->entryId << ")."
- << std::endl;
- return false;
+ if (otherEntry->publicStatus.isPublic) {
+ if (entry->publicStatus.isPublic && entry->entryId != otherEntry->entryId) {
+ Logger::error() << "can not merge entry '" << type->type << "/" << entry->name
+ << "': conflicting public IDs "
+ << "(" << entry->entryId << " vs " << entry->entryId << ")."
+ << std::endl;
+ return false;
+ }
+ entry->publicStatus = std::move(otherEntry->publicStatus);
+ entry->entryId = otherEntry->entryId;
}
for (ResourceConfigValue& otherValue : otherEntry->values) {