Commit graph

7105 commits

Author SHA1 Message Date
Cole Faust
2f681324c2 Merge "Only allow setting presigned without preprocessed on targetSdk < 30" into main 2023-09-06 21:00:15 +00:00
Sam Delmerico
0e0d96efa7 android_app APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE
Currently the product variable that is controlled by
APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE only overrides apexes, but it
doesn't apply to android_apps. This commit allows android_apps which set
updatable: true in their Android.bp to have their min_sdk_version be
overriden by this product variable.

Bug: 295311875
Test: go test
Change-Id: If3cb82a17cae4553b577dd1a4637ee13c3c95302
2023-09-05 21:38:16 +00:00
Romain Jobredeaux
f9f4265fd0 Merge "Bp2build support for app R8-related fields" into main am: 765beb237a am: 2e5deb49d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2731698

Change-Id: I828954953bf888f0b7b5b3328bae2ede09e9051b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-31 21:28:33 +00:00
Romain Jobredeaux
2e5deb49d6 Merge "Bp2build support for app R8-related fields" into main am: 765beb237a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2731698

Change-Id: Ic994371446dade12d9bdc9e1169cb87f07506e45
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-31 20:20:21 +00:00
Romain Jobredeaux
765beb237a Merge "Bp2build support for app R8-related fields" into main 2023-08-31 18:54:49 +00:00
Treehugger Robot
c829d9a813 Merge "Remove unnecessary options when generating stubs from signatures" into main am: c09e38de00 am: d148e1f232
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2709427

Change-Id: Idac84dc3cab108cd29e18bf23d11fc625f73cc41
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-31 11:30:53 +00:00
Treehugger Robot
d148e1f232 Merge "Remove unnecessary options when generating stubs from signatures" into main am: c09e38de00
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2709427

Change-Id: Ib5c271a64158a889d910220fb8cbacbe33c0e0b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-31 10:38:44 +00:00
Treehugger Robot
c09e38de00 Merge "Remove unnecessary options when generating stubs from signatures" into main 2023-08-31 09:45:30 +00:00
Paul Duffin
336b16a325 Remove unnecessary options when generating stubs from signatures
These options are unnecessary because:
* `--format` and `--api-overloaded-method-order` only affects the
  generation of signature files which this does not do.

Also changed the build rule description to differentiate from the
usual metalava command to make it easier to find in the ninja file.

Bug: 296115567
Test: m --build-from-text-stub
Change-Id: I7986cba00c364282ddc436d2e69bfb66eda46436
2023-08-31 08:07:26 +01:00
Romain Jobredeaux
9973ace1c7 Bp2build support for app R8-related fields
Bug: 293304784
Test: CI
Change-Id: I0aefa57f968cb41e50d7c1d29b2d8a1480655355
2023-08-31 01:35:44 -04:00
Liz Kammer
0b6b815556 Merge "Add do not convert for sdk_version unset" into main am: f236cd9247 am: 47059ae7ab
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2698553

Change-Id: I5f1228b6c35f4ad6ff1d902b6315de719cd76f52
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 17:39:34 +00:00
Jared Duke
444b4686b5 Merge "Reland "Enable R8 full mode by default for apps"" into main am: 2860cf1bc8 am: 9facd0d400
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2731593

Change-Id: I4d82687a688d8945030735b77f519e00a28f0bc9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 17:38:32 +00:00
Liz Kammer
47059ae7ab Merge "Add do not convert for sdk_version unset" into main am: f236cd9247
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2698553

Change-Id: Id475ee06602fad0be99217035cc97231329ad3db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 17:34:51 +00:00
Liz Kammer
f236cd9247 Merge "Add do not convert for sdk_version unset" into main 2023-08-30 16:59:50 +00:00
Jared Duke
9facd0d400 Merge "Reland "Enable R8 full mode by default for apps"" into main am: 2860cf1bc8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2731593

Change-Id: Icf8c60397c7ae58f7a9d6d2ab06119a322914479
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 16:48:07 +00:00
Jared Duke
2860cf1bc8 Merge "Reland "Enable R8 full mode by default for apps"" into main 2023-08-30 16:03:18 +00:00
Liz Kammer
02914408de Add do not convert for sdk_version unset
When sdk_version is unset, the build with fail with Bazel because
private APIs are do not build with Bazel at this time.

This instead prevents migrating the relevant target to Bazel in bp2build

Test: go tests
Change-Id: I31dabcf143de7933706d1b734ef21467a01b65e9
2023-08-29 20:06:48 -04:00
Cole Faust
6158528e15 Only allow setting presigned without preprocessed on targetSdk < 30
When targetSdk is >= 30, the system verifies that you use a valid
signature V2+ certificate. Uncompressing ndk/dex files or aligning
the zip file will break a signature V2, so these apks should really
just set preprocessed: true.

Fixes: 185811447
Test: Presubmits
Change-Id: Id89c42bcd5b5daa6eda1716bff4023423298036b
2023-08-29 11:18:44 -07:00
Jared Duke
aa88b3d020 Reland "Enable R8 full mode by default for apps"
This is attempt 4 at landing this change. Prior attempts were
reverted due to downstream test breakages not in presubmit.
Those issues have been resolved, and additional manual heavy
presubmit tests were run to ensure stability.

Observed APK savings: ~24MB

This reverts commit 74a5c2ec76.

Reason for revert: Fixed ManagedProvisioningTests

Bug: 215530220
Change-Id: I223228a345fa1a3bad52fb3e91c744107e04fc07
2023-08-29 17:07:20 +00:00
Treehugger Robot
7c21354de3 Merge "Reland: Re-enable checks that pass in udc-dev-plus-aosp and downstream" into udc-dev-plus-aosp 2023-08-29 06:38:38 +00:00
Colin Cross
7b9c1e9065 Reland: Re-enable checks that pass in udc-dev-plus-aosp and downstream
This relands Ifa581e8d346cf7e70387d6aa3135203d6a7d621b after
fixes to the manifests of modules that didn't pass the new
lint checks.

Bug: 294098365
Test: treehugger
Test: https://android-build.googleplex.com/builds/abtd/run/L56200000962810233
Test: https://android-build.googleplex.com/builds/abtd/run/L49700000962810033
Change-Id: I82129ef29025f35c0f4fc20f2d892c0af39d76ae
2023-08-29 04:20:07 +00:00
Todd Lee
f09f5d7995 Merge "Support for incremetal platform prebuilt APIs" into main am: 5b6d1d87d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2726799

Change-Id: I8f17b42119655787ba6f17868a3006b3e96d37ba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 19:16:31 +00:00
Todd Lee
5b6d1d87d6 Merge "Support for incremetal platform prebuilt APIs" into main 2023-08-28 18:42:58 +00:00
Treehugger Robot
3f352577f8 Merge changes from topic "java-proto-include-dir" into main am: 7eb6ffc796
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2723480

Change-Id: I6c7c4dbed074f32a3b50a2e5adb670f154bc818a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 17:54:41 +00:00
Treehugger Robot
7eb6ffc796 Merge changes from topic "java-proto-include-dir" into main
* changes:
  Handle proto.include_dirs for java
  Translate python_libray.pkg_path to proto.import_prefix
2023-08-28 17:18:29 +00:00
Alix Espino
6af68b8270 Merge "support for multiple filegroups and resource_dirs" into main am: 5dbb696c53
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2626338

Change-Id: I8c3500b085c3443d0a93d3f3f8c130baefa64923
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 17:12:08 +00:00
Alix Espino
5dbb696c53 Merge "support for multiple filegroups and resource_dirs" into main 2023-08-28 17:10:13 +00:00
Treehugger Robot
82c3fafd8f Merge "Add aconfig annotations for java_aconfig_library" into main am: 01f70e8d0e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2682307

