Commit graph

20 commits

Author SHA1 Message Date
Colin Cross
71c5b95aa6 Support LOCAL_STATIC_JAVA_AAR_LIBRARIES with aapt2
LOCAL_STATIC_JAVA_AAR_LIBRARIES are slightly different from
LOCAL_STATIC_ANDROID_LIBRARIES, due to b/78447299 the
AndroidManifest.xml from ANDROID libraries are ignored.
Temporarily add support for LOCAL_STATIC_JAVA_AAR_LIBRARIES
when using LOCAL_USE_AAPT2 := true, treating them the same
as LOCAL_STATIC_ANDROID_LIBRARIES except that they are
merged by android_manifest.xml

Bug: 78447299
Bug: 79481102
Test: m FORCE_AAPT2=true checkbuild
Change-Id: Ia6210810c1ea6e776be97ae1c9a586b5de844125
2018-05-23 13:39:15 -07:00
Colin Cross
1465806ff2 Fix incorrect renderscript zip deps
Fix some incorrect dependencies after I12d33e52019aebac6ea33271939228e4690a4173.

Bug: 73885582
Test: m java FORCE_AAPT2=true
Change-Id: Ica2758991603e1605f629d843d19df5e2ef4fae1
2018-05-15 16:04:47 -07:00
Colin Cross
43c247e181 Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES
If a static android library lib1 has LOCAL_STATIC_ANDROID_LIBRARIES
lib2, then the R.class files for packages in lib2 will be merged
into the jar for lib1.  If an app has lib1 in its
LOCAL_STATIC_ANDROID_LIBRARIES it will get the R.class files from
lib2 through lib1, instead of regenerating the R.java files with
numbering that matches the resource table of the app.

This was worked around for support libraries by keeping a
fix_dependencies.mk that added transitive static support libraries
to the direct static dependencies of apps.  Instead, propagate
the packages that aapt2 generated R.java files for up as
--extra-packages arguments to the next aapt2 invocation, which
will force aapt2 to regenerate the R.java files for those packages.

Bug: 78300023
Test: m checkbuild
Change-Id: I7375e13241b4c4f2933032409fb7935abe133bfc
2018-05-02 13:11:08 -07:00
Colin Cross
f6d68cf6fe Use a srcjar for aapt and aapt2 output
Dumping files in the *_intermediates/src causes incremental build
problems, because we don't know when to delete them if they are
no longer generated.  Switch to outputting a srcjar instead, and
pass it in to the turbine and javac compiles.

Bug: 73885582
Test: m checkbuild
Change-Id: Ibef28507522339d930c09426d0c98372eb864cb6
Merged-In: Ibef28507522339d930c09426d0c98372eb864cb6
(cherry picked from commit 2d1cddd567)
2018-03-20 15:26:27 -07:00
Colin Cross
3f99cd5933 Replace extract_srcjars.sh with zipsync
Use zipsync instead of extract_srcjars.sh.

Also fixes an issue where unzipping a resource zip would
ignore anything that wasn't a *.java file.

Bug: 73885582
Test: m checkbuild
Change-Id: I1c25f65afa196614879071c8655866febebac185
2018-03-15 16:40:05 -07:00
Colin Cross
bc0c494d3a Allow aapt2 rules to take zipped resource files
Allow aapt2 rules to take zipped resource files similar to the
way the javac rules take srcjars.  For now, unzip the files using
extract_srcjars.sh, and then use aapt2 compile --dir.  Eventually
it could be done with aapt2 compile --zip.

Bug: 73885582
Bug: 74574557
Test: m checkbuild
Change-Id: I97ea3ff305e7a9ef2a908b4cf0bca903af62c6b1
2018-03-14 14:13:18 -07:00
Dan Willemsen
d927abe8a8 Clear some aapt2.mk inputs after use
my_generated_res_dirs wasn't being reset in some cases in between
different modules. To be safe, clear every input variable that I was sure
was not being used by the caller after aapt2.mk.

Test: m
Test: m ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Change-Id: I37c861d99637cad77a2a378a119bf66cee373b3a
2017-11-15 17:00:46 -08:00
Colin Cross
d5cce4c360 Remove PRODUCT_AAPT2_CFLAGS and PRODUCT_AAPT_FLAGS
PRODUCT_AAPT2_CFLAGS and PRODUCT_AAPT_FLAGS are only used to pass
--pseudo-localize.  The flag doesn't need to be conditional on the
product, because the pseudo locale will be stripped out later if it
is not wanted.  Having it conditional on the product causes the
AAPT2-compiled resources to vary between products, which causes
unnecessary rebuilds when swithcing products.

Remove the variables, always add --pseudo-localize, and move
the AAPT2 compiled output to the common intermediates.

