Commit Graph

217 Commits

Author SHA1 Message Date
Colin Cross
e331433dd9 Merge "Put shared library R.jar files in the classpath" into main am: 149f6f6f78 am: a43251d771 am: e88d5b1796 am: 0abb9e863b am: f4578a4787
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2787024

Change-Id: I22929b25c07d531d71ae9d077129b4d0a21341ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 20:53:38 +00:00
Colin Cross
8676c8cba5 Put shared library R.jar files in the classpath
When building with use_resource_processor: true R.jar files from
shared andoid_library dependencies need to be added to the classpath
so that the generated R classes can be referenced.

Bug: 294256649
Test: m DocumentsUIPerfTests
Change-Id: I30a6bddc3f378ecf58f142f94049e67ba33a47e3
2023-10-12 16:01:04 -07:00
Alix Espino
221b7393a0 Merge "Use an option struct in aapt.buildActions & manifestMerger" into main am: 37e64f9c91 am: a51e83ac06 am: aa0e12c22b am: 24520e5ab7 am: 2b38e79029
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2769926

Change-Id: Ie9ef8ad2c3e7e93ac15a58e689f8eea11af1f78f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 05:33:33 +00:00
Alix
f7a1027c6b Use an option struct in aapt.buildActions & manifestMerger
Change-Id: Ia056ab321e1fd146ed0cdb98fc2d4455601f648c
Test: Treehugger
2023-10-10 14:31:03 +00:00
Zi Wang
e2929e42a4 Merge "Always drop deps from android_library with no srcs" into main am: 2201343fce am: 50225c86b6 am: 965367f3e0 am: 489210e8c4 am: 4230ef999f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2765453

Change-Id: I852f8ebfdd9974e8ab21c47e85b2a107876bdba3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-28 20:44:34 +00:00
Zi Wang
2201343fce Merge "Always drop deps from android_library with no srcs" into main 2023-09-28 16:16:51 +00:00
Romain Jobredeaux
49c184262f Merge changes from topic "bazel_framework_res" into main am: 641b62b205 am: b0e61183f3 am: f1a3d7a303 am: ae9096771c am: bb53a4fc75
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2720593

Change-Id: I9a9b31f51bced57a22db829cdf0dee58fd11f200
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-28 01:58:21 +00:00
Romain Jobredeaux
641b62b205 Merge changes from topic "bazel_framework_res" into main
* changes:
  bp2build support for framework-res
  Keep rules_testing BUILD files
2023-09-27 20:52:50 +00:00
Zi Wang
1066479258 Always drop deps from android_library with no srcs
android_library does not accept deps when there are no srcs because
there is no compilation happening. The libs of android_library module
are unnecessary as deps on the android_library since they aren't
being propagated to any dependencies.
So we can drop deps here.

Test: the updated test case and CI

Bug: 302290600

Change-Id: Ib43a1c273a5f3b3e0aa6f29f4e8569ad3487e451
2023-09-27 12:36:36 -07:00
Romain Jobredeaux
d5d7e2bc72 Merge "Do not convert android_library_import with no aars." into main am: 832e131725 am: 51cab22f4e am: 2682639f03 am: f1037ec0eb am: 8d9d976c0d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2760791

Change-Id: I039fd28954fbe6fa0b9900090d2d3fa29b6a9578
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-27 00:26:56 +00:00
Romain Jobredeaux
9c06ef353b bp2build support for framework-res
Change-Id: I5b32a702e02b5f1ec08d5608d766a8a0c08d845c
Bug: 276928228
Bug: 297356405
2023-09-26 15:06:50 -04:00
Romain Jobredeaux
afc5d27ab0 Do not convert android_library_import with no aars.
Bug: 301007952
Change-Id: Ia32d47eeb1a888ea2555d5ca08f56f191c040bc7
2023-09-22 15:52:59 -04:00
Alix Espino
b8f84acee8 Merge "Mark android_* modules with java_resources as unconvertible" into main am: c62b27a7ea am: ea88c79b2e am: 540f688f3f am: 0f75212971 am: 4a60c10598
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2752994

