Commit Graph

7382 Commits

Author SHA1 Message Date
Liz Kammer
5dfe4be626 Do not convert sdk_version: "none"
These also require system_modules to be set. Wait until we convert
system_modules to convert sdk_version: "none"

Test: CI
Change-Id: I5bbdcb6819709a7c5a7932cb860a0de945f3528e
2023-10-17 09:10:13 -04:00
Liz Kammer
4e00b0929b Don't use java_library for java_import neverlink
Restricting use of sdk_version = "none" to only the rule types that will
correctly handled sdk_version = "none" by also handling system_module
attr

Test: CI && go tests
Change-Id: Ifa1c60ba8f5e3fcb28986cc84cdfaedcbd2d2957
2023-10-17 09:10:13 -04:00
Liz Kammer
e09e20ec47 Share constants for droidstubs btw Soong & Bazel
Test: m bp2build && verify constants
Change-Id: I04865414fb627672821b10d8bcc736379dc3da86
2023-10-17 09:10:08 -04:00
Treehugger Robot
c82e844121 Merge "Add assets property for Android apps." into main 2023-10-16 21:01:44 +00:00
Liz Kammer
170dd7239a Fix typo in droidstubs
Test: n/a
Change-Id: Idd58be843d01db008f1815f83149033bf5ac766d
2023-10-16 15:34:24 -04:00
Jiakai Zhang
ba82e28d5d Add assets property for Android apps.
This property is similar to `asset_dirs`, but for individual files. This
is especially useful when the user wants to pack generated asset files
into the APK.

Bug: 257532944
Test: m nothing
Change-Id: If3062124e9dedb41315dcaf5d379803e5419b8cd
2023-10-16 18:53:30 +01:00
Jihoon Kang
bc98b4151d Merge changes from topic "stub_validation" into main
* changes:
  Add current api check as validation for from-text stub generation
  Disable full_api_surface_stubs for some java_api_library modules
2023-10-16 16:34:41 +00:00
Colin Cross
e88d5b1796 Merge "Put shared library R.jar files in the classpath" into main am: 149f6f6f78 am: a43251d771
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2787024

Change-Id: I65bda887d0343e4501bc09a66f1d9fb523130ba2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 19:14:24 +00:00
Jihoon Kang
063ec003f9 Add current api check as validation for from-text stub generation
Currently, there is no build action ensuring that the API text files are
up to date, unless a user runs `m checkapi` or `m update-api`. This
means that the user must run `m update-api` after making a change that
modifies api surface(s), so that the API text file reflects the local
change. This adds additional layer of action to developers, and it is
not guaranteed that the developer will always run `m update-api` after
making an api surface-affecting changes.

To prevent such mistake, this change adds droidstub-level api check as
validation for from-text stub generation. With this change, the build
will fail if the API text file is not up to date and the user must run
`m update-api` when making api surface-affecting local changes.

The validation is done by adding all droidstubs modules associated with
the java_api_contributions passed to java_api_library via
`api_contributions` as dependency and setting the current api timestamp
files as the validations for the from-text stubs generating build rule.

The full api surface libraries will not run the validations to avoid
circular dependency. However, all java_sdk_library generated
java_api_library modules will run validations, mapped to the droidstubs
in the same api domaion.

If the user sets the environment variable `DISABLE_STUB_VALIDATION=true`, validation
actions are not run. Validation actions run by default.

Test: m nothing --build-from-text-stub and run ninja query to verify `check_current_api.timestamp`s are listed as validation \
      DISABLE_STUB_VALIDATION=true m nothing --build-from-text-stub and run ninja query to verify that validation actions are not added
Bug: 288624417
Change-Id: I329e6438fe8f3ac30d8c6a971d57853ed6b0d150
2023-10-13 18:24:41 +00:00
Colin Cross
149f6f6f78 Merge "Put shared library R.jar files in the classpath" into main 2023-10-13 18:08:04 +00:00
Jihoon Kang
d30ac8a32a Disable full_api_surface_stubs for some java_api_library modules
java_api_library modules generated from java_sdk_library get
full_api_surface_stubs corresponding to the api surface that the module
contributes to. However, modules generated from java_sdk_library where
sdk_version is none should not depend on the full api surface stub jar.

