summaryrefslogtreecommitdiff
path: root/tools/aapt2/java
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/java
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/java')
-rw-r--r--tools/aapt2/java/JavaClassGenerator_test.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/tools/aapt2/java/JavaClassGenerator_test.cpp b/tools/aapt2/java/JavaClassGenerator_test.cpp
index 5beb594bd92f..e449546f9399 100644
--- a/tools/aapt2/java/JavaClassGenerator_test.cpp
+++ b/tools/aapt2/java/JavaClassGenerator_test.cpp
@@ -57,7 +57,7 @@ TEST(JavaClassGeneratorTest, TransformInvalidJavaIdentifierCharacter) {
.SetPackageId("android", 0x01)
.AddSimple("android:id/hey-man", ResourceId(0x01020000))
.AddValue("android:attr/cool.attr", ResourceId(0x01010000),
- test::AttributeBuilder(false).Build())
+ test::AttributeBuilder().Build())
.AddValue("android:styleable/hey.dude", ResourceId(0x01030000),
test::StyleableBuilder()
.AddItem("android:attr/cool.attr", ResourceId(0x01010000))
@@ -229,10 +229,8 @@ TEST(JavaClassGeneratorTest, EmitOtherPackagesAttributesInStyleable) {
test::ResourceTableBuilder()
.SetPackageId("android", 0x01)
.SetPackageId("com.lib", 0x02)
- .AddValue("android:attr/bar", ResourceId(0x01010000),
- test::AttributeBuilder(false).Build())
- .AddValue("com.lib:attr/bar", ResourceId(0x02010000),
- test::AttributeBuilder(false).Build())
+ .AddValue("android:attr/bar", ResourceId(0x01010000), test::AttributeBuilder().Build())
+ .AddValue("com.lib:attr/bar", ResourceId(0x02010000), test::AttributeBuilder().Build())
.AddValue("android:styleable/foo", ResourceId(0x01030000),
test::StyleableBuilder()
.AddItem("android:attr/bar", ResourceId(0x01010000))
@@ -290,7 +288,7 @@ TEST(JavaClassGeneratorTest, CommentsForSimpleResourcesArePresent) {
TEST(JavaClassGeneratorTest, CommentsForEnumAndFlagAttributesArePresent) {}
TEST(JavaClassGeneratorTest, CommentsForStyleablesAndNestedAttributesArePresent) {
- Attribute attr(false);
+ Attribute attr;
attr.SetComment(StringPiece("This is an attribute"));
Styleable styleable;
@@ -375,7 +373,7 @@ TEST(JavaClassGeneratorTest, StyleableAndIndicesAreColocated) {
}
TEST(JavaClassGeneratorTest, CommentsForRemovedAttributesAreNotPresentInClass) {
- Attribute attr(false);
+ Attribute attr;
attr.SetComment(StringPiece("removed"));
std::unique_ptr<ResourceTable> table =
@@ -413,7 +411,7 @@ TEST(JavaClassGeneratorTest, GenerateOnResourcesLoadedCallbackForSharedLibrary)
std::unique_ptr<ResourceTable> table =
test::ResourceTableBuilder()
.SetPackageId("android", 0x00)
- .AddValue("android:attr/foo", ResourceId(0x00010000), util::make_unique<Attribute>(false))
+ .AddValue("android:attr/foo", ResourceId(0x00010000), util::make_unique<Attribute>())
.AddValue("android:id/foo", ResourceId(0x00020000), util::make_unique<Id>())
.AddValue(
"android:style/foo", ResourceId(0x00030000),