summaryrefslogtreecommitdiff
path: root/tools/aapt2/xml/XmlDom_test.cpp
AgeCommit message (Collapse)Author
2018-03-01AAPT2: Allow to inline XML into custom attributeAdam Lesinski
Previously, doing something like <parent xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt"> <aapt:attr name="app:foo"> <child /> </aapt:attr> </parent> would result in something like: <parent xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" foo="@generated_name" /> while it should result in: <parent xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" app:foo="@generated_name" /> Bug: 36809755 Test: make aapt2_tests Change-Id: I72ea4b402e196ca05b53b788e4768a265190a0dc
2018-02-14AAPT2: Fix issue with deserializing binary XMLAdam Lesinski
We assumed that a raw text value set for an attribute meant there were no compiled values set either. This would only really happen for attributes that did not belong to any namespace (no prefix:), since we always kept their raw string values in case some code relied on it. Bug: 72700446 Test: make aapt2_tests Change-Id: Icba40a1d4b181bfe7cad73131c4dbe5ba7f8b085
2017-11-01AAPT2: Add convert commandAdam Lesinski
This command allows a developer to convert their proto APK (generated from the link phase using --proto-format) into a binary APK suitable for use on device. aapt2 convert -o output.apk input.apk Test: manual + make aapt2_tests Change-Id: I10a7c33bb4b57006d01fe00a8bf92f78e04e7e50
2017-10-19AAPT2: Define and Implement AAPT Container FormatAdam Lesinski
AAPT Container Format (.apc) is a simple container that enumerates the various intermediate files that AAPT2 generates during the compile phase. The format is defined in formats.md. For now, continue using the .flat extension for the container file, and keep making use of the .flata zip for storing multiple files. This will allow easier integration with existing build systems and allow the evolution of the APC format to better handle arbitrarily large files. Test: make aapt2_tests Change-Id: Id7216e5b76316bdd683f0fa4eaf2d2da273ba815
2017-10-04AAPT2: Move format related files under same directoryAdam Lesinski
Test: make aapt2_tests Change-Id: Id72cdfc12ba3add294048e60c55f2461344464bf
2017-10-03Merge "AAPT2: Preserve line numbers when deserializing from binary XML" into ↵Adam Lesinski
oc-mr1-dev am: 9b581c7bc1 am: 8284349fc9 Change-Id: Iadd7362ae8456279ebec3a4577ba5be0c8bf19d7
2017-10-02AAPT2: Preserve line numbers when deserializing from binary XMLAdam Lesinski
Bug: 65827146 Test: make aapt2_tests Change-Id: Idbfea640eb8727fe209ebc6eb072296845d9f282
2017-09-14AAPT2: Change XmlDom to exclude Namespace as a nodeAdam Lesinski
In preparation for exporting an XML proto format for UAM to consume, this change brings the XML DOM API more in line with other APIs that do not make the Namespace a separate node. Treating Namespace declarations as just properties of an Element node makes the implementation of algorithms much simpler, as the constraints that Namespace nodes have only one child are now built in and traversing to find Element nodes is much simpler. Also made a bunch of quality of life improvements, like formatting and comment style. Test: make aapt2_tests Bug: 65645766 Change-Id: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4 Merged-In: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
2017-09-14AAPT2: Fix windows unicode path issuesAdam Lesinski
Mingw64 was being difficult, so instead of defining a wmain entrypoint, the command line parameters are parsed manually using built-in Windows methods that support Unicode. The results are converted to UTF8 and handled just like the rest of the linux/mac version of the code. This also removes dependencies on std::istream in favour of a FileInputStream which calls the appropriate unicode version of open to read a file. No speed regressions found on Linux or MacOS. Bug: 62336414 Bug: 63830502 Bug: 65645766 Test: manual Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8 Merged-In: I597da51e33729ed1b98bf246e7e773337fd3fee8
2017-08-23AAPT2: Fixup namespace implementationAdam Lesinski
A few pieces were missing in the namespace mangling implementation. Namespace aware libraries now work, along with R class generation. Bug: 64706588 Test: make AaptTestNamespace_App Change-Id: I12f78d6aa909e782c0faf7ceaa36058f2e6c864a
2017-08-17AAPT2: Change XmlDom to exclude Namespace as a nodeAdam Lesinski
In preparation for exporting an XML proto format for UAM to consume, this change brings the XML DOM API more in line with other APIs that do not make the Namespace a separate node. Treating Namespace declarations as just properties of an Element node makes the implementation of algorithms much simpler, as the constraints that Namespace nodes have only one child are now built in and traversing to find Element nodes is much simpler. Also made a bunch of quality of life improvements, like formatting and comment style. Test: make aapt2_tests Change-Id: Ib97ff1c4252b7907e2cc1f13a448dc4ca3b809a4
2017-08-03AAPT2: Fix windows unicode path issuesAdam Lesinski
Mingw64 was being difficult, so instead of defining a wmain entrypoint, the command line parameters are parsed manually using built-in Windows methods that support Unicode. The results are converted to UTF8 and handled just like the rest of the linux/mac version of the code. This also removes dependencies on std::istream in favour of a FileInputStream which calls the appropriate unicode version of open to read a file. No speed regressions found on Linux or MacOS. Bug: 62336414 Bug: 63830502 Test: manual Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
2017-07-07AAPT2: Fix processing of quotes in XMLAdam Lesinski
When processing attributes in XML, quotes can't be used to mark a section as whitespace preserving, so the assumption should be that the entire string is whitespace preserving, which makes quote characters literals. Bug: 62840718 Bug: 62840406 Test: make aapt2_tests Change-Id: I4afff02148b5b8e78833abf1f323c2f5325d6155
2017-06-09AAPT2: Clean up tests a bitAdam Lesinski
Since the latest gtest has fixed support for explicit bool operators, remvoe AAPT_ASSERT_* and AAPT_EXPECT_*. Also switch to use NotNull() matchers, which are more legible. Test: make aapt2_tests Change-Id: Idce199ca9d567d70f7aae275fee15e04bb914c9e
2017-04-28AAPT2: Fix string escapingAdam Lesinski
We were processing escaped strings too early, before parsing of values into types. Now the escaped strings get processed when they are being flattened. Bug: 37715376 Test: make aapt2_tests Change-Id: Ic59aa2e3a20c40756c219752ff74b2a4f8a602ba
2017-03-02AAPT2: Fix escaping sequence processing in XML parsingAdam Lesinski
Bug: 35483813 Test: make aapt2_tests Change-Id: I68baba17ab3639c220b734a2a68d86aad0dedf8c
2016-10-26AAPT2: Rename to match new styleAdam Lesinski
Use Google3 naming style to match new projects' and open source google projects' style. Preferred to do this in a massive CL so as to avoid style inconsistencies that plague legacy code bases. This is a relatively NEW code base, may as well keep it up to date. Test: name/style refactor - existing tests pass Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
2016-07-13AAPT2: Remove usage of u16stringAdam Lesinski
For legacy reasons, we kept around the use of UTF-16 internally in AAPT2. We don't need this and this CL removes all instances of std::u16string and StringPiece16. The only places still needed are when interacting with the ResTable APIs that only operate in UTF16. Change-Id: I492475b84bb9014fa13bf992cff447ee7a5fe588
2015-11-19AAPT2: Fail compiling when private symbols are referencedAdam Lesinski
Also moved some XML specific stuff into its own directory, and refactored ReferenceLinker a bit. Change-Id: I912247a82023c1bbf72dc191fbdaf62858cbec0c