Commit graph

6943 commits

Author SHA1 Message Date
Treehugger Robot
3fb2002c9e Merge changes I86f30b99,I2769c0d5 into main
* changes:
  Do not convert resource dirs without resources
  Do not convert java libraries with core_platform
2023-09-08 16:04:45 +00:00
Liz Kammer
33dddf5a7e Do not convert resource dirs without resources
Previously we would convert to java_resources when there were no
resources and get an error.

Test: b build //external/libphonenumber/... --config=android
Change-Id: I86f30b993a3ffdb20000f6a4c5261e2c4c74263c
2023-09-08 09:44:00 -04:00
Liz Kammer
65942c8467 Do not convert java libraries with core_platform
Test: go bp2build tests
Change-Id: I2769c0d589c304caeb24a8ecba38a4a5ee6c63e5
2023-09-08 09:43:57 -04:00
Treehugger Robot
8763530dff Merge "android_app APEX_GLOBAL_MIN_SDK_VERSION_OVERRIDE" into main 2023-09-07 16:55:45 +00:00
Cole Faust
1b365e350a Merge "Revert^2 "Only allow setting presigned without preprocessed on targetSdk < 30"" into main 2023-09-07 16:42:08 +00:00
Treehugger Robot
968c735108 Merge "Modify static lib stub library visiblity" into main 2023-09-07 12:07:17 +00:00
Cole Faust
51d7bfd9a1 Revert^2 "Only allow setting presigned without preprocessed on targetSdk < 30"
This reverts commit d293e28f52.

Reason for revert: The underlying issue was fixed in ag/24685010

Change-Id: I06810d37dba37aa12f9a1e14b0749f1e1eb41136
2023-09-07 05:31:32 +00:00
Jihoon Kang
786df93db0 Modify static lib stub library visiblity
java_sdk_library generates stub java_library module which compiles the
stub generated from either source or txt files, which is toggled based
on the build configuration. The java_api_library/java_library module
that compiles the stubs should not be directly accessible to the modules
outside of the sdk_library module scope, thus modify their visibility as
private.

Test: m nothing
Bug: 299373105
Change-Id: Ia4a08bf6e65c521814c82f54ea43cc8d367834e3
2023-09-07 01:22:12 +00:00
Karl Shaffer
d79c10f71f Merge "Revert "Only allow setting presigned without preprocessed on targetSdk < 30"" into main 2023-09-07 00:58:24 +00:00
Karl Shaffer
d293e28f52 Revert "Only allow setting presigned without preprocessed on targetSdk < 30"
This reverts commit 6158528e15.

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=git_udc-d1-dev-plus-aosp&target=aosp_bramble-trunk_staging-userdebug&lkgb=10771573&lkbb=10771600&fkbb=10771587, bug https://buganizer.corp.google.com/issues/299369971

BUG: 299369971

Change-Id: I6bf6eb5c0fb9e30197e145121adc7ed58871526f
2023-09-07 00:51:09 +00:00
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
765beb237a Merge "Bp2build support for app R8-related fields" into main 2023-08-31 18:54:49 +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
f236cd9247 Merge "Add do not convert for sdk_version unset" into main 2023-08-30 16:59:50 +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
Todd Lee
5b6d1d87d6 Merge "Support for incremetal platform prebuilt APIs" into main 2023-08-28 18:42:58 +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
5dbb696c53 Merge "support for multiple filegroups and resource_dirs" into main 2023-08-28 17:10:13 +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
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
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
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
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
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