Test: m --build-from-text-stub
Bug: 288624417
Change-Id: I7edda3e6a40f739e805e8719b8d366da765a6933
2023-10-12 23:05:27 +00:00
Colin Cross
8676c8cba5 Put shared library R.jar files in the classpath
When building with use_resource_processor: true R.jar files from
shared andoid_library dependencies need to be added to the classpath
so that the generated R classes can be referenced.

Bug: 294256649
Test: m DocumentsUIPerfTests
Change-Id: I30a6bddc3f378ecf58f142f94049e67ba33a47e3
2023-10-12 16:01:04 -07:00
Liz Kammer
1f92c64dcd Merge "Handle java_resources as deps" into main am: b5c3b018d9 am: cd432e7a93
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2778708

Change-Id: I0a25be6a79d438ea0203c550b7c5864e5fb58574
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 22:15:53 +00:00
Liz Kammer
b5c3b018d9 Merge "Handle java_resources as deps" into main 2023-10-12 21:10:37 +00:00
Liz Kammer
91d416a75c Merge "Change openjdk9 specific props in bp2build/Soong" into main am: c723757dd7 am: b29d829e6b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2776469

Change-Id: I3b0ad4803f43854502ba88d543767f2160d313e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 20:51:55 +00:00
Liz Kammer
c723757dd7 Merge "Change openjdk9 specific props in bp2build/Soong" into main 2023-10-12 19:47:38 +00:00
Jihoon Kang
b37ad3e3fc Merge changes from topic "enable-hidden-api" into main am: e100a884e3 am: 632dd0ca85
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2617274

Change-Id: I18d6dd99fc3b0255c149b5345123fa6faffd784c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 18:08:45 +00:00
Jihoon Kang
e100a884e3 Merge changes from topic "enable-hidden-api" into main
* changes:
  Enable hiddenapi check for from-text stub build
  Utilize module lib and test api superset module in hiddenapi
2023-10-12 17:33:35 +00:00
Liz Kammer
93b7e9545e Handle java_resources as deps
Test: CI && unit tests
Change-Id: I51f3c7d876c3cc25cb0459d933e1a510cfb5bf13
2023-10-12 09:57:06 -04:00
Liz Kammer
9f52f6ba60 Change openjdk9 specific props in bp2build/Soong
JDK17 is the default java version, adding these props conditionally
openjdk9 is no longer relevant

Test: CI
Change-Id: I5d80fd22f474cedf389d1e295620cfc17bc327a0
2023-10-12 09:57:04 -04:00
Ian Zerny
be0874053a Merge "Ignore dex files in input archives" into main am: 57beac1b76 am: 44c234ecf1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2780987

Change-Id: I7408144c078f2eef7729bd53128e8e9b35104109
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 07:33:23 +00:00
Ian Zerny
57beac1b76 Merge "Ignore dex files in input archives" into main 2023-10-12 06:27:02 +00:00
Alix Espino
aa0e12c22b Merge "Use an option struct in aapt.buildActions & manifestMerger" into main am: 37e64f9c91 am: a51e83ac06
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2769926

Change-Id: I327c89db84f777efe1a2b84b35363501e0701830
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 03:57:08 +00:00
Alix Espino
37e64f9c91 Merge "Use an option struct in aapt.buildActions & manifestMerger" into main 2023-10-12 02:53:10 +00:00
Jihoon Kang
cc599888db Merge "Retain concrete overrides of abstract methods by default" into main am: c5be9361b6 am: 8f9d036314
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2781328

Change-Id: Iddf3556aa98fe3cc221f763cb7e30ff1f5dd45e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 21:26:06 +00:00
Jihoon Kang
059362b5b4 Merge changes I804d3597,I6a25e2f6 into main am: faf7251c7b am: fbe7a9e772
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2779190