Change-Id: Ie0b328aee779de433b286d2f7e612b902a7f19ef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-22 18:13:02 +00:00
Alix
ee51bd6588 Mark android_* modules with java_resources as unconvertible
Change-Id: I9da921feaf9edb5fe7d1b1cb733494f90d8c64b3
BUG: 300470246
2023-09-21 03:58:24 +00:00
Christopher Parsons
b8db405c7b Merge "Have ConvertWBp2build use Bp2buildMutatorContext" into main am: c331812a59 am: 95f97af223 am: 88db04e1a9 am: 5b60cdaa36 am: 097399434f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2756986

Change-Id: I3bfd6e81efefe823c8f7b443d28d8df593aad93d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-20 21:15:09 +00:00
Chris Parsons
637458d326 Have ConvertWBp2build use Bp2buildMutatorContext
This no-op refactoring facilitates some upcoming functional changes for
"bp2build allowlist v2". The work requires that the bp2build conversion
mutator be changed from a TopDown mutator to a BottomUp mutator.
Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext
makes it easier to make this functional change without touching tens of
files and multiple projects.

Bug: 285631638
Test: m bp2build
Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-09-20 14:49:35 +00:00
Jingwen Chen
3284042a0e Merge "[bp2build] android_test bp2build." into main am: 088c4b652b am: 3aaf1a80bd am: 3a02b22205 am: cd2454b172 am: 278d4778c8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2727561

Change-Id: I7594547b6f80d7b63cde2458d556ccad3b7d508e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-19 02:46:52 +00:00
Treehugger Robot
c9a581f5dc Merge "don't compress JNI libs extracted from aar_import" into main am: 35bc07cb2a am: 16542620eb am: fcc7fcf1eb am: 1edc01ae07 am: ed965f2258
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2636192

Change-Id: I2c8f767315f91cf3039b5a963f452ad62bde615b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-19 00:10:56 +00:00
Jingwen Chen
088c4b652b Merge "[bp2build] android_test bp2build." into main 2023-09-18 23:27:14 +00:00
Treehugger Robot
35bc07cb2a Merge "don't compress JNI libs extracted from aar_import" into main 2023-09-18 18:20:52 +00:00
Jingwen Chen
e12c083198 [bp2build] android_test bp2build.
android_test is just an android_app, but the test bits are handled
purely in Starlark (tradefed_test_impl).

This enables building HelloWorldTests (android_test) with Bazel.

Bug: 297030120
Bug: 297029612
Test: WIP
Change-Id: I6d287c94b31698ea247da48e4cd6b5a75bc71e11
2023-09-18 12:39:06 +00:00
Treehugger Robot
2444405e7a Merge "export_proguard_spec for libs deps" into main am: b4cd93ccc0 am: 671d826bba am: 69ecb6812f am: fe966999ba am: 1421dac199
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2691152

Change-Id: I2b7029ea7d610f541586029459bbaae7ddb1a839
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-18 20:14:15 +00:00
Treehugger Robot
b4cd93ccc0 Merge "export_proguard_spec for libs deps" into main 2023-08-18 18:17:19 +00:00
Sam Delmerico
95d709402a export_proguard_spec for libs deps
Add a property to export proguard flags files for libs dependencies.
Currently only proguard flags files from static deps are propagated up
to reverse dependencies, but it is necessary sometimes to have flags
from libs dependencies also be propagated.

Bug: 289087274
Test: go test ./java
Change-Id: Ic0aa22b086792bf322041aa5780db6c4f4eb2770
2023-08-18 15:43:56 +00:00
Romain Jobredeaux
f0f822d4dc Merge "Support asset_dirs property in bp2build for android_{app,library}" into main am: 491fa2fe50 am: 67a98d3520 am: 6a5370155c am: ed541ef3d1 am: dfdd351c73
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2715093

Change-Id: I7927ebe2107ee9bd9faab397ab6296f9fc7656fa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-17 20:06:08 +00:00
Romain Jobredeaux
7a71e07040 Support asset_dirs property in bp2build for android_{app,library}
Bug: 276928228
Test: Unit Tests
Change-Id: I6a2899de21e046e54cd0cd71314bf7aec4a470f6
2023-08-17 10:18:55 -04:00
Colin Cross
9b419ad17f Merge "Don't generate aapt2 srcjars when using resource processor" into main 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-08 22:21:24 +00:00
Liz Kammer
c519bc6f28 Merge "Add unconverted reason for jarjar incompatibility." into main am: 6b6b150d0a am: 7d941462bb am: 1397a3a96b am: 472f943b6d am: 44536d9bfa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2696067

