AAPT2: Merge Styleables instead of overriding them
Styleables merge in AAPT. Preserve this behavior.
Bug:30970091
Change-Id: Ie68ca675aeecd873c0648682182e2fc574e329a0
diff --git a/tools/aapt2/Resource.h b/tools/aapt2/Resource.h
index 09a04e0..2969b8c 100644
--- a/tools/aapt2/Resource.h
+++ b/tools/aapt2/Resource.h
@@ -82,6 +82,8 @@
ResourceName() : type(ResourceType::kRaw) {}
ResourceName(const StringPiece& p, ResourceType t, const StringPiece& e);
+ int compare(const ResourceName& other) const;
+
bool isValid() const;
std::string toString() const;
};
@@ -258,6 +260,15 @@
package(p.toString()), type(t), entry(e.toString()) {
}
+inline int ResourceName::compare(const ResourceName& other) const {
+ int cmp = package.compare(other.package);
+ if (cmp != 0) return cmp;
+ cmp = static_cast<int>(type) - static_cast<int>(other.type);
+ if (cmp != 0) return cmp;
+ cmp = entry.compare(other.entry);
+ return cmp;
+}
+
inline bool ResourceName::isValid() const {
return !package.empty() && !entry.empty();
}