Test: m checkbuild
Change-Id: Iacc914114616b5bd19d9a1011802f4f9bca9bc19
2017-10-27 16:25:55 -07:00
Dan Willemsen
ba9b0fbc05 Fix multiple output file generation for AAPT2
Make R.stamp actually part of the same rule that creates R.java.
Otherwise if the generated sources directory is removed, we don't
regenerate R.java / Manifest.java.

Also move the package-export.apk and proguard options file into the same
rule.

Test: m telephony-common; rm out/target/common/obj/*/*_intermediates/src; m telephony-common
Change-Id: I71f6fcaf20593ca23271d52d15537aaa9ef4cc77
2017-09-29 20:35:32 -07:00
Dan Willemsen
18ce90bce3 Merge "Add mising AAPT2 dependency" am: 25a4c9481b
am: ac47d13b2e

Change-Id: I1a56a0da5d328ba2037fba82db92c5cf55bd37aa
2017-06-08 16:18:24 +00:00
Dan Willemsen
c401a62d81 Add mising AAPT2 dependency
Bug: 33381544
Test: m clean; mma -j with a prebuilt aar using aapt2
Change-Id: Ie41def84aa35f3774abd6d713fb4a75d63a88876
2017-06-08 00:14:32 -07:00
Adam Lesinski
981de838d4 Add LOCAL_ASSET_DIR support (-A) to aapt2
Although performing the inclusion of assets/ at a later stage is
preferable, (since aapt just copies the files) do the easy thing and
support what aapt did. In the future perhaps we can zip up the
assets/ directories when also merging in the classes.dex.

Bug: 35461578
Change-Id: I7d7fde43333ea6455c4a1b9113bd25e1d88b7dd5
Test: manual
2017-03-16 04:53:05 +00:00
Adam Lesinski
7932676215 Revert "Add LOCAL_ASSET_DIR support (-A) to aapt2"
This reverts commit 996bc3ce7b.

Reason for revert: Need to update prebuilts, but prebuilts not built by server yet...

Change-Id: I87deb3ed9512278ff40c185059230dbd66524989
2017-03-15 07:00:41 +00:00
Adam Lesinski
996bc3ce7b Add LOCAL_ASSET_DIR support (-A) to aapt2
Although performing the inclusion of assets/ at a later stage is
preferable, (since aapt just copies the files) do the easy thing and
support what aapt did. In the future perhaps we can zip up the
assets/ directories when also merging in the classes.dex.

Bug: 35461578
Test: manual
Change-Id: I7cd36585e7c292e43b5528969900c6ead2b80c0b
2017-03-14 12:28:09 -07:00
Adam Lesinski
4c45205c99 Add split support for AAPT2
AAPT2 allows the declaration of a split path, so that build systems
don't need to guess the auto-generated name.

Construct the split path we want from the configurations passed in to
LOCAL_PACKAGE_SPLITS.

Bug:30445078
Change-Id: I06a4148b283d0c6751751ba116e9482c3a6eae5d
2016-08-15 13:13:23 -07:00
Ying Wang
75e962a87e Add --auto-add-overlay if a module has LOCAL_STATIC_ANDROID_LIBRARIES
Bug: 25958912
Change-Id: Iafba9eefde0823095775474bcb7cc5b6c21fd248
2016-03-02 18:55:46 -08:00
Adam Lesinski
e758f9319d AAPT2: Enable product/config filtering and improve source ordering
- Restore old ordering of resource files to match AAPT behavior
- Change the order in which overlays are processed.

Change-Id: I9da88f6b4124e7f89a70eb485b4591d5c4c87d38
2016-02-26 16:11:20 -08:00
Ying Wang
e295c3df68 AAPT2: library resource compilation
- Switch to static library's package-res.apk as the link artifact.
- For prebuilt AAR file, build package-res.apk using aapt2's "--dir"
  option.
- New LOCAL variables:
  LOCAL_USE_AAPT2: a module can opt-in with "LOCAL_USE_AAPT2 := true".
  LOCAL_STATIC_ANDROID_LIBRARIES: static Java libraries with compiled
                   resources.
  LOCAL_SHARED_ANDROID_LIBRARIES: shared Java libraries with compiled
                   resources.

Bug: 25958912
Change-Id: I4be2d1e8137555986338c2583cb39b0c97391751
2016-02-26 10:44:56 -08:00
Adam Lesinski
497888de8c Use --pseudo-localize only with compile phase in AAPT2
AAPT2 does pseudo-localization in compile phase. Passing --pseudo-localize
to the link phase causes an error.
Bug:25958912

Change-Id: I6ced0979884cb0d718018f995f9b2f6476d401cb
2016-01-26 12:17:32 -08:00
Ying Wang
dd71c85a45 Support to build with AAPT2
To build with AAPT2, set "USE_AAPT2=true".
TODO: Support split apks and generated resources from other than renderscript.

Bug: 25958912
Change-Id: I19b1a038824ce5b2a3d3ffadbce3173c845193fc
2016-01-25 22:41:43 -08:00