Change-Id: I1438c67f334f38cc17c75ea9cc08cddab5496171
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 13:41:38 +00:00
Treehugger Robot
01f70e8d0e Merge "Add aconfig annotations for java_aconfig_library" into main 2023-08-28 13:03:56 +00:00
Ian Zerny
2d8d538c2b Merge "Translate SDK level 10000 to a valid compiler min-api" into main am: f94c8113a3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2727794

Change-Id: I62732250881d9bb8f1922c7afe8b93cab70559e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 07:23:06 +00:00
Ian Zerny
f94c8113a3 Merge "Translate SDK level 10000 to a valid compiler min-api" into main 2023-08-28 06:26:36 +00:00
Joe Onorato
8f75585b37 Add aconfig annotations for java_aconfig_library
Test: m
Bug: 289087078
Change-Id: I860b91f984b2f2c596360490337fb25a4df7a988
2023-08-26 08:26:18 -07:00
Todd Lee
2ec7e1c55c Support for incremetal platform prebuilt APIs
This change provides support for prebuilt incremental platform API (i.e.
API changes associated with a QPR, as opposed to a major dessert
releas).

This feature is provided via the existing prebuilt_apis module with the
introduction of a new attribute:

    allow_incremental_platform_api

While typical platform prebuilt APIs are presumed to be under a
directory structure that follows the pattern:

<version>/<scope>/<module>.jar
<version>/<scope>/api/<module>.txt

Where <version> is limited to a single integer signifying the API level.

For modules where allow_incremental_platform_api is set to 'true' (false
by default) the pattern is the same, however <version> is presumed to be
of the form MM.m, where MM aligns with the existing API level and m
signifies the incremental release (e.g. QPR).

Bug: b/280790094
Test: platform build check with both incremental & non-incremental API
      cd build/soong && go test ./java
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eee6995093485497bc29cdce01c2a86765ffb4eb)
Change-Id: I67e293006ccfa210d0dcc0a294db894632f1b6cb
2023-08-25 18:03:44 +00:00
Alix
289e9c607b support for multiple filegroups and resource_dirs
Test: tests in bp2build and b build //external/emma:emma

Change-Id: I57e60389aec926c55d01818a6a3b1ec33e9c53b8
2023-08-25 16:12:15 +00:00
Ian Zerny
c26029b473 Translate SDK level 10000 to a valid compiler min-api
Targets with the special level 10000 are compiled using the current
platform SDK level. They are also compiled as a "platform build" which
will disable features such as API modeling and method backports.

Bug: 295591477
Test: manual inspection of the updated build commands
Change-Id: Ifda8859396b33dde4c46a9b212ddb855b012bf07
2023-08-25 13:48:21 +02:00
Spandan Das
e8a90c57e0 Handle proto.include_dirs for java
The proto_library(s) created for include_dirs will be added to
transitive_deps

This also fixes an existing bug for java_library containing .protos in
srcs via filegroups.
```
java_library {
  name: "foo",
  srcs: ["foo.proto", "foo_filegroup"],
}
```

At ToT, foo_filegroup was missing from the equivalent proto_library in
bp2build workspace.

Bug: 285140726
Test: allowlisted pandora-proto-java and built that
Change-Id: I2657d8cdef2e47434bc3e0d09a074c8e27299afc
2023-08-24 19:21:10 +00:00
Mark White
6aac22ac49 Merge "java_library support for building headers-only" into main am: 03fe33ad1c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2721996

Change-Id: Iadd049c8516dc54027e897c23f9d0d2ea3135e96
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 15:24:18 +00:00
Mark White
03fe33ad1c Merge "java_library support for building headers-only" into main 2023-08-23 15:03:21 +00:00
Mark White
a15790ac1e java_library support for building headers-only
Flag for java_library modules to build just the Turbine headers and
skip building an impl jar.

Test: go test java
Bug: 289776578
Change-Id: Iad0babf951710476bc32df93c25d17065a14ab84
2023-08-22 21:29:05 +00:00
Treehugger Robot
a8a24d90dc Merge changes from topic "aconfig_framework_circle" into main am: a9dbd27afa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2717352

Change-Id: Ie41f1a066b9d164047d61a50375a9981c95e4463
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-21 17:09:16 +00:00
Joe Onorato
4eff29bafc Allow access to the generated srcjars for GeneratedJavaLibrary am: ffac9be887
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2717351

Change-Id: Ib1b3f486ab23e67dc13a9a8b163a1879654610ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-21 17:09:13 +00:00
Joe Onorato
9e3716caea Allow generated java libs to specify libraries.
Not having them before was just being conservative, and now libs at
least is needed.

Bug: 293195086
Test: m
Change-Id: Ieaa66d11fc983751fd302a21e17802748a535fa7
2023-08-20 07:41:31 -07:00
Joe Onorato
ffac9be887 Allow access to the generated srcjars for GeneratedJavaLibrary
Bug: 293195086
Test: m
Change-Id: I42cf0238241314376f5fe0091cde9bef196f4b9d
2023-08-20 07:41:17 -07:00
Treehugger Robot
671d826bba Merge "export_proguard_spec for libs deps" into main am: b4cd93ccc0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2691152

Change-Id: I9dc3ac50540799a64b709bfb5509aed671436cdb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-18 18:39:06 +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
Treehugger Robot
cc259040b5 Merge "Revert "Revert "Move from-text stub java_api_library modules clo..."" into main 2023-08-17 23:50:00 +00:00
Jihoon Kang
b281ddc8a2 Revert "Revert "Move from-text stub java_api_library modules clo..."
Revert submission 2713677-revert-2655262-move_java_api_libraries-JTESUMBERD

Reason for revert: Initial revert was created to resolve build breakage, but the breakage was caused because not all CLs included in the topic were being included in the build, and was not a problem of the CLs itself.

Reverted changes: /q/submissionid:2713677-revert-2655262-move_java_api_libraries-JTESUMBERD

Merged-In: If66b5bba719bb389a69f2353d2218a89b2b96b90
Change-Id: I879c9d3fb7427cfeff45fff423d4d536548e766f
2023-08-17 20:51:46 +00:00
Romain Jobredeaux
491fa2fe50 Merge "Support asset_dirs property in bp2build for android_{app,library}" into main 2023-08-17 17:43:18 +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
Jihoon Kang
4434b7132c Revert "Move from-text stub java_api_library modules closer to s..."
Revert submission 2655262-move_java_api_libraries

Reason for revert: Breaking build

Reverted changes: /q/submissionid:2655262-move_java_api_libraries

Change-Id: I2719de4d35e5a4131468d7e84b369631ec86eb2b
2023-08-17 01:26:23 +00:00
Jihoon Kang
b6ec2c8ea0 Move from-text stub java_api_library modules closer to source
This change moves java_api_library modules that were previously defined
in build/orchestrator closer to where their from-source equivalents are
defined.

Test: m (default to from-text stub build)
Bug: 274805756
Merged-In: If66b5bba719bb389a69f2353d2218a89b2b96b90
Change-Id: If66b5bba719bb389a69f2353d2218a89b2b96b90
2023-08-16 22:12:11 +00:00
Paul Duffin
58c2388f92 Revert "Re-enable checks that pass in udc-dev-plus-aosp and downstream"
This reverts commit bdc0578df1.

Reason for revert: b/296088866

Change-Id: I053314736758f48ea99920a141443c1489d2477b
2023-08-16 08:04:26 +00:00
Jihoon Kang
e7ee256746 Stop sdk_library generated api_library to depend on full surface api_library
Since full_api_surface_libs extract class files instead of srcjar file,
full_api_surface_stub can be replace with android_*_stubs_current,
instead of the api_library android_*_stubs_current.from-text.
Functionally, the class files of the two modules are identical (in
from-text stub build), but depending on the from-text java_api_library
leads to missing dependency errors in partial branches (especially ART
branches). To resolve this problem, make sdk_library generated
api_library depend on the missing dependency handled
android_*_stubs_current.