Change-Id: I219a974ac1f39e58bc4a5c081f15c859064ffd72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 21:25:40 +00:00
Jihoon Kang
c5be9361b6 Merge "Retain concrete overrides of abstract methods by default" into main 2023-10-11 21:02:17 +00:00
Yu Liu
b17766ab16 Merge "Change java_test_host to support cov variant." into main am: 0bf0865f83 am: 8a5b48e26d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2776007

Change-Id: I4d3db4d5ea0ed49da736e970a4b2ff587c6931fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 18:19:13 +00:00
Jihoon Kang
244d42a91b Utilize module lib and test api superset module in hiddenapi
Hiddenapi takes a single widest api scope stub dex jar as an input, as
the tool does not support handling duplicate classes passed as inputs.
A problem regarding this is that the test and module lib api surfaces do
not strictly have a subset/superset relationship, unlike other api
surfaces.

This has not become a problem for stubs generated from source
files as the stubs contain all methods in the source files, but became a
problem for stubs genereated from text files as the stubs only contain
the methods that are essential for compilation of the stubs and its
reverse dependencies, and there were cases where the hiddenapi flags are
not properly propagated to the subclasses.

To resolve this problem, a java_api_library module that provides the
union of the test and the module lib api surfaces was introcudes. Since
hiddenapi_modular currently defines the module lib api surface to be a
wider api scope over the test api scope, the new module can be passed as
input to hiddenapi over the module lib non updatable stub module to
resolve the problem.

Test: enable hiddenapi for from-text stub build && ENABLE_HIDDENAPI_FLAGS=true m --build-from-text-stub
Bug: 191644675
Bug: 275570206
Change-Id: I9a230ec5082c52ed866f29b0748814f2cf10279b
2023-10-11 17:06:23 +00:00
Jihoon Kang
f00200b6fb Add module dependency checking testing method
Currently in Soong testing suite, the only method for testing module
dependency is CheckModuleDependencies(...), which comapares for the
exact module dependencies. This change adds the method
CheckModuleDependency(...) which enables checking the dependency between
two modules, instead of comparing for all dependencies of an interested
module.

Test: m nothing
Bug: 288624417
Change-Id: I804d35979ddc24b0134671e326c1d37615ec4190
2023-10-11 16:18:45 +00:00
Jihoon Kang
8f83dcd18c Add droidstub modules for Soong java testing
Previously, only the essential java_api_library and
java_api_contribution modules were being added to the template bp file
for testing purpose. However, since the child change aosp/2640275
adds droidstubs that generates the java_api_contribution as the
dependency of the java_api_library modules, not adding the droidstubs
modules to the template bp file will lead to missing dependency errors
in Soong test cases that tests the from-text generation &
java_api_library functionality.

To prevent this, this change adds the droidstubs modules instead of the
auto generated java_api_contribution modules to the template bp file to
more closely align with the real life behavior.

Test: m nothing
Bug: 288624417
Change-Id: I6a25e2f6c5f1281e96eca15aa5eec7417635df3f
2023-10-11 16:17:55 +00:00
Yu Liu
0bf0865f83 Merge "Change java_test_host to support cov variant." into main 2023-10-11 16:15:40 +00:00
Zhi Dou
20078e9795 Add UnsupportedAppUsage to java_aconfig_library dependency am: 1b052b0078 am: 06f6aa131a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2776648

Change-Id: I9daf3f5063d1742f524e32234c8a00c332ff969e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 00:37:16 +00:00
Yu Liu
d8aa20062a Change java_test_host to support cov variant.
Bug: 279960392
Test: CI and m --skip-soong-tests TARGET_PRODUCT=aosp_x86_64 EMMA_INSTRUMENT=true CLANG_COVERAGE=true NATIVE_COVERAGE_PATHS="external/cronet" mts
Change-Id: I4489ed725aee6097e6e340f5f6d06ecaf1c64222
2023-10-10 16:00:32 -07:00
Jihoon Kang
c1f2ef053a Merge "Introduce system_modules property to java_api_library" into main am: 90c3f5fac4 am: 6df74f24b6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2774869

Change-Id: I9306c7be5a60431b2ae326c638729feedd7bbf97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 20:09:58 +00:00
Zhi Dou
1b052b0078 Add UnsupportedAppUsage to java_aconfig_library dependency
Generated flag requires UnsupportedAppUsage annotation to expose the
flag to CTS tests.

