Commit graph

17 commits

Author SHA1 Message Date
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