Since android_module_lib_stubs_current.from-text does not have its
from-source equivalent, this can remain as dependency as the module is
moved to build/soong in aosp/2674196

Test: m (default to from-text stub build)
Bug: 274805756
Change-Id: Ic8bbd25252e5f9f1dc7c059ce6b00a951188985d
2023-08-14 21:18:13 +00:00
Jihoon Kang
862da6f233 Add previous_api property to java_api_library module
`Previous_api` is used to migrate nullness information in metalava (i.e.
convert @Nullable and @NonNull to @RecentlyNullable and @RecentlyNonNull
for some methods). The input is required to generate loosely equivalent
from-text stubs.

Test: m && compare nullness annotations between from-source stubs and from-text stubs
Bug: 293962901
Change-Id: Ic7a0868415fdb2c65d0d472e527fe73280b7651d
2023-08-14 17:18:40 +00:00
Jihoon Kang
0c705a448f Convert additional sdk_library stub libraries to from stub generation
legacy.i18n.module.platform.api, stable.i18n.module.platform.api and
conscrypt.module.platform.api contributes to api surfaces, but the
corresponding stub libraries were being generated from source during
from-text stub build. This discrepancy may lead to hiddenapi failure.
Thus, enable these modules to be built from txt files during from-text
stub build.

Test: m
Bug: 274805756
Change-Id: I940dc8484b210bb8aea57ead1055983be7cdf5ec
2023-08-14 17:17:48 +00:00
Paul Duffin
64876012de Merge "Pass the current API file to the metalava --use-same-format-as option" into main 2023-08-12 13:27:37 +00:00
Jihoon Kang
478ca5b79e Move scopeOrderedSourceFileNames as outside var
This change enables scopeOrderedSourceFileNames to be not computed
everytime when the function is called, but instead is computed once.

Test: m
Bug: 295429988
Change-Id: I33846cdb7a750e44e45049dbd342aa6ab8b70c4c
2023-08-11 23:36:11 +00:00
Paul Duffin
10a23c29e2 Pass the current API file to the metalava --use-same-format-as option
That will allow the format of a file to be changed by simply modifying
the signature format in the current API file (e.g. from `2.0` to `3.0`)
and then running `m update-api` and it will just update the current API
file (and the corresponding removed API file).

Bug: 295577788
Test: m checkapi && m update-api
      # Also did as described above and modified the
      # `libcore/api/current.txt` file from `2.0` to `3.0` and ran
      # `m update-api` and checked that only that file and the
      # corresponding `removed.text` file was changed.
Change-Id: I20c9bc151677502cf09b0c06fb442fd385caccdd
2023-08-12 00:06:42 +01:00
Jihoon Kang
84473f55d7 Sort api files by api scope in java_api_library
Recent changes in metalava (aosp/2704325) enforces api files passed as
inputs to generate stubs from txt to be sorted in the order from the
narrower api scope to the wider api scope. In order to comply with this
change, all api files passed as inputs to metalava invocations need to
be sorted in the respective order.

Test: m out/soong/.intermediates/packages/modules/IPsec/tests/cts/CtsIkeTestCases/android_common/e10894d3da5db41239526c9048962355/javac/CtsIkeTestCases.jar --build-from-text-stub --skip-soong-tests (Failing module from incorrect class hierarchy when building from text stub)
Bug: 295429988
Change-Id: I1eb1f4bf8fa34fd7dc8a0e4c04aa056258a975c5
2023-08-11 22:58:54 +00:00
Paul Duffin
f8aaaa13f4 Replace -bootclasspath and -classpath metalava options with --classpath
Metalava has not differentiated between bootclasspath and classpath for
years so this change replaces the use of the two deprecated single
hyphen options with `--classpath`.

Bug: 295136054
Test: m checkapi
Change-Id: I3ab20b76a60cab66a27784b7d87a069813d19835
2023-08-10 15:16:35 +01:00
Colin Cross
bdc0578df1 Re-enable checks that pass in udc-dev-plus-aosp and downstream
Re-enable ForegroundServiceType and MutableImplicitPendingIntent,
which have been fixed in udc-dev-plus-aosp and downstream.

Bug: 294098365
Test: treehugger
Ignore-AOSP-First: re-enabling checks that fail in AOSP
Change-Id: Ifa581e8d346cf7e70387d6aa3135203d6a7d621b
2023-08-09 14:52:50 -07:00
Treehugger Robot
18801036c7 Merge "Stop using single-hyphen metalava options" into main 2023-08-09 14:35:40 +00:00
Paul Duffin
808211e519 Stop using single-hyphen metalava options
`-encoding` and `-source` have been deprecated in metalava.

`-encoding` actually does nothing apart from check to make sure that
the value is `utf-8` (in some case). Metalava always uses `utf-8`.

`-source` has been deprecated in favor of `--java-source` as metalava
also can consume kotlin and it has its own `--kotlin-source` option.

Bug: 295136054
Test: ./gradlew
Change-Id: I08e6931958f40022d65d417360e32b72a1d70444
2023-08-09 12:38:46 +01: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
bd6294cc9c Merge "Downgrade newly failing lint checks" into main 2023-08-04 16:50:08 +00:00
Colin Cross
482ccfab04 Merge "Delete aapt2 generated java files after creating srcjars" into main 2023-08-03 18:57:24 +00: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
Colin Cross
3b1e71c958 Delete aapt2 generated java files after creating srcjars
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-02 21:50:37 -07:00
Colin Cross
9fa43ad2e3 Downgrade newly failing lint checks
Downgrade new lint checks that are failing to warnings.

Bug: 294098365
Test: treehugger
Change-Id: If236199b22c31d95acbffaefee569c806ef0018d
2023-08-03 00:57:41 +00:00
Roy Luo
2631bcd34e Merge "Revert "Reland "Enable R8 full mode by default for apps""" into main 2023-08-03 00:00:25 +00:00
Roy Luo
74a5c2ec76 Revert "Reland "Enable R8 full mode by default for apps""
This reverts commit a9f5c57b90.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/test_investigate/?invocationId=I59400010184068138&testResultId=TR41428835561759069&tab=trace, bug b/294287299

Bug:294287299
Change-Id: Id7bbe3b1a4cdc999c6a4cb9002b60c882b34f11e
2023-08-02 23:56:46 +00:00
Treehugger Robot
cfe9e6d008 Merge "Reland "Enable R8 full mode by default for apps"" into main 2023-08-02 21:38:29 +00:00
Treehugger Robot
a7c5278fbe Merge "Ensure extracted JNIs are stored properly in APKs" into main 2023-07-31 22:47:05 +00:00
Jared Duke
a9f5c57b90 Reland "Enable R8 full mode by default for apps"
This is attempt 3 at landing this change. Prior attempts were
reverted due to downstream test breakages not in presubmit.
Those issues have been resolved, and additional manual heavy
presubmit tests were run to ensure stability.

Observed APK savings: ~24MB

This reverts commit a2ab93666d.

Reason for revert: Fixed SdkSandboxManagerTest by preserving
existing R8 compat mode for the aosp variant of SdkSandbox target.

Bug: 215530220
Bug: 293177283
Test: atest SdkSandboxManagerTests && \
      atest SdkSandboxStorageHostTest && \
      atest SdkSandboxLifecycleHostTest

Change-Id: If5636638875b6f67e0cc0ba4fd253a8d99d8db1d
2023-07-31 22:11:00 +00:00
Luca Stefani
813de60e00 Ensure extracted JNIs are stored properly in APKs
If the android_app has the use_embedded_native_libs flag
all its JNIs must be stored with the store compression method.

The logic to add JNIs from ARR is as follows:
1) Extract JNI libs from AAR
2) Store JNI libs with deflate
3) Merge deflated JNI libs with APK

This process produces a bogus APK that won't be loaded by the
framework if the use_embedded_native_libs is set as the resulting
APK will have all its merged entries stored as deflate.