Bug: 301272559
Test: presubit
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5e2c96a93b4c16b224c090570a10697400a42c0a)
Merged-In: I90c87596ca80766ece429ddee1b45723b01d2760
Change-Id: I90c87596ca80766ece429ddee1b45723b01d2760
2023-10-10 19:36:00 +00:00
Jihoon Kang
90c3f5fac4 Merge "Introduce system_modules property to java_api_library" into main 2023-10-10 18:33:18 +00:00
Paul Duffin
629b9d287d Retain concrete overrides of abstract methods by default
Bug: 299366704
Test: m checkapi
Change-Id: I3d9fafefe90a98568c16d80c30e4d1d88a22c350
2023-10-10 17:50:25 +01:00
Alix
f7a1027c6b Use an option struct in aapt.buildActions & manifestMerger
Change-Id: Ia056ab321e1fd146ed0cdb98fc2d4455601f648c
Test: Treehugger
2023-10-10 14:31:03 +00:00
Ian Zerny
db2d35b8ac Ignore dex files in input archives
Bug: 303264288
Test: m checkbuild
Change-Id: Idce6a8226ca94b257b0ba7b3416b5b1bbffc3140
2023-10-10 14:35:14 +02:00
Jihoon Kang
4ec24870e0 Introduce system_modules property to java_api_library
System_modules property provides the jars passed as bootclasspath when
compiling the stubs in the java_api_library where its creating
java_sdk_library's sdk_version is none, as the jars will not be provided
from the full_surface_stub_libs but compiled by itself in the child
change.

The jar provided by the system_modules will also be passed to metalava
to resolve hierarchy coming from outer dependencies.

Test: m --build-from-text-stub
Bug: 288624417
Change-Id: I8f3b89efa24bceb070d7a37fae3c7334dd7f0868
2023-10-09 17:44:54 +00:00
Krzysztof Kosiński
f0b5c69f64 Clean up obsolete aliases for Truth. am: 5a55439d12 am: fd3d016a70
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2778191

Change-Id: I2100953abf25bf9fb1cbc52530002d94612c5685
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-08 04:12:44 +00:00
Krzysztof Kosiński
5a55439d12 Clean up obsolete aliases for Truth.
Bug: 255714762
Test: presubmit
Change-Id: I2d7ef129bc8cad247d805ad392f05cd9d517b67e
2023-10-07 19:59:58 +00:00
Treehugger Robot
459c689b9d Merge "Update Headers_only to a bool pointer" into main am: 9ea1d061b7 am: 077566faf4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2775982

Change-Id: If3d23d2c67d81becc00332cac5cf022e451a158d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 20:37:07 +00:00
Treehugger Robot
9ea1d061b7 Merge "Update Headers_only to a bool pointer" into main 2023-10-06 19:59:17 +00:00
Treehugger Robot
21698a7c14 Merge "Remove unnecessary arch variant for patch module" into main am: aa46295842 am: 633fde4719
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2775981

Change-Id: Ie82f053a6e2d5e576ad1f5df2157c78c51117769
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 16:46:13 +00:00
Treehugger Robot
aa46295842 Merge "Remove unnecessary arch variant for patch module" into main 2023-10-06 15:20:20 +00:00
Zi Wang
b55cc83aa5 Merge "Add support for java_library proto plugin in bp2build" into main am: b0f3ff43e5 am: 674022ced0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2768495

Change-Id: I383f1241634231f84aac1dd17a4743b28a16c473
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 23:42:54 +00:00
Liz Kammer
6077263084 Update Headers_only to a bool pointer
This makes it easier to identify intentionally setting the property

Test: m nothing
Change-Id: Id89d1e64da3809025f63cafe7557e57a80e0ffee
2023-10-05 17:18:44 -04:00
Liz Kammer
0a470a3c14 Remove unnecessary arch variant for patch module
Test: CI
Change-Id: Ibc058407ffb09afa38d9248f4391019e8786602b
2023-10-05 17:02:00 -04:00