summaryrefslogtreecommitdiff
path: root/java/aapt2.go
AgeCommit message (Collapse)Author
2024-10-22Add support for .flat files with flags in the directory Jihoon Kang
aapt2 allows flagging the resource file by specifying the name of the flag in the directory, such as `res/flag(test.package.myFlag)/values/bools.xml`, in which aapt2 will generate files like `values_bools.(test.package.myFlag).arsc.flat`. This change adds support for such aapt2 generated flagged resource files. Test: Patch ag/29931886 && ag/29501772 && m Bug: 374827548 Change-Id: I0ea6d6f747ad008c8f2a554a192196dc59f0c1a8
2024-07-16Support aapt2 resources flagging Jihoon Kang
This change modifies the aconfig and aapt2 build rules to support resources flagging in aapt2. Implementation details: - Modify the aconfig text rule to include flag permission in the output text file - Pass the `--flags-packages` argument to `aapt2 compile` command, similar to what is currently being done in the `aapt2 link` command Bug: 344979955 Test: m nothing --no-skip-soong-tests Change-Id: I3b0b1fd6dcd691b7cc50ba3d081ecafd82c2c904
2023-12-08Merge changes from topic "aconfig_dump_map" into main am: 25c187cc7d am: ↵ Jihoon Kang
1ed5d5ca20 am: 1befeeb5e8 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2854663 Change-Id: I18069b9fa74f1c72527bff397c61bc5510e7a684 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-07Add aconfig flag support for android_app Jihoon Kang
This change adds an overrideable property flags_packages to android_app, which is used to list the aconfig_declarations module names that the app depends on. The build action of android_app is modified to pass all flags text file provided by the aconfig_declarations to aapt2 link as --feature-flags arguments. Test: m nothing --no-skip-soong-tests Bug: 306024510 Change-Id: I4924f88b9954950cc1936a472cd7ac70f41add5d
2023-11-17Merge "Add support for auto-generated characteristics RRO" into main am: ↵ Inseob Kim
b5d713f2cb am: 99913d4e59 am: 6b52e7aabe Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2817177 Change-Id: I7bca74e210529ae6c2fbcb7746e06b7d4a493e8c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17Add support for auto-generated characteristics RRO Inseob Kim
Setting Generate_product_characteristics_rro will automatically generate an RRO package which contains resources with 'product="{PRODUCT_CHARACTERISTICS}"'. The RRO package will be installed to /product partition. The app will be compiled with '--product default', making the app identical to all targets. Motivation for this change is to minimize divergence of system.img. Bug: 294799593 Test: boot and idmap2 dump Change-Id: I1371f7410a1ecf337e1f73214b024af39aa6d57a
2023-08-08Merge "Don't generate aapt2 srcjars when using resource processor" into main ↵ Colin Cross
am: 002764c8ee am: 1a436c9b61 am: c2bb066321 am: 005bef73b0 am: e6c9c91cb9 Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2690449 Change-Id: Ia0223900eac77f27ae8cce63607f523c434d8217 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-03Merge "Delete aapt2 generated java files after creating srcjars" into main ↵ Colin Cross
am: 482ccfab04 am: b5c37f9bac am: 10ecc7ed1e am: 815ac4eaad am: ed4697d11b Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2690453 Change-Id: I27a1a17b44c585cbf998f04877305fe6bf43d203 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-02Don't generate aapt2 srcjars when using resource processor Colin Cross
When using resource processor the R.class files are generated directly, and the R.java files generated by aapt2 are unused. These files can huge, reaching 500 MB for some modules and 76 GB across all modules for a checkbuild on internal main. They will be deleted after zipping into srcjars after Ie5143e1e4b36ca1f4e45b001d79aca5379063517, but we can skip generating them completely for modules where resource processor is used. Bug: 284023594 Bug: 294285775 Test: m checkbuild Change-Id: If5e3fd1d25c6c7860898776ecdd392be8850c17c
2023-08-02Delete aapt2 generated java files after creating srcjars Colin Cross
The R.java files generated by aapt2 are unused after they are zipped into srcjars. These files can huge, reaching 500 MB for some modules and 76 GB across all modules for a checkbuild on internal main. Delete the R.java files after after zipping them into srcjars. Bug: 294285775 Test: m checkbuild Change-Id: Ie5143e1e4b36ca1f4e45b001d79aca5379063517
2023-08-02Enable compact entries for resource shrunken apps Rico Wind
For SystemUIGoogle this is a 2.3 MB reduction (17* of resources arsc) and for Traceur it is a 500k reduction (22% of resources.arsc) Bug: 294016857 Test: Existing Ignore-AOSP-First: The resource system support for this is not in AOSP yet Change-Id: I513078406494ad354c255afa0e829cbe10a9b07a
2022-09-23Add soong support for resource shrinking Rico Wind
This adds a new flag to the optimize section to allow invoking the resource shrinker Bug: 246217952 Test: m Change-Id: I2e7851af1189db2a6adf6f9f9f444a1d7f3a8d60
2020-11-30Improve comments in java/aapt2.go Jaewoong Jung
Test: N/A Change-Id: I4b35a7c8707b9c4b173bb4587f7634e570d78674
2020-01-16Add rules to handle asset resources. Jaewoong Jung
AAPT2 ignores assets in overlay resource inputs, so separate rules are required to extract and merge assets from dependencies. Test: app_test.go Test: Added assets to Settings-core for testing Test: Confirmed Settings.apk contains them with this change. Fixes: 146655310 Change-Id: Iab8bc61b719541dae64f0e3502bc9cb45a353687
2019-09-29Move sharding functions for reuse Colin Cross
Move shardPaths and shardTests to android.ShardPaths and android.ShardStrings for reuse in other packages. Test: m checkbuild Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
2019-06-22Don't pass --legacy by default to aapt2 compile Colin Cross
Don't pass --legacy by default, it is rarely necessary and converts some errors into warnings that crash at runtime. The modules that need it have had --legacy added to aaptflags. Bug: 135597368 Test: m java Change-Id: Ib05a07ead4084dd32ba28df26708d81bb53f2f2a
2019-06-22Allow passing --legacy in aaptflags Colin Cross
--legacy will soon no longer be passed by default to all aapt2 compiles. Allow it to be specified in aaptflags by passing it to aapt2 compile when it is present and filtering it out from the flags passed to aapt2 link. Bug: 135597368 Test: m java Change-Id: Ib65d1a9b7c32ae4ff5ab6f58e66aedfb5f296712
2019-05-29Refactor .aar resource compilation Dan Willemsen
Instead of extracting the aar, and passing the res directory to another rule (along with a dependency to a different known file), don't keep the extracted res directory, and pass the aar directly to the resource compliation rule, which will extract just the res directory. I need this for my RBE experiments, where non-listed output files won't exist in other rules. Test: m Change-Id: I99074381052cbcebb6a402484abae9ab2e40284f
2019-03-19Support package_splits Colin Cross
Pass the package_splits list from the property to aapt2 as --split arguments, sign the extra outputs, install them, and add them as extra output files for SourceFileProducer. Bug: 127921149 Test: TestAppSplits Change-Id: Id94a53ae6a8a68ec81e98abba2fefc9c23feaa7a
2019-02-20Support passing resource zips to aapt2 Colin Cross
A zip of resources provides an easy way to pass generated resources to aapt2. Bug: 74574557 Test: m FrameworksCoreTests Change-Id: Ie4b1391521a27727694d03e42462b40d775614f8
2018-10-31Create bundle modules suitable for bundletool Colin Cross
Create a bundle module in addition to creating an APK, which can then optionally be merged with bundle modules from builds for other architectures and then be passed to bundletool to create an app bundle. Bug: 117295826 Test: tapas RecoveryLocalizer && m dist Change-Id: I98a17d7407dc56823ece9ec88c087780185a6555
2018-10-18Fix incremental build issue in aapt2 Colin Cross
Clear the directory with generated java files before generating new files into the directory. Fixes an issue where old, no longer generated files could remain and end up in R.jar. Test: m checkbuild Change-Id: I174030c336c5b7e6fe1198a43714af565babd7e6
2018-05-02Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES Colin Cross
If a static android library lib1 has static_libs: ["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 static_libs 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. Pass transtive static android library dependencies on the aapt2 command line so that aapt2 will always regenerate the R.java constants for those packages. Also extract the packages that have R.java files after each aapt2 invocation. This is not necessary for Soong, but is passed to make to let it force regenerating the packages using --extra-packages. Bug: 78300023 Test: m checkbuild Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee
2018-04-16Add support for android_library modules Colin Cross
Add support for compiling android_library modules into AARs, and refactor app support on top of it. Bug: 73724997 Test: app_test.go Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
2018-02-22Soong AAR prebuilt support Colin Cross
Add support for android_library_import modules that take an aar file. Bug: 73724997 Test: m checkbuild Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
2017-12-01Sort compiled resources by output path Colin Cross
Soong was keeping the compiled resources in the same order as the input resources, which are sorted lexicographically. Converting the path names in pathsToAapt2Paths results in a list that is no longer lexicographically sorted. Make sorts the inputs to aapt2 link by compiled resource name, so do the same in Soong. Bug: 69917341 Test: no change to framework-res.apk when converting to Soong Change-Id: I29e8339b9969b0d323d469dac140c7e172b7ebfa
2017-11-30Fix aapt2 Colin Cross
Fix some ninja variable issues in the aapt2 rules. These were caught by app_test.go, but that wasn't being run automatically, so add it to testSrcs. Test: app_test.go Change-Id: Ia01dda45ba5ced9c304056939c0e69f170c15de3
2017-11-29Replace aapt support with aapt2 Colin Cross
Use aapt2 instead of aapt to compile Android app resources. Also generate all files into srcjars instead of individual sources. Test: m checkbuild Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468