Change-Id: I7d831ad01c92b86d585764dc8cbcffa58a649353
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-08 20:48:44 +00:00
Colin Cross
002764c8ee Merge "Don't generate aapt2 srcjars when using resource processor" into main 2023-08-08 18:57:02 +00:00
Liz Kammer
7f375869ab Add unconverted reason for jarjar incompatibility.
Test: m bp2build
Change-Id: I112b84fa53f57b9df2bd1e1616012fe55b48001e
2023-08-04 16:39:57 -04:00
Colin Cross
f3b7bada56 Don't generate aapt2 srcjars when using resource processor
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-02 21:50:38 -07:00
Treehugger Robot
245482e039 Merge "Move android_library resource handling to Bazel's ResourceProcessorBusyBox" into main 2023-07-26 00:34:57 +00:00
Colin Cross
4eae06dcc9 Move android_library resource handling to Bazel's ResourceProcessorBusyBox
The R.Java files generated by aapt2 link --no-static-lib-packages
cause scaling problems by combining all resources into every package
listed in a dependencies' AndroidManifest.xml file.  For SystemUI-core
this results in 74 R.java files, each with 76k lines, and takes 20
seconds to compile in javac.

Both AGP and Bazel have workarounds for this that avoid using the
R.java files generated by aapt2, instead generating more efficient
R.class files directly based on the R.txt file.

Bazel uses the ResourceProcessorBusyBox tool that is already present
in our tree to process the resources.  Reuse the same tool in Soong
to create the R.jar.

The more efficient R.class files require modifiying source files
that use incorrect packages to refer to resources.

Bug: 284023594
Test: TestAndroidResourceProcessor
Change-Id: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
Merged-In: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
2023-07-25 21:30:21 +00:00
Colin Cross
17f4f1cea9 Merge "Move android_library resource handling to Bazel's ResourceProcessorBusyBox" into main 2023-07-25 16:50:35 +00:00
Treehugger Robot
f360471575 Merge "Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk" into main am: 8bad43ad53 am: a4f896ab0d am: fdfe8d1dbb am: a0954b57f4 am: ec92e4b766
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2645432

Change-Id: If84e0d87ca4494a647d7e79d121c12083ca7c391
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-21 17:22:57 +00:00
Colin Cross
039d8dfb67 Move android_library resource handling to Bazel's ResourceProcessorBusyBox
The R.Java files generated by aapt2 link --no-static-lib-packages
cause scaling problems by combining all resources into every package
listed in a dependencies' AndroidManifest.xml file.  For SystemUI-core
this results in 74 R.java files, each with 76k lines, and takes 20
seconds to compile in javac.

Both AGP and Bazel have workarounds for this that avoid using the
R.java files generated by aapt2, instead generating more efficient
R.class files directly based on the R.txt file.

Bazel uses the ResourceProcessorBusyBox tool that is already present
in our tree to process the resources.  Reuse the same tool in Soong
to create the R.jar.

The more efficient R.class files require modifiying source files
that use incorrect packages to refer to resources.

Ignore-AOSP-First: merge conflict
Bug: 284023594
Test: TestAndroidResourceProcessor
Change-Id: I026073b40dabcfdb10e5d7a52e9348205b0e9a66
2023-07-20 21:39:37 +00:00
Joe Onorato
6fe59eb7f0 Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk
Bug: 283910439
Test: m nothing (runs soong tests)
Change-Id: I59f9bef7b7c502565d531a5685c002a177e0a77c
2023-07-20 11:33:06 -07:00
Jihoon Kang
5938ef7cf7 Merge "Fix stem to be propagated to output jar name in java_library" into main am: ef5d8278be am: 258edea6f6 am: 70de94a1e0 am: 0f00e9c056 am: e6d26a02db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2646424

Change-Id: I06aaf6ee150c64fa51aa619999c13c4303e80e1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-18 22:20:34 +00:00
Jihoon Kang
ef5d8278be Merge "Fix stem to be propagated to output jar name in java_library" into main 2023-07-18 18:26:36 +00:00
Colin Cross
e699b48df5 Merge changes Ied0a6cfe,I8c025efe into main am: adb892c539 am: d4875a4ae6 am: 4bc82d4f82 am: 52b380f33a am: 41fe9dc4fd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2658796