To solve the problem in case we merge JNIs with an app requiring
uncompressed JNI we add an extra step to ensure they're compressed
using the store method.

Test: m, verify apk using jni_extract has stored libs
Change-Id: Ic31d47f15412171b5898dd0e2a554cb6bf93293b
2023-07-31 21:16:18 +02:00
Romain Jobredeaux
6553cf54fb Merge "Enable from-source vs from-text toggling for core.module_lib.stubs." into main 2023-07-31 13:19:25 +00:00
Pratyush
d938f83be1 Merge "Disable Hidden API Checks for ENG Builds" into main 2023-07-30 13:57:36 +00:00
Pratyush
faec4db56f Disable Hidden API Checks for ENG Builds
For more discussions/details, please check internal CL ag/24145146

Bug: 289409213
BUg: 285976182
Test: Look for hiddenapi calls in build trace
Change-Id: Ia2780ee419b8da1418ba1c7a7d732712b7c2a322
2023-07-30 13:57:10 +00:00
Romain Jobredeaux
9d54fdac3d Enable from-source vs from-text toggling for core.module_lib.stubs.
Also fix a typo in legacy core for system modules

Change-Id: I0b3bb04773d7ee616b94252711053d5be396b84a
2023-07-28 16:02:12 -04:00
Colin Cross
61bf9ef31e Merge "Delete the javac/classes directory after zipping it" into main 2023-07-28 16:18:31 +00:00
Colin Cross
b3168bac7f Avoid extra copy of JNI libs zip
Don't call merge_zips if there are no prebuilt JNI libraries to
merge with.

Test: builds
Change-Id: Ife5386fbbfcff35bdea2914519a78dfd89163a25
2023-07-27 08:09:37 -07:00
Colin Cross
49889c088b Delete the javac/classes directory after zipping it
javac produces a directory containing class files, which is then zipped
with soong_zip into a jar file.  The class files are never used outside
of the rule, so delete them after zipping them.  This should save 19 GB
of disk space in checkbuilds.

Do the same for kotlinc/classes directories for consistency.

Bug: 293352015
Test: treehugger
Change-Id: Id1e889cfbee47eab552a5bb27134fa4b3b4c4d14
2023-07-27 14:57:45 +00:00
Liz Kammer
c796de83c8 Merge "Handle xsd config more like other partitions" into main 2023-07-26 19:18:52 +00:00
Treehugger Robot
06c246c1af Merge "Revert "Enable R8 full mode by default for apps"""" into main 2023-07-26 00:42:06 +00:00
Treehugger Robot
245482e039 Merge "Move android_library resource handling to Bazel's ResourceProcessorBusyBox" into main 2023-07-26 00:34:57 +00:00
Jared Duke
a2ab93666d Revert "Enable R8 full mode by default for apps"""
This reverts commit 5d3ec54b6b.

Reason for revert: Breaks a SdkSandboxManagerTest

Change-Id: I30c03d70a2b683f663b00866035ebf56339a4b0b
2023-07-25 21:37:17 +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
Treehugger Robot
5ad5c918a3 Merge "Revert "Revert "Enable R8 full mode by default for apps""" into main 2023-07-25 20:22:01 +00:00
Liz Kammer
5f5dbaad65 Handle xsd config more like other partitions
This is prep work to add additional special handling for genrule
generated headers as there will be similar partitioning for those
headers.

