Loading tools/aapt2/compile/InlineXmlFormatParser.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -118,10 +118,11 @@ bool InlineXmlFormatParser::Consume(IAaptContext* context, xml::XmlResource* doc size_t name_suffix_counter = 0; for (const InlineDeclaration& decl : visitor.GetInlineDeclarations()) { auto new_doc = util::make_unique<xml::XmlResource>(); new_doc->file.config = doc->file.config; new_doc->file.source = doc->file.source.WithLine(decl.el->line_number); new_doc->file.name = doc->file.name; // Create a new XmlResource with the same ResourceFile as the base XmlResource. auto new_doc = util::make_unique<xml::XmlResource>(doc->file); // Attach the line number. new_doc->file.source.line = decl.el->line_number; // Modify the new entry name. We need to suffix the entry with a number to // avoid local collisions, then mangle it with the empty package, such that it won't show up Loading tools/aapt2/compile/InlineXmlFormatParser_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ TEST(InlineXmlFormatParserTest, ExtractOneXmlResource) { </View1>)"); doc->file.name = test::ParseNameOrDie("layout/main"); doc->file.type = ResourceFile::Type::kProtoXml; InlineXmlFormatParser parser; ASSERT_TRUE(parser.Consume(context.get(), doc.get())); Loading Loading @@ -81,6 +82,9 @@ TEST(InlineXmlFormatParserTest, ExtractOneXmlResource) { // Make sure the generated reference is correct. EXPECT_THAT(extracted_doc->file.name, Eq(name_ref)); // Make sure the ResourceFile::Type is the same. EXPECT_THAT(extracted_doc->file.type, Eq(ResourceFile::Type::kProtoXml)); // Verify the structure of the extracted XML. el = extracted_doc->root.get(); ASSERT_THAT(el, NotNull()); Loading Loading
tools/aapt2/compile/InlineXmlFormatParser.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -118,10 +118,11 @@ bool InlineXmlFormatParser::Consume(IAaptContext* context, xml::XmlResource* doc size_t name_suffix_counter = 0; for (const InlineDeclaration& decl : visitor.GetInlineDeclarations()) { auto new_doc = util::make_unique<xml::XmlResource>(); new_doc->file.config = doc->file.config; new_doc->file.source = doc->file.source.WithLine(decl.el->line_number); new_doc->file.name = doc->file.name; // Create a new XmlResource with the same ResourceFile as the base XmlResource. auto new_doc = util::make_unique<xml::XmlResource>(doc->file); // Attach the line number. new_doc->file.source.line = decl.el->line_number; // Modify the new entry name. We need to suffix the entry with a number to // avoid local collisions, then mangle it with the empty package, such that it won't show up Loading
tools/aapt2/compile/InlineXmlFormatParser_test.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ TEST(InlineXmlFormatParserTest, ExtractOneXmlResource) { </View1>)"); doc->file.name = test::ParseNameOrDie("layout/main"); doc->file.type = ResourceFile::Type::kProtoXml; InlineXmlFormatParser parser; ASSERT_TRUE(parser.Consume(context.get(), doc.get())); Loading Loading @@ -81,6 +82,9 @@ TEST(InlineXmlFormatParserTest, ExtractOneXmlResource) { // Make sure the generated reference is correct. EXPECT_THAT(extracted_doc->file.name, Eq(name_ref)); // Make sure the ResourceFile::Type is the same. EXPECT_THAT(extracted_doc->file.type, Eq(ResourceFile::Type::kProtoXml)); // Verify the structure of the extracted XML. el = extracted_doc->root.get(); ASSERT_THAT(el, NotNull()); Loading