New conditional syntax is a logical AND, not OR. This means if a
resource should be conditionally kept by multiple ids, we need to
generate a separate rule for each condition (which will be interpreted
as OR).
Test: unit tests
Bug: 69341430
Change-Id: I0786c65561d36fbf43d181a2dfd0c7eaf1d96b8c
FileOutputStream is safe to use on Windows, as it opens
files using our compatibility API.
Bug: 68262818
Test: make aapt2_tests
Change-Id: Ib0b27e93edd609b49b1327db7d9867a002198ebb
Google's ProGuard fork is migrating to a new syntax that upstream
ProGuard 6.0 will also support.
Test: unit tests
Bug: 69162105
Change-Id: I3b6d7e82eb99c2e2af6c4d851a4f97ec3e471b55
Add the option to produce keep rules that conditional keep based on
usage of R identifiers. This allows Proguard to potentially shrink more
code if resources are not used.
Currently only produces conditional rules for classes referenced in
layout resources because they are the most common and has the easiest
transitive usage chain to analyze.
Bug: 63628451
Test: make aapt2_tests and manual testing
Change-Id: I6c1af7affd64af40c80e004d8506a9463444b2c3
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
<fragment> tags in layouts use the class attribute to determine which
Fragment subclass to load, and fallback on android:name if class is not
set.
AAPT2 only emitted a proguard rule for the class attribute for <fragment>,
when it should emit a proguard rule for the android:name attribute as
well.
AAPT2 didn't handle menu XML, so support for actionViewClass,
actionProviderClass and onClick is added.
Bug: 62216174
Test: make aapt2_tests
Change-Id: Ie8675c2bd899a5b51f3661eb0901ab8c9a16fd70
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
Aapt with -D option was not keeping the application and instrumentation
subclasses, which were instead handled by mainDexClasses.rules. Instead,
include them in the aapt -D output.
Change-Id: Ia3b89fc2edd45d379c4d06f0bf674716646fcb3d
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
Create an analogue of "aapt2 --proguard" which outputs a proguard
configuration that keeps only components which need to be in the main
dex.
Bug: 27383099
Change-Id: I61d652bfcdfc18e1614e852bd6f7540efd15f780