summaryrefslogtreecommitdiff
path: root/tools/aapt2/Main.cpp
AgeCommit message (Collapse)Author
2019-09-25Fix memory leak in aapt2Ryan Mitchell
Fix a memory leak in Main.cpp. Bug: 141312058 Test: m -j aapt2 SANITIZE_TARGET=address Change-Id: I54b61792ab75e2f59298dd38168653e496c84bff
2019-09-19aapt2: disable leak detectionSteven Moreland
When building with SANATIZE_HOST=address and ASAN_OPTIONS="" in order to test that leaks are removed from AIDL, was hitting leaks here. Explicitly setting ASAN_OPTIONS here so that we can detect leaks in other host tools. Bug: 141312058 Test: AIDL's runtests_asan.sh Change-Id: Ibc599ab75bbf63eab1c7747d17952390a7967e87
2019-04-17Add build number to aapt2 versionRyan Mitchell
This changes adds the build id to the version printed by "aapt2 version". This change also adds a field to the ResourceTable proto that specifies the fingerprints of tools used to build the table. Bug: 123663089 Test: manual Change-Id: Ifaf33c1e506b68e9f1d921fdbeddf36485e65790
2019-03-05Add --trace_folder to aapt2Fabien Sanglard
Add a tracing API and instrument key functions in order to profile aapt2 bottleneck. The API allows to generate systrace fragment files. Impact on performance is neglibible with each Trace requiring less than 1us and the final Flush operation at the end of a command requiring around 40us. Bug: None Test: None Change-Id: I51b564d3694e9384679f43b878b32295527dddf6
2018-10-09Created resuable DumpApkCommand and added "badger"Ryan Mitchell
This change refactors the dump commands to inherit from a base DumpApkCommand and adds a command that prints out an ASCII image of a badger if the user wrote "badger" instead of "badging". The command is hidden from the help menu. Bug: 73535002 Test: manual Change-Id: I9bdd8a7bbf6a4282c4933e5c478f6d1d8e32d99e
2018-08-14AAPT2: Reformatted dump command invocationsRyan Mitchell
Use with: aapt2 dump apc [apc] aapt2 dump configurations [apk] aapt2 dump strings [apk] aapt2 dump resources [apk] aapt2 dump xmlstrings [apk] --file [file] aapt2 dump xmltree [apk] --file [file] Will add permissions and badging in a later commit. Bug: 73351292 Test: Manual tests of the commands Change-Id: I97eec01222af14053a98bd70255f1bfecd16b1c4
2018-07-13AAPT2: Refactor flags into commandsRyan Mitchell
Refactors the flag based command invocation into classes that make using subcommands easier. Test: manual tests of printing Change-Id: Ic8df6af0be30db552e32150afebecbfeec7e1075
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-09-14AAPT2: Bump to version 2.19Adam Lesinski
Test: manual Bug: 65645766 Change-Id: Id8bdb14e498bd79ff642f9ad56ef05ec7a5825af
2017-08-25AAPT2: Change the daemon mode to be line basedAdam Lesinski
Accept a set of arguments separated by newlines. This avoids path separator conflicts with the argument format for passing splits. Test: manual Change-Id: Ia68122cb77b7dde2292a0fd953e79f02996ac01c
2017-08-24AAPT2: better error handling for daemon modeIzabela Orlowska
Test: manual Change-Id: Ia1997800ad94f386dbbb4195011395ecee1ba91f
2017-08-21AAPT2: Add a daemon modeAdam Lesinski
Gradle and other build tools that need to frequently interact with aapt2 can use the daemon mode to issue regular CLI commands without paying the process start cost for each invocation. Test: manual Change-Id: I543858ed46496278bad643f0dae688c924ec6c3f
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-10AAPT2: Bump version number to v2.18Adam Lesinski
Test: none Change-Id: I6e3b4c95a7d7ba416ba368e5b19782dbffa04fd8
2017-06-08AAPT2: Mark version 2.17 and update readmeAdam Lesinski
Test: none Change-Id: I6429b1c3acbcbf2244a5a5c95bc48a5d66bdaebe
2017-05-24AAPT2: Implement attribute compat versioningAdam Lesinski
This change defines some hardcoded rules to degrade attributes in newer SDKs to specific older attributes. An attribute with a degrade rule will generate a new XML for the API in which the attribute resulting from the degradation was introduced. Since API 22 (Lollipop MR1), attributes are correctly ignored and do not need to be versioned. In XML files defined for APIs 22+, the original and degraded attributes coexist in the same XML file. One such example is paddingHorizontal, introduced in API 26. paddingHorizontal degrades to paddingLeft and paddingRight, which were both introduced in API 1. Bug: 35763493 Test: make aapt2_tests Change-Id: I4aa8755a9ee2c0cc5afdc55c3d30093fd3a47f3d
2017-05-10AAPT2: Add option to disable PNG crunchingAdam Lesinski
When compiling, a developer may want to disable PNG crunching for a specific set of PNGs. Bug: 37729284 Test: manual Change-Id: I134f208f8bb212df07a4eef65b467985a6443375
2017-04-29Merge changes I446fb6ab,Ife3bbd29 into oc-devTreeHugger Robot
* changes: Valid resource IDs may be negative AAPT2: Workaround for findViewById with package ID > 0x7f
2017-04-28AAPT2: Workaround for findViewById with package ID > 0x7fAdam Lesinski
The entire View code base checks IDs against View.NO_ID except findViewById(), which checks to see if the ID is negative. Any package ID > 0x7f is interpreted as a negative number in Java (no unsigned ints), so this check prevents the use of IDs > 0x7f. findViewById is final, so support library workarounds are not possible. Instead, IDs (@id/foo) are just sentinels, their values don't matter. If building for pre-O devices, rewrite any references to these IDs of the for 0xPPTTEEEE, where PP > 7f, to 0x7fPPEEEE. The symbol table will check for potential collisions against the base APK, so this should be safe. Bug: 37498913 Test: manual Change-Id: Ife3bbd29db287757ef8a2ffd83053d97f1db2613
2017-04-28AAPT2: Error reporting through JNI.Chris Warrington
Rather than relying on stderr being wired correctly. Test: Tests for JNI integration in studio-master-dev. Change-Id: I1c7e7130bc4e56d61de259a9596bee3a6b3520fb
2017-04-10AAPT2: Share split functionality between link and optimizeAdam Lesinski
Generating splits should be possible to do from the optimize command. This means that a lot of infrastructure around split APKs can be shared by both the optimize and link phase. Bug: 35925830 Change-Id: Ia88b9e4bff300a56353b2f7a4a2547c8eb43a299 Test: manual
2017-03-29AAPT2: Parse an ID encoded as a mapAdam Lesinski
ID types should not be encoded as a map. AAPT and AAPT2 emit IDs as boolean types. Some apps exist that for some reason have their ID types encoded as empty maps. This is the case only for the auto generated IDs from enum values in <attr> tags. Allow IDs as maps and ignore their content when processing an APK for optimizing. Also fixes an issue with expected size of the ResTable_package struct. Bug: 35861796 Test: tested against the APK in b/35861796 Change-Id: I29a19cd9777bb10bed6766cd42e35e50e098797b
2017-03-20AAPT2: Fix up file IOAdam Lesinski
This also enables an AAPT behavior that CTS tests have come to depend on. Small files that compress negatively (get larger) are stored uncompressed. Some CTS tests assume this and try to open these files by mmapping them, which is only possible if they are uncompressed. Bug: 35461578 Test: make aapt2_tests Change-Id: Id622a6150fe72477ad65d67d1bad897a8ee2ffb9
2017-03-07AAPT2: Add --package-id flag for feature-split suppportAdam Lesinski
Bug: 35928935 Change-Id: Ia8496505e61cfcfdb8f9f62366d2f36e453db111 Test: make aapt2_tests
2017-02-22AAPT2: Rename strip phase to optimizeAdam Lesinski
- Allow resource deduping, version collapsing, and sparse resource encoding. Test: manual Change-Id: Ia4aa892ab5b06ba1d5ea4a6efb51b00bc3a980c4
2017-02-22AAPT2: Shared library supportAdam Lesinski
Test: make aapt2_tests Change-Id: I98dddf1367e6c0ac425bb20be46e6ff05f4f2f45
2017-02-08AAPT2: Fix pseudolocalization to respect <xliff:g>Adam Lesinski
The XLIFF 'g' tag specifies content that should NOT be translated. AAPT2's pseudolocalization process should respect it. Bug:34064599 Test: make libandroidfw_tests Change-Id: Ice437d7f0ff246730ee04896fd035e2d846148fb
2017-02-04Merge "AAPT2: Support CtsContentTestCases build"Adam Lesinski
2017-02-01AAPT2: Support CtsContentTestCases buildAdam Lesinski
- Add <feature-group> to ManifestFixer. - Support <meta-data> in <instrumentation> - Add support for <bag> and type="configVarying". Some CTS tests use this old notation, we need to support it (even though configVarying isn't anything supported by the framework convention). Change-Id: I6946fa633ce513ea8437c1496db883cf27dcf6de Test: make aapt2_tests
2017-02-01Backbone of the new aapt2 strip command.Pierre Lecesne
The strip command takes an APK as argument and a --target-densities flag which contains the list of screen densities for which to optimize the APK. All the resources that would be unused for a device having the given densities are stripped from the APK leaving only the ones actually being used. Test: Manual. Change-Id: I68368b00876a18ccdbbfc0a8dd265bd361117933
2017-01-24AAPT: Add --no-version-transitions flagYuichi Araki
Add a new flag to disable versioning of Transition related XMLs. Transition support library will use this to handle these XMLs on older API levels. Test: make libaapt_tests AaptTestAppOne Bug: 34427868 Change-Id: I66e81cca049e71ef6704177b2ca21c9cdeaff78f
2017-01-17Move StringPiece to libandroidfwAdam Lesinski
libandroidfw needs to make use of StringPiece, so move it to libandroidfw and update all code referencing StringPiece in aapt2. Test: make libandroidfw_tests libaapt2_tests Change-Id: I68d7f0fc7c651b048d9d1f5e7971f10ef5349fa1
2016-12-05AAPT2: Allow <meta-data> in <manifest>Adam Lesinski
Bug:32171613 Test: libaapt2_tests Change-Id: I30fdd9475ff7dff6ceb0ff46a4a00991b72db68b
2016-10-27Add font type to AAPT2Adam Lesinski
Test: make libaapt2_tests AaptTestAppOne Change-Id: I8fbf01675a218cc3c0b59598b6b1ec173851e946
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-10-19Use Google3 style guide with .clang-formatAdam Lesinski
Test: style change only, builds ok Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
2016-09-06AAPT2: Update version and readmeAdam Lesinski
Update version to 2.2 and update readme to reflect added support for inline complex XML resources. Change-Id: If825c96541952e95860d34390c6c36704a24129b
2016-08-15AAPT2: Expose split support to command lineAdam Lesinski
Bug:30445078 Change-Id: If4b8530dba71b9059b8e62c04757da99c1119d22
2016-07-26AAPT2: Add version info and release notesAdam Lesinski
Bug:30402888 Change-Id: Idb532cc71921eb1cfba31c00a6fb7108e31fddd8
2016-04-30AAPT2: Add diff commandAdam Lesinski
Adds the diff command and various small fixes to issues discovered when diffing old AAPT built APKs with new AAPT2 built APKS. Bug:22775504 Change-Id: I682a7fe1cf4b3efa7cbd5d18b333cf2d1046fe1b
2016-02-09AAPT2: Switch to protobuf for intermediate formatAdam Lesinski
Without needing to conform to the runtime data format, it is much easier to add new features such as debugging symbols and carrying over product data to link time. This also simplifies the runtime format parser and serializer, which will change much less frequently than the protobuf intermediate format. Change-Id: I209787bbf087db0a58a534cb8511c51d21133e00
2015-10-16AAPT2: Separate out the various stepsAdam Lesinski
An early refactor. Some ideas became clearer as development continued. Now the various phases are much clearer and more easily reusable. Also added a ton of tests! Change-Id: Ic8f0a70c8222370352e63533b329c40457c0903e
2015-06-12AAPT2: Remove the need for specifying package name in compile phaseAdam Lesinski
The compile phase doesn't use the AndroidManifest, so we had to specify the package name on the command line. We can omit the package name, since we don't resolve external references in the compile phase. Packages that reference the current package will be encoded with no package name. When loaded by the link phase, the package name will be supplied and all the references with no package name will use that one. Change-Id: I9fe4902b747b06899b45c968f30ba1aa05c5cd69
2015-06-09AAPT2: Proguard rules generation added.Adam Lesinski
Change-Id: Ifbe79516cd9a1ade471e211a259301c63b62ac67
2015-06-04AAPT2: Add manifest mergingAdam Lesinski
Now that AAPT2 is library-aware, it needs to take care of all library related work, including merging manifests. The logic was taken from the current Java ManifestMerger. Change-Id: Id93f713f27ae8617922bf89e325e45be9f863c06
2015-06-04AAPT2: Change xml file parsing to DOM basedAdam Lesinski
We modify the XML of layouts and AndroidManifest enough that it warrants we operate on the tree in memory. These files are never very large so this should be fine. Change-Id: I5d597abdb3fca2a203cf7c0b40fcd926aecb3137
2015-05-14AAPT2: Fix layout versioningAdam Lesinski
Change-Id: I37190cf8a1f0a81c068aeb2b5326b3b3080f75a5
2015-05-12AAPT2: Debug: Dump only targetted styleAdam Lesinski
Change-Id: Id7c5a4b5d0880520e1fea05e5a31d398946c5f05
2015-05-12AAPT2: inferred style parent processingAdam Lesinski
Change-Id: I8fbc4feef16b6039cf4c526fcfb767dc75a9c131
2015-05-12AAPT2: Support static lib referencing static libAdam Lesinski
When a static library A references static library B, and app C references both A and B, we get the following symbol merging, symbols from library B get imported twice. We must only check that symbol references to library B are valid when building library A. We should only merge all the symbols when building final app C. Change-Id: I23cba33b0901dcbb5328d9c9dfaa6a979c073c36