summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Link.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2017-12-08 16:06:10 -0800
committerAdam Lesinski <adamlesinski@google.com>2018-01-11 13:54:11 -0800
commit73bff1e8519bb73f17a801f45977d41b69b5b0d0 (patch)
tree9ac5f4e491ed617b6cefe118b91edb637c6c35a4 /tools/aapt2/cmd/Link.cpp
parent14c2ae4a6e62b78f2c994112d08dbe3d4de64695 (diff)
AAPT2: Allow compatible duplicate Attributes
If a resource XML file defines two compatible Attributes, they should be merged without throwing an error. Ex: <declare-styleable> <attr name="conflict" format="string" /> </declare-styleable> <declare-styleable> <attr name="conflict" format="string|reference" /> </declare-styleable> In this case, string|reference and string are the same, so these should merge correctly. Bug: 65699599 Test: make aapt2_tests Test: make AaptBasicTest Change-Id: I7b0f956d2332f7f0b458acd59ca0a606b2cfdf95
Diffstat (limited to 'tools/aapt2/cmd/Link.cpp')
-rw-r--r--tools/aapt2/cmd/Link.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index 72e07dc23725..c9e272c32eae 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -388,10 +388,8 @@ ResourceFileFlattener::ResourceFileFlattener(const ResourceFileFlattenerOptions&
// generated from the attribute definitions themselves (b/62028956).
if (const SymbolTable::Symbol* s = symm->FindById(R::attr::paddingHorizontal)) {
std::vector<ReplacementAttr> replacements{
- {"paddingLeft", R::attr::paddingLeft,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
- {"paddingRight", R::attr::paddingRight,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ {"paddingLeft", R::attr::paddingLeft, Attribute(android::ResTable_map::TYPE_DIMENSION)},
+ {"paddingRight", R::attr::paddingRight, Attribute(android::ResTable_map::TYPE_DIMENSION)},
};
rules_[R::attr::paddingHorizontal] =
util::make_unique<DegradeToManyRule>(std::move(replacements));
@@ -399,10 +397,8 @@ ResourceFileFlattener::ResourceFileFlattener(const ResourceFileFlattenerOptions&
if (const SymbolTable::Symbol* s = symm->FindById(R::attr::paddingVertical)) {
std::vector<ReplacementAttr> replacements{
- {"paddingTop", R::attr::paddingTop,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
- {"paddingBottom", R::attr::paddingBottom,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ {"paddingTop", R::attr::paddingTop, Attribute(android::ResTable_map::TYPE_DIMENSION)},
+ {"paddingBottom", R::attr::paddingBottom, Attribute(android::ResTable_map::TYPE_DIMENSION)},
};
rules_[R::attr::paddingVertical] =
util::make_unique<DegradeToManyRule>(std::move(replacements));
@@ -411,9 +407,9 @@ ResourceFileFlattener::ResourceFileFlattener(const ResourceFileFlattenerOptions&
if (const SymbolTable::Symbol* s = symm->FindById(R::attr::layout_marginHorizontal)) {
std::vector<ReplacementAttr> replacements{
{"layout_marginLeft", R::attr::layout_marginLeft,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ Attribute(android::ResTable_map::TYPE_DIMENSION)},
{"layout_marginRight", R::attr::layout_marginRight,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ Attribute(android::ResTable_map::TYPE_DIMENSION)},
};
rules_[R::attr::layout_marginHorizontal] =
util::make_unique<DegradeToManyRule>(std::move(replacements));
@@ -422,9 +418,9 @@ ResourceFileFlattener::ResourceFileFlattener(const ResourceFileFlattenerOptions&
if (const SymbolTable::Symbol* s = symm->FindById(R::attr::layout_marginVertical)) {
std::vector<ReplacementAttr> replacements{
{"layout_marginTop", R::attr::layout_marginTop,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ Attribute(android::ResTable_map::TYPE_DIMENSION)},
{"layout_marginBottom", R::attr::layout_marginBottom,
- Attribute(false, android::ResTable_map::TYPE_DIMENSION)},
+ Attribute(android::ResTable_map::TYPE_DIMENSION)},
};
rules_[R::attr::layout_marginVertical] =
util::make_unique<DegradeToManyRule>(std::move(replacements));