Commit graph

6893 commits

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