Commit Graph

14 Commits

Author SHA1 Message Date
Ryan Mitchell
05aebf46b4 Preserve compression of xml files in convert
Respect the compression the original compression of xml files when using
aapt2 convert. Uncompressed files should remain uncompressed, and
compressed files should remain compressed.

Bug: 117289326
Test: manual
Change-Id: I81b431b4a4abd81f5694ea7dc3b3c6ec8c13ca32
2018-10-11 17:14:29 -07:00
Ryan Mitchell
e0eba7a3bb AAPT2: Increase maximum proto size
Deserializing a proto form a string throws an error when 64MB have been
read from the stream. This change removes the maximum size but shows a
warning when a proto is larger than 64MB.

Bug: 114020398
Test: manual test with resources.pb greater than 64MB
Change-Id: Iee397b6709d79a9338133a6136fe6e8f70a4964c
2018-09-12 08:54:07 -07:00
Ryan Mitchell
f3649d6690 AAPT2: Compile --zip flag
Added a --zip flag similar to --dir that allows resources to be passed
into "aapt2 compile" using a zip file.

Also refactored Compile.cpp to be easier to mock and test in the future.

Bug: 74574557
Test: aapt2_tests
Change-Id: Idb90cb97e23a219525bdead38220cbf7bc6f3cab
2018-08-14 15:42:01 -07:00
Chris Warrington
58e2fbf169 Revert "AAPT2: Automatic Static Library Namespacing."
This reverts commit 481f027ddc.

Reason for revert: Not needed any more

Bug: 111543815
Test: existing unit and integration tests
Change-Id: I87b039192682636d81c2d33512495cb005c9504d
2018-07-23 17:23:25 +01:00
Ryan Mitchell
833a1a6c4a AAPT2: Refactor flags into commands
Refactors the flag based command invocation into classes that make using
subcommands easier.

Test: manual tests of printing
Change-Id: Ic8df6af0be30db552e32150afebecbfeec7e1075
2018-07-13 14:26:06 -07:00
Ryan Mitchell
a15c2a8957 Check the size of the strings in the StringPool before flattening.
Test: Tested for normal functionality when string does not exceed
maximum length and tests for detection of string that is too lonhg for
UTF8i
Bug: b/74176037

Change-Id: Ic71d3671a069e7012e8ca107e79e071499eebbf6
2018-03-29 15:42:13 -07:00
Chris Warrington
481f027ddc AAPT2: Automatic Static Library Namespacing.
Introduces a link flag --auto-namespace-static-lib for use when linking
static libraries.

When linking a static library with compiled sources that have references
to resources in provided libraries without an explicit package name,
the flag enables automatic inference of the package.

If a resource is present in the package that is being compiled, that is
used, otherwise the reference is rewritten to the highest precedence
resource with matching name and type.

Test: m out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests && \
      $ANDROID_HOST_OUT/nativetest64/aapt2_tests/aapt2_tests
Test: m frameworks/base/tools/aapt2/integration-tests
Change-Id: I6c6017e054654d1f60782d0a428a7a2a47f8952b
2018-03-14 15:05:39 +00:00
Adam Lesinski
bbf429795d AAPT2: Fix issue with deserializing binary XML
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
2018-02-14 16:11:23 -08:00
David Chaloupka
b66db4ec4c Adjust file reference type in 'aapt2 convert'
When converting between binary and proto APKs in either direction, the
'aapt2 convert' command did not adjust FileReference type for entries
inside the resource table. This fix makes in-place changes of the resource
table passed to ConvertApk, which is safe since the resource table is
thrown away after the conversion.

Bug: 71854843
Test: Manual
Change-Id: Ide6e141269392db15b399db3566f18175f5133d5
2018-01-17 11:07:44 +00:00
Tom Dobek
725fb12c0d Aapt2 convert: skip processing resources when resource table is absent.
Test: manual

Change-Id: Iafe20f98857a29d625e7a57a9201db6279d43e45
2017-12-11 10:30:12 +00:00
Pierre Lecesne
d8b4beaae9 AAPT2 - Add ProtoApkSerializer implementation to convert from Binary to Proto.
Also new flag to choose the conversion direction:
  --output_format [binary|proto].

Test: Manual

Change-Id: I61d381aa49869b0fd6bd9f017dda0cac5ca998bb
2017-11-14 09:05:27 +00:00
Pierre Lecesne
d55bef78a5 AAPT2 - Convert command to copy all the files.
Test: Manual

Change-Id: I8705966cb34ff41eb362126a35956720147fae91
2017-11-13 21:07:34 +00:00
Pierre Lecesne
7e8549dd57 Refactor Convert command to use a ISerializer interface.
This will allow for other implementations.

Test: Manual

Change-Id: Ibf9cf8f5ac2b5b8e51a5fb684b434a0f59a3cbee
2017-11-10 05:04:48 +00:00
Adam Lesinski
8780eb6e49 AAPT2: Add convert command
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-11-01 10:58:28 -07:00