Test: go test soong tests
Change-Id: Ib63e7e4f7554b2b7b7bc78b2825b20c05403216a
2023-07-24 13:01:22 -04:00
Treehugger Robot
ed89d33fb1 Merge changes I69f80d12,I40d48644 into main
* changes:
  Merge META-INF/services/* files in merge_zips -jar
  Strip META-INF/services from implementation jars when using as header jars
2023-07-24 14:27:25 +00:00
Zi Wang
8348ce92f5 Merge "java_test macro needs srcs and deps to create .jar for tradefed_test_suite" into main 2023-07-21 20:48:13 +00:00
Treehugger Robot
8bad43ad53 Merge "Track transitive usage of aconfig flags and add LOCAL_ACONFIG_FILES to Android-<product>.mk" into main 2023-07-21 14:34:44 +00:00
Treehugger Robot
9064761816 Merge "Relax preprocessed apk check for non-privileged apps" into main 2023-07-21 03:47:42 +00:00
Cole Faust
93b89b4110 Relax preprocessed apk check for non-privileged apps
Non-priviledged apps can have compressed dex files.
See go/gms-uncompressed-jni-slides

Bug: 185811447
Test: Presubmits
Change-Id: I14f70fb9286bce132e451a0c930333455517cdc3
2023-07-20 17:57:33 -07:00
Jared Duke
5d3ec54b6b Revert "Revert "Enable R8 full mode by default for apps""
This reverts commit ba283992ef.

Reason for revert: Resolved associated test/build failures

Bug: 215530220
Test: atest BluetoothInstrumentationTests
Test: atest RkpdAppGoogleUnitTests
Change-Id: I27ad6a4f910fa8d48a3dc122c7542f8d7667de5a
2023-07-20 23:29:41 +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
LaMont Jones
feff3f3f99 Enable restat for javac rules
Bug: 280820245
Test: presubmit
Change-Id: I315fb864f8df3d749fa1545b6e59ee37f8f5ec18
2023-07-20 18:28:54 +00:00
Colin Cross
f06d8dc8e3 Strip META-INF/services from implementation jars when using as header jars
If a header jar couldn't be built (for example when an API generating
annoation processor is in use) the implementation jar is reused as the
header jar.  If the implementation jar contains an annotation processor
listed in META-INF/services/javax.annotation.processing.Processor then
later javac executions with the implementation jar in the classpath
could attempt to run the annotation processors unexpectedly.  Remove
the META-INF/services directory when using an implementation jar as
a header jar.

Bug: 290933559
Test: builds
Change-Id: I40d48644bc5a09a9564dc2c4b38f627edd00fcf8
2023-07-19 21:48:11 +00:00
Sam Delmerico
cfcd0a4960 Merge "make android.InList generic" into main 2023-07-19 15:02:56 +00:00
Sam Delmerico
1717b3bb7a make android.InList generic
Change-Id: Ic166216cb473371a5e34cd97a068ca35f5534740
2023-07-18 15:07:24 -04: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
Zi Wang
7873f613c4 java_test macro needs srcs and deps to create .jar for tradefed_test_suite
Test: java_test_host_conversion_test.go and TH

Bug: 280452825
Change-Id: Ibf0c7eed415fc58a4d228f0347ab125fdc4466e4
2023-07-17 16:39:07 -07:00
Colin Cross
adb892c539 Merge changes Ied0a6cfe,I8c025efe into main
* changes:
  Reland: Use depsets for transitive manifests and assets
  Add test for manifest merger
2023-07-17 16:30:55 +00:00
Alix Espino
2a779ea829 Merge changes from topics "errProne_bp2build_manually_enabled", "error_prone_config" into main
* changes:
  Bp2build for errorprone modules that manually enabled/disabled it
  Make errorprone a configurable attribute for bazel conversion
2023-07-17 13:54:50 +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
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
02bccdf37c Add test for manifest merger
Add a test for the manifest merger command line that would have prevented
b/291252863.

Bug: 291252863
Test: TestManifestMerger
Change-Id: I8c025efe7ccb06ad97b405e2927a4df07f9d3f27
2023-07-14 11:24:54 -07:00
Colin Cross
0a30ce7c4b Merge "Revert "Use depsets for transitive manifests and assets"" into main 2023-07-14 16:10:31 +00: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
Jiakai Zhang
a1140990a1 Merge changes from topics "art-boot-image-jars", "configured-jar-location-overrides" into main
* changes:
  Add a Make variable to determine ART boot image jars for testing.
  Add a Make variable that overrides configured jar locations.
  Refactor dexpreopt for boot jars to make it flexible to config changes.
2023-07-14 11:47:59 +00:00
Jiakai Zhang
556bdf8e96 Add a Make variable to determine ART boot image jars for testing.
Bug: 290583827
Test: m nothing
Change-Id: I6eb0c83dd14682905ebaf3af55171856300eb2e3
2023-07-14 12:13:30 +01:00
Jiakai Zhang
4d90da29a8 Add a Make variable that overrides configured jar locations.
We had hardcoded logic to override "framework-minus-apex", but we need
to override more jars, so this CL adds a general solution for this.

Bug: 290583827
Test: m nothing
Change-Id: I211ebda7aa2803886ab6e6d081d26327665e49a6
2023-07-14 12:13:30 +01:00
Jiakai Zhang
cb13b5d1bd Refactor dexpreopt for boot jars to make it flexible to config changes.
In the past, dexpreopt for boot jars was very inflexible, and it was
incredibly hard to make a change that is as simple as adding a jar to a
boot image. Boot image generation was handled by
"platform_bootclasspath" and "bootclasspath_fragment" separately. This
caused not only code duplication but also the inflexiblity as such a
design did not fit today's use cases, where a boot image may take jars
from multiple mainline modules and the platform, and a mainline module
can contribute to multiple boot images. The design casued a huge
maintenance burden as any change to the boot image cost multi-week
efforts.

In recent years, efforts have been made to improve this a bit by a bit.
This change is another step towards making dexpreopt reasonable.

After this change, all boot images are generated by "dex_bootjars",
which is in build/soong and is therefore available on both the full
source tree and the thin manifest (master-art). The change decouples
profile generation/extraction from boot image generation. Profiles for
mainline modules are still handled by "bootclasspath_fragment"
because they need to be packed into APEXes when building mainline
modules and extracted from APEXes whem building the system image from
prebuilt modules. Boot images are not handled by
"bootclasspath_fragment" anymore.

Bug: 290583827
Test: m (all existing tests are still passing)
Test: Manually checked that the boot images are exactly the same as
  before.
Change-Id: Ib5a5f401bee334ffcab5c26618e0c8888b84575a
2023-07-14 12:13:28 +01:00
Alix
b1e5c6a69a Bp2build for errorprone modules that manually enabled/disabled it
Test: go test ./bp2build
Change-Id: Ie60c0959ee9ae8ce86c11a8e85a0bc7592f63df8
2023-07-13 15:50:18 +00:00
Colin Cross
654f176379 Merge "Use depsets for transitive manifests and assets" into main 2023-07-12 21:49:13 +00:00
Vadim Spivak
7a2e48bd36 Merge "AIDEGen: Collect apt generated sources" into main 2023-07-12 21:33:59 +00:00
Vadim Spivak
3c496f00fa AIDEGen: Collect apt generated sources
The Java compiler may generate sources when processing annotations.
These sources are currently not included in the IDE project model, which
results in unresolved symbols when using Hilt and other annotation
processors. These sources are not passed to the Java compiler for
compilation, so they cannot be handled like other Java module sources.

This change archives the generated sources and appends them to the
existing srcjar list in module_bp_java_deps.json.

Test: go test .
Test: Verified that module_bp_java_deps.json contained srcjar entry
Test:   with path/to/android_common/javac/anno.srcjar.
Test: Verified that IntelliJ can resolve generated symbols after
Test:   invoking aidegen.
Change-Id: I6a3011f9140fd25f785178baee0cd6074ad94600
2023-07-12 17:34:39 +00:00
Treehugger Robot
105005bfd4 Merge "Remove metalava --no-banner argument" into main 2023-07-12 17:08:42 +00:00
Mårten Kongstad
bd2624442b Remove metalava --no-banner argument
metalava no longer prints an ASCII banner, and has removed its
--no-banner argument. Update all call sites accordingly.

Test: presubmit
Bug: 286023667
Change-Id: I61cf5f1125dfbd93496e6a59eb1ea62886b32046
2023-07-12 14:07:01 +02:00
Jiakai Zhang
b898c112a2 Merge changes I0918f2fa,I3fc6ff91,I7adc97cb,I674a5fa1,I22c45cbf into main
* changes:
  Change the profile path on host.
  Extract duplicate code to common helper functions.
  Fix dumpOatRules.
  Remove Modules() from BootclasspathFragmentApexContentInfo.
  Fix some tests for dexpreopt and remove unnecessary tests.
2023-07-11 20:59:07 +00:00
Colin Cross
120b55a7ca Merge "Add tests for code that will be affected by resource processor feature" into main 2023-07-11 20:17:05 +00:00
Jiakai Zhang
3444e561dc Change the profile path on host.
This is to decouple profile generation from image configs. A boot image
profile is either for a mainline module or for the platform, which is
orthogonal to boot images.

Bug: 290583827
Test: m nothing
Change-Id: I0918f2fa945a2af1839f1a08ecede331c64d0317
2023-07-11 17:59:24 +01:00
Jiakai Zhang
b1639db53f Extract duplicate code to common helper functions.
Also, fall back to using a default name for the dexpreopt directory if
we are not building for Android.

Bug: 290583827
Test: m nothing
Change-Id: I3fc6ff9142a2dcdf995796f75891b242fe2848d0
2023-07-11 17:59:05 +01: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
Jiakai Zhang
da47d3c6f3 Fix dumpOatRules.
This method generates a build rule that runs oatdump for debugging
purposes.

- Pass "--runtime-arg -Xgc:CMC" to oatdump if UFFD GC is enabled.
- Build the phony name from the image name to avoid conflicts when using
  this method for multiple boot images.

Bug: 290583827
Test: m dump-oat-boot
Change-Id: I7adc97cb85b571486b78f173fb80ff7da2c4bfe4
2023-07-11 16:27:01 +01:00
Jiakai Zhang
f7f782c4f1 Remove Modules() from BootclasspathFragmentApexContentInfo.
The Modules() method was for the ART boot image in the ART APEX. It's no
longer needed because we don't install the ART boot image in the ART
APEX anymore.

Bug: 290583827
Test: m nothing
Change-Id: I674a5fa1ed18908413a64129df5947c7d26e638e
2023-07-11 15:29:17 +01:00
Jiakai Zhang
b69e89559f Fix some tests for dexpreopt and remove unnecessary tests.
This CL is to prepare for the changes in http://r.android.com/2652081.
See the description of that CL for the reasons.

Some tests were set up in a fragile way and were easy to be broken when
the implementation changes. This CL is a pure test change that fixes
them.

This CL also removes TestNoUpdatableJarsInBootImage. That test checks
what should go to the ART boot image and what should go to the
platform one, which does not apply today because boot images are not
associated with mainline modules anymore: a boot image may take jars
from multiple mainline modules and the platform, and a mainline module
can contribute to multiple boot images. In practice, we have ART jars in
the platform boot image, and we are going to add core-icu4j and
consrypt to the ART boot image, which is now for testing only.

Bug: 290583827
Test: m nothing
Change-Id: I22c45cbf6f853b030b68edb51197854e9c53a02e
2023-07-11 15:29:12 +01:00
Romain Jobredeaux
aa634fdbdb Merge "Support target and max sdk version in app bp2build." into main 2023-07-11 13:34:29 +00:00
Colin Cross
5780d57a71 Copy imported APKs to output filename
android_app_import and android_test_import modules with processed: true
and skip_preprocessed_apk_checks are used directly from the source tree.
If the source file name doesn t match the module name and the file is
used as test data it can result in the wrong filename being used.  Copy
the source file to an output file with the correct name first.

Bug: 290376750
Test: m CtsAppSecurityHostTestCases
Change-Id: I4a6dd1c5e48db7085ea41035def31f0844948a46
2023-07-10 22:18:01 +00:00
Romain Jobredeaux
496660d38a Support target and max sdk version in app bp2build.
Test: Unit tests + CI
Bug: 285304294
Bug: 280465047
Change-Id: I9bb1b6f9729ad783a43837d77dcf2d02b50ca77e
2023-07-10 11:50:00 -04:00
Colin Cross
5368d0b44a Implement OutputFileProducer for android_app_import and android_test_import
Fixes: 290376750
Test: builds
Change-Id: I5fc3a759462cfd4342b9330ac8978368feee26ca
2023-07-07 18:36:08 +00:00
Colin Cross
ff3ff7f354 Add tests for code that will be affected by resource processor feature
Add a test for the aapt2 resource processing code that will be affected
by the resource processor feature in a subsequent CL.

Test: TestAndroidResourceProcessor
Change-Id: I39712853f7bbfb7963f1b71e234d039d5ccaae53
2023-07-07 10:58:31 -07:00
Treehugger Robot
ece97e5658 Merge "Suppress resourceshrinker stdout in soong" 2023-06-30 23:26:28 +00:00
Nicolas Geoffray
3799533b87 Merge "Don't strip oat files on host." 2023-06-30 10:49:50 +00:00
Jihoon Kang
ca198c2639 Extract class files from dep_api_srcs instead of java files
Currently, stub java files are extracted from srcjar file provided from
dep_api_srcs in java_api_library module generated in java_sdk_library
per api scope. However, compiling the java files may lead to difference
in the content of the generated class files even if the stub java files
are equivalent, as javac may arbitrarily add overridden methods. Thus,
create a stub jar file instead of creating a stub srcjar file and
compiling it, in order to guarantee stub jar files content equivalence
and thus enable hiddenapi during from-text stub build.

Note that this change does not fully resolve differences between the
full api surface csv and the per sdk_library csv. Instead, it removes
the difference caused by methods arbitrarily added by javac.

This change also renames dep_api_srcs to full_api_surface_stubs to be
more intuitive.

Test: rebase on top of aosp/2617274 and `m --build-from-text-stub`
Bug: 275570206
Change-Id: I22b6d56624633681f5c3b000370b5782655c7b8d
2023-06-29 22:43:05 +00:00
Treehugger Robot
da169a1ee3 Merge "Fix FirstUniqueStrings after conversion to generics" 2023-06-29 18:46:20 +00:00
Zi Wang
187aa29056 Merge "Use java_library_host bp2build converter for tradefed_java_library_host" 2023-06-29 18:03:22 +00:00
Nicolas Geoffray
1ad8a13e47 Don't strip oat files on host.
We need the debugging info for perf.

Test: m
Change-Id: Iceaa72d8b1c7d27ea113ca72c8af1174ce6f05ba
2023-06-29 15:45:39 +01:00
Kenneth Ford
ba283992ef Revert "Enable R8 full mode by default for apps"
This reverts commit 93d0bffafe.

Reason for revert: Possible culprit for b/289285719

Change-Id: If818db9d38008ea9d8c7813b9f6fabc2975e8507
2023-06-28 23:29:21 +00:00
Jiakai Zhang
51b2a8b5eb Use per-app package list to avoid unnecessary dexpreopt.
Starting from aosp/2594905, dexpreopt depends on
`$PRODUCT_OUT/product_packages.txt`. When PRODUCT_PACKAGES changes,
dexpreopt has to rerun for all apps. This is not ideal.

After this change, dexpreopt uses a per-app product_packages.txt that is
filtered by the app's dependencies, and it uses `rsync --checksum` to
prevent the file's mtime from being changed if the contents don't change.
This avoids unnecessary dexpreopt reruns.

Bug: 288218403
Test: m
Test: Change PRODUCT_PACKAGES and see no dexpreopt reruns.
Change-Id: I5788a9ee987dfd0abfd7d91cbcef748452290004
2023-06-28 17:59:56 +01:00
Zi Wang
3096e68e64 Use java_library_host bp2build converter for tradefed_java_library_host
Test: presubmit

Bug: 285959156
Change-Id: I18cefd4bf71b674771718411887b140a5d61d3f6
2023-06-27 15:44:10 -07:00
Jared Duke
93d0bffafe Enable R8 full mode by default for apps
This provides significant size savings over the default compatibility
mode, roughly ~20MB in aggregate for a recent Pixel build. Targets can opt out using `proguard_compatibility = true`.

Future work will enable for all targets, not just apps, but this
incremental change yields the most benefit.

Bug: 215530220
Test: m + presubmit
Change-Id: I52a9b27ebe71835849e200e23ae2a250eaf1bbe1
2023-06-27 22:33:58 +00:00
Colin Cross
48016d5a2f Fix FirstUniqueStrings after conversion to generics
The conversion of FirstUniqueStrings to be implemented on top of the
generic firstUnique accidentally used a different threshold to switch
from the list implementation to the map implementation.  Modify the
threshold of firstUnique to match the old value from FirstUniqueStrings
now that it doesn't have the reflection overhead.  While we're at it,
also make firstUnique make a copy of the list, and make FirstUniqueStrings
a pure wrapper around firstUnique.

Test: BenchmarkFirstUniqueStrings
Change-Id: Icc2febea663142c508ff2e4be65a8a68121631d5
2023-06-27 11:07:55 -07:00
Treehugger Robot
a41c679fe1 Merge "Cleanup remaining android.JavaApiLibraryName() references" 2023-06-23 21:35:02 +00:00
Colin Cross
313d32f730 Merge "Use generics for DepSets" 2023-06-22 20:57:01 +00: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
Colin Cross
c85750bfe3 Use generics for DepSets
Use Go's generics for DepSets so they don't require a type-specific
wrapper and reflection.

Test: depsets_test.go
Change-Id: I22ba0b7d680d37d2cd05230b0f560d166c4dd20b
2023-06-22 08:18:33 -07:00
Paul Duffin
c0036491cd Remove reference to the deprecated and disabled Typo issue
Metalava no longer looks for common typos. It relies on the code
analyzers that run on Gerrit to detect them.

Bug: 288072162
Test: m checkapi
Change-Id: I08eca8008af39ebe69442db419ebd3d3378aa0de
2023-06-21 15:42:49 +01:00
Jared Duke
91f32e7ae5 Suppress resourceshrinker stdout in soong
The resourceshrinker command prints an info log for successful runs,
which we don't really need to surface in build output. Suppress stdout
for such invocations; errors will surface through stderr.

Bug: 202959019
Test: m + compare log output
Change-Id: I08ed465bb7e3a0fa8d5e967d858f6739b5ef7fad
2023-06-16 23:12:33 +00:00
Christopher Parsons
df9c3441aa Merge "Provide reason for unconverted bp2build modules" 2023-06-16 13:49:49 +00:00
Chris Parsons
39a169721c Provide reason for unconverted bp2build modules
This also changes the expectation of ConvertWithBp2build. Each
implementation must either create one or more Bazel target modules, or
mark the module as unconvertible (with a specific reason).

Manually verified no runtime hit in AOSP
In AOSP, the metrics file size increases from 252K to 1.6M

This changes some effective module counts in bp2build metrics:
 - Removes "package" modules from the module count list in
metrics, as these will not be converted like regular modules.
 - Counts Handcrafted modules as being "unconverted", as bp2build is not
   responsible for them.

Bug: 285631638
Test: Verified generated BUILD.bazel files are bit-for-bit identical
with this change
Test: Manually verified one case of each implemented reasonType

Change-Id: I308dd451d8f28379b15671dae9f931bd0446f5c1
2023-06-16 13:45:17 +00:00
Treehugger Robot
0e7d0fa05c Merge "Dynamically link static libs for sdk_library created java_library" 2023-06-15 23:39:39 +00:00
Jihoon Kang
6c0df88809 Cleanup remaining android.JavaApiLibraryName() references
Since the name of the java_library generated from sdk_library per api
scope does not depend on the build configuration anymore, all
dependency switching "magic" via android.JavaApiLibraryName() can be
removed.

This change also removes from-text-build-specific test cases, as those
test cases depend on build configurations.

Test: m nothing && m nothing --build-from-text-stub
Bug: 287340610
Change-Id: I3bac35259e0cbaa16432a46cb2b128951c9bc075
2023-06-15 19:42:34 +00:00
Jihoon Kang
1147b31eb0 Dynamically link static libs for sdk_library created java_library
Rename java_library created inside sdk_library with the ".from-source"
suffix, and set it as static lib of the top level java_library, which
gets java_api_library instead as static lib during from-text stub build.

Test: m nothing && m nothing --build-from-text-stub
Bug: 286446015
Change-Id: I32e8ea264987e9f9df05e462292bd54e45074912
2023-06-15 18:18:09 +00:00
Chris Parsons
715c417ba3 Remove print statement
I suspect this was accidentally committed. We shouldn't just printf such
a statement every build analysis.

Test: Presubmits
Change-Id: If5ee66ce1b366f28254cd1bfdcaed9e085a60094
2023-06-14 16:24:37 +00:00
Zi Wang
6a66e3d01e Support multiple filters in zipsync
Also applied this feature to kotlinc since it needs both java and kt files.

Test: local test and presubmits

Bug: 287071909
Change-Id: I28c725b03115aef47055448cb75412980015da15
2023-06-14 06:44:49 +00:00
Sorin Basca
5498faf505 Merge "Revert^2 "Add exports needed for Doclava"" 2023-06-12 14:53:14 +00:00
Joe Onorato
175073c472 Make aconfig flags generate a library instead of a srcjar.
Also add unit tests for the rest of device_config

Bug: 283475679
Test: m nothing (soong unit tests)
Change-Id: Iee18a1f2f2cbb23e8c8d84c54e903b32be29a693
2023-06-09 06:16:06 -07:00
Sorin Basca
a7b777f800 Revert^2 "Add exports needed for Doclava"
a39209b565

Change-Id: Ib7c674e5142d2dff719d14092ac5383b6484d54c
2023-06-09 09:19:36 +00:00
Treehugger Robot
f253d23e95 Merge changes from topic "cc_stem"
* changes:
  Remove modules from denylist
  Update runpath for jni libs
  bp2build support for stem
2023-06-08 22:38:34 +00:00
Himanshu Rawat
4ead3a807d Merge "Revert "Add exports needed for Doclava"" 2023-06-08 16:45:02 +00:00
Himanshu Rawat
a39209b565 Revert "Add exports needed for Doclava"
Revert submission 2615972-b-270335653-doclava-search-imports

Reason for revert: DroidMonitor: Potential culprit for Bug 286398320 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted

Reverted changes: /q/submissionid:2615972-b-270335653-doclava-search-imports

Change-Id: Ibc3bdb301110b564e1427432a1b530e07bb840cd
2023-06-08 16:12:31 +00:00
Treehugger Robot
02761e58a0 Merge "Add exports needed for Doclava" 2023-06-08 15:35:48 +00:00
Jihoon Kang
346a117921 Create bp2build converter for platform_compat_config module type
This change adds bp2build converter for platform_compat_config module
type and its corresponding test case.

Bug: 269202028
Test: bp2build unit tests
Change-Id: I17d560c8f0e725efe69e151685d003c3dcb11f2f
2023-06-06 19:35:36 +00:00
Jihoon Kang
4190764669 Merge changes from topic "android_stubs_current_refactor"
* changes:
  Cleanup android.JavaApiLibraryName references
  Redefine core and core platform API surface java_library
  Introduce product variable Build_from_text_stub
  Introduce "Exclude_static_libs" property for Java modules
2023-06-06 19:16:25 +00:00
Anton Hansson
efd18370b0 Merge "Allow Bluetooth to use privapp_allowlist" 2023-06-06 18:29:07 +00:00
Sorin Basca
23741cac4d Add exports needed for Doclava
Bug: 270335653
Test: m doclava docs dist
Change-Id: Id46c877ddfd64b36f1ee96a7678076af69d91cdb
2023-06-06 09:43:53 +01:00
Spandan Das
5dba0ec98c Update runpath for jni libs
To support stem, cc libraries will be generated in
<pacakge_name>/<label.name>. Update RUNPATH of java binaries so that it
can find its jni deps

Test: bp2build
Test: TH
Bug: 240563612
Change-Id: Ia2f70f0424a8526ee35856225c1a8cd1067a8570
2023-06-06 00:07:40 +00:00
Spandan Das
91a8820688 Merge changes from topics "xsd_config_bp2build_cc_rdeps", "xsd_config_bp2build_java_rdeps"
* changes:
  bp2build for cc libraries that use xsd_config as gen srcs
  bp2build for java libraries using xsd_config srcs
2023-06-05 22:23:37 +00:00
Jihoon Kang
91c839566e Cleanup android.JavaApiLibraryName references
This change cleans up references to android.JavaApiLibraryName() so that
rdeps link against "android_*_stubs_current" instead of
"android_*_stubs_current.from-text".

Bug: 284995489
Test: m
Change-Id: Ibdf33b15981317c43e468dbc1657229d54bbd226
2023-06-05 21:45:01 +00:00
Jihoon Kang
67b6443258 Redefine core and core platform API surface java_library
Redefined core and core platform API surface java_library using the
product variable build_from_text_stub so that the correct static libs
are linked based on build configuration

Test: m --build-from-text-stub and verify no ninja path between "core.current.stubs" and "core.current.stubs.from-source"
Bug: 285410821
Change-Id: I26febc65697be6278624a504ffbb61be0953d798
2023-06-05 21:44:33 +00:00
Jihoon Kang
381c2fa27c Introduce "Exclude_static_libs" property for Java modules
Exclude_static_libs property can be used to specify static libs that
should not be used to build the module. The list acts as filter for
static_libs.

Bug: 285410821
Test: go test ./java
Change-Id: Iee7f160ba88b5f64bdd265c30d47c9f51feb0f5e
2023-06-05 21:42:48 +00:00
Mark Teffeteller
3bc9c57dc4 Merge "Add use_platform_libs to fuzz config" 2023-06-05 14:41:51 +00:00
Anton Hansson
e3f31cfd1e Allow Bluetooth to use privapp_allowlist
Apparently there's some special case-code in package manager that
scans apps as privileged regardless of their location. BT is one
such app -- so allow it to specify a privapp allowlist even though
it isn't in priv-app.

Bug: 284500052
Test: use privapp_allowlist in Bluetooth and its overriddes
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a91268a690e2aa98a0fa7b376a948a48f41b1265)
Merged-In: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
Change-Id: Ib9ac86ebc45087a176100fe8df07db7bf81a85a7
2023-06-03 08:53:47 +00:00
Jiakai Zhang
48203e3dee Add an allowlist for modules that have broken optional_uses_libs.
Bug: 282877248
Test: m nothing
Change-Id: I1afe9d523af0633f0428d4c15e1417db1dae4e93
2023-06-02 23:42:53 +01:00
Jiakai Zhang
f508c252bb Merge "Drop INTERNAL_PLATFORM_MISSING_USES_LIBRARIES." 2023-06-02 14:59:10 +00:00
Mark
f736b924db Add use_platform_libs to fuzz config
BUG: b/279082026
TEST: mma <java_fuzz>
Change-Id: Ia3dba44f66ec18d1076f1b13cc654a35b31c02d4
WANT_LGTM=ccross
2023-06-02 14:46:53 +00:00
Treehugger Robot
b25cbb3449 Merge "Support test runnner option in auto generated test configs" 2023-06-02 11:20:23 +00:00
Anton Hansson
672c1467d5 Merge "Change install name of privapp allowlists" 2023-06-02 08:19:21 +00:00
Anton Hansson
0e486a4198 Change install name of privapp allowlists
Use the APK's filename as the on-device filename for the allowlist.
Previously the filename of the source xml file was used, which leads to
a problem when the same source file is used for different apps (even
if only one of those modules ends up being installed).

Bug: 284500052
Test: app_test.go & presubmit boot tests
Change-Id: I0b43a35e3a310464d79d7f37e0900d639f4a479c
2023-06-02 08:18:42 +00:00
Zi Wang
4af4ff33f0 Merge "Add simple bp2build converter for java_test_host" 2023-06-01 22:37:28 +00:00
Paul Duffin
f6b1e23448 Merge "Explicitly specify --api-overloaded-method-order source for metalava" 2023-06-01 22:10:24 +00:00
Spandan Das
370f13c3bd bp2build for java libraries using xsd_config srcs
In Soong, java libraries can use src files generated from xsd_config. In
Bazel, instead of providing srcs, java_xsd_config_library will provide a
jar. Update bp2build so that all src references to xsd_config modules in
srcs get routed to deps and exports attributes

This CL creates an interface in build/soong/android to get around a
circular dependency issue. The bp2build logic needs to exist in
soong-java, but soong-java does have soong-xsdc in its package path. Use
the interface and type assertions to special case xsd_config references

Bug: 211678537
Test: bp2build test in sibling CL in system/tools/xsdc
Change-Id: Ida924bb20b1fd7eb8beeef950b070d37a9c6f3b5
2023-06-01 19:12:12 +00:00
Treehugger Robot
f618c60df6 Merge "Only pass "-Xgc:CMC" when building for Android." 2023-06-01 17:59:45 +00:00
Paul Duffin
7202ffebf9 Explicitly specify --api-overloaded-method-order source for metalava
Previously, `--api-overloaded-method-order source` was the default if
that option was not specified but the other change in this topic is
switching it to `--api-overloaded-method-order signature` to match the
behavior in AndroidX. This change explicitly specifies the option
needed by Soong's use of metalava.

Bug: 285140653
Test: m checkapi
Change-Id: I00e049e0d991e650ab9940a3d495ed2b6e7480f8
2023-06-01 18:45:51 +01:00
Zi Wang
65b36729c3 Add simple bp2build converter for java_test_host
Bug:281551424

Test: java_test_host_conversion_test.go and presubmits
Change-Id: I43ed26df0bacd63ef402de4d9733d19604005c35
2023-06-01 10:37:09 -07:00
Paul Duffin
5b7035f850 Explicitly specify --api-class-resolution api for metalava
Previously, `--api-class-resolution api` was the default if that option
was not specified but the other change in this topic is switching it to
`--api-class-resolution api:classpath` to match the behavior in
AndroidX. This change explicitly specifies the option needed by Soong's
use of metalava.

Bug: 285140653
Test: m checkapi
Change-Id: Ief3c7f9dfdfa946f21cb048a579ec90309fb350f
2023-06-01 15:26:40 +01:00
Jiakai Zhang
4f65a03d30 Drop INTERNAL_PLATFORM_MISSING_USES_LIBRARIES.
Bug: 282877248
Test: Presubmit build tests.
Change-Id: Idd69433f308f5f47973ff0d5340a2399a27cb32c
2023-06-01 15:21:42 +01:00
Jiakai Zhang
225c4767ac Only pass "-Xgc:CMC" when building for Android.
The runtime always uses CC on host unless CMC is explicitly asked
(http://cs/android-internal/art/runtime/gc/collector/mark_compact.cc;l=212-214;rcl=50fe05b4f4650bc0888d2c218a1bfa476f811ea0).
This CL matches the build system behavior with the runtime.

Bug: 285228269
Test: m test-art-host-gtest-art_dex2oat_tests
Change-Id: I652ad6f754ab8c51283e5fb0e9e1ba644629fa11
2023-06-01 13:27:25 +00:00
Jiakai Zhang
5324cc84ad Merge "Move CLC construction to Ninja phase." 2023-05-30 14:58:15 +00:00
Jiakai Zhang
a449678996 Move CLC construction to Ninja phase.
Before this change, dexpreopt was often broken with optional libraries.
This was because the CLC construction was done in Soong at an early
stage, where we don't have sufficient information to determine whether
an optional library is installed or not.

For example, the "Settings" package uses an optional library called
"androidx.window.extensions". On some devices, the library is installed,
but on some other devices, it's not. Soong always adds the library to
the CLC, meaning the CLC is wrong for devices which don't have the
library. This change fixes the problem. See the tests below.

After this change, the CLC construction is done by a Python script
invoked at a very late stage. It uses product_packages.txt, which is
generated by Make, to determine whether an optional library is
installed or not, and filter out libraries that are not installed.

Note that optional libraries are still added as dependencies by Soong.
This is because dependencies have to be added at an early stage. This
means what dex2oat eventually uses will be a subset of the dependencies,
which is fine.

Bug: 282877248
Test: m
Test: atest construct_context_test
Test: -
  1. lunch aosp_cf_x86_64_phone-userdebug && m
  2. Check the .invocation file of the "Settings" package (defined in
     .bp file)
  3. See androidx.window.extensions
Test: -
  1. lunch aosp_redfin-userdebug && m
  2. Check the .invocation file of the "Settings" package (defined in
     .bp file)
  3. Don't see androidx.window.extensions
Test: Check the .invocation file of the "Dialer" package (defined in
  .mk file)
Test: -
  1. Build a Pixel 5 system image and flash it to a Pixel 5 device.
  2. adb shell pm art dump
  3. See "reason=prebuilt" instead of "reason=vdex".
     (https://diff.googleplex.com/#key=fB6Ls9q2QGSN, before: left,
     after: right)

Change-Id: Ia112bd7c2328373e68db6bffb74bf34030f683d8
2023-05-30 15:46:38 +01:00
Dan Shi
ec7314336a Support test runnner option in auto generated test configs
Bug: 284179405
Bug: 236980335
Test: unittest
Change-Id: Ifae3d556ff79153ca6c3067347fc259b665fb2e1
2023-05-26 21:34:22 +00:00
Alix Espino
e5641c51b9 Merge "bp2build java_resources that only contain a filegroup" 2023-05-26 13:59:42 +00:00
Anton Hansson
0c6ae56eea Merge "ensure that privapp_allowlist is installed before android_app" 2023-05-26 07:17:37 +00:00
Cory Barker
70b2292646 Merge "Add both classes jar and dexed jar to java_fuzz module packaged output for dist as we move towards instrumentation at runtime" 2023-05-25 23:26:28 +00:00
Jihoon Kang
de68c07ce5 Merge "Modify error emit condition for checking api files in java_api_library" 2023-05-25 21:09:40 +00:00
Sam Delmerico
b1daccdc97 ensure that privapp_allowlist is installed before android_app
AndroidMk assumes that the app is the last file installed, and it uses
this assumption to populate the LOCAL_SOONG_INSTALLED_MODULE entry. This
CL moves the privapp_allowlist installation to before the app
installation to respect this assumption.

Bug: 242509786
Test: go test
Test: OUT_DIR=out.ref m nothing &&
  cp aosp/2562351 && OUT_DIR=out.change m nothing &&
  GOWORK=$PWD/build/bazel/mkcompare/go.work \
  go run android/bazel/mkcompare/cmd -json \
  <(sed -e "s/out\.ref/out/g" out.ref/soong/Android-aosp_cheetah.mk) \
  <(sed -e "s/out\.change/out/g" out.change/soong/Android-aosp_cheetah.mk)
  && verify manually that the only diffs are related to the removal of
  the prebuilt_etc module.
Change-Id: I95ec27070f575e79fb976de68493a219717ed89a
2023-05-25 18:54:06 +00:00
Jihoon Kang
160634ca3d Modify error emit condition for checking api files in java_api_library
java_api_library currently emits error based when the
java_api_contribution module has an empty api file or when the module
does not have any api files. This may be problematic in partial
manifests where allow missing dependency is set, thus add this condition
for error emission.

Test: go test ./java
Bug: 284212875
Change-Id: I10b4baa5723e7a53d931823b3029ea20ac731911
2023-05-25 05:28:29 +00:00