Change-Id: I935488792818808bc80b143adaefd958fd1ee2c9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 22:14:29 +00:00
Jihoon Kang
1bfb6f231e Fix stem to be propagated to output jar name in java_library
Currently, java_library.stem property is not correctly reflected in the
output jar name in java_library when the module specifies
java_resource_dirs property. This change fixes the unexpected behavior
so that setting the stem property behaves as expected.

Test: go test ./java && m
Bug: 285843207
Change-Id: I0941fcea83c92f4c42ae415aa6ad9125da5cf57b
2023-07-14 21:41:46 +00:00
Colin Cross
cb49a6f8fb Merge "Revert "Use depsets for transitive manifests and assets"" into main am: 0a30ce7c4b am: 20d572b050 am: e5dcad264d am: 9addd4b924 am: a90456ae99
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2658795

Change-Id: Ice11213c12da0d79b897c9a38234f90aeb91c436
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-14 20:39:16 +00:00
Colin Cross
ab8d138d42 Reland: Use depsets for transitive manifests and assets
Instead of rolling assets and manifests up through each static lib,
provide them as a DepSet.  This will help with the next patch, which
needs to pass all the transitive manifests and R.txt files together.

This relands Id8b3aa2bed3771e82ab6bde192c9b43baa38b54c with a fix
to include additional manifests from dependencies in the final
manifest merger.

Test: app_test.go
Test: TestManifestMerger
Change-Id: Ied0a6cfee2f18e87188db145b9411d4a903ab6c9
2023-07-14 11:26:43 -07:00
Colin Cross
d8c711f884 Revert "Use depsets for transitive manifests and assets"
This reverts commit 4c90f99cb3.

Reason for revert: b/291252863

Change-Id: I646b039a305a1297167e0c56b0bce0f541da260d
2023-07-14 15:52:41 +00:00
Colin Cross
c7b0295c62 Merge "Use depsets for transitive manifests and assets" into main am: 654f176379 am: b54cec3cb9 am: 44891a09ac am: 5bf41f6f96 am: 0b6b095c7f am: 3b4b912b39
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2633850

Change-Id: Ie77c6c6b2d8b6bfa000628fa8e366ef5dd2a8b7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-14 00:30:27 +00:00
Colin Cross
4c90f99cb3 Use depsets for transitive manifests and assets
Instead of rolling assets and manifests up through each static lib,
provide them as a DepSet.  This will help with the next patch, which
needs to pass all the transitive manifests and R.txt files together.

Test: app_test.go
Change-Id: Id8b3aa2bed3771e82ab6bde192c9b43baa38b54c
2023-07-11 09:54:59 -07:00
Sam Delmerico
80ee45ccc9 don't compress JNI libs extracted from aar_import
APKs expect JNI libs in the libs folder to be stored uncompressed, so we
should not compress libs that we extract from the AAR.

Bug: 280339573
Test: m AiWallpapers before this change &&
  compare to AiWallpapers with ag/22948656
Change-Id: I63baa3763bc01c74d8df9b0b3e035ea50c31904c
2023-06-22 15:38:46 -04:00
Eric Miao
1957e6eeb9 Merge "Revert "Revert "Enable compact resource entries for aapt linking""" 2023-06-22 16:49:11 +00:00
Alix
a381cd1973 Delete android/rules.bzl file
Bug: 277800767
Test: treehugger
Change-Id: I578bf63e33d15219812c2c17117186c74323d8d3
2023-05-10 15:33:10 +00:00
Romain Jobredeaux
2eef2e13e9 Bp2build support for sdk_version and java_version.
This CL adds java_version and sdk_version support to bp2build
converters for
   - java library
   - java binary
   - android library
   - android binary
   - android library import

Although java import doesn't support java_version and sdk_version, the
neverlink java_library wrapper around a java_import must specify a
sdk_version when targetting a device. "none" is used by convention.

Change-Id: I22a69dea2e351858368df69ed6a703b568d613ea
Bug: 215230098
Test: Presubmits
2023-04-11 21:05:48 -04:00