Commit graph

7079 commits

Author SHA1 Message Date
Anas Sulaiman
f76b3267d5 Merge "support toggling compare mode for rbe actions" into main 2023-10-20 14:41:18 +00:00
Jihoon Kang
04803d4767 Merge "Disable from-text stub build for coverage build" into main 2023-10-19 19:22:33 +00:00
Cole Faust
14c1ed8d7d Merge "gofmt soong" into main 2023-10-19 03:48:45 +00:00
Cole Faust
06ea531ab3 gofmt soong
Test: Presubmits
Change-Id: Ia76c35ba51685eca29df51738000eacd3f43ce20
2023-10-18 17:42:59 -07:00
Treehugger Robot
8e592ad109 Merge changes from topic "revert-2786699-import-sdk-version-none-WYNCDQGHTE" into main
* changes:
  Revert "Don't use java_library for java_import neverlink"
  Revert "Do not convert sdk_version: "none""
2023-10-18 23:38:27 +00:00
Treehugger Robot
eecf47b14c Merge "Shard Javac" into main 2023-10-18 22:20:39 +00:00
Liz Kammer
e11182283f Revert "Don't use java_library for java_import neverlink"
Revert submission 2786699-import-sdk-version-none

Reason for revert: b/306220520

Reverted changes: /q/submissionid:2786699-import-sdk-version-none

Change-Id: I4fbe5fa54dc11fac898a7f15704833f01b9fa269
2023-10-18 20:38:37 +00:00
Liz Kammer
05f487a4cd Revert "Do not convert sdk_version: "none""
Revert submission 2786699-import-sdk-version-none

Reason for revert: b/306220520

Reverted changes: /q/submissionid:2786699-import-sdk-version-none

Change-Id: I309e269db70d9fedaf010ef44791516392fcb4ea
2023-10-18 20:38:37 +00:00
Anas Sulaiman
9c4936405e support toggling compare mode for rbe actions
This allows me to set metalava actions to run remotely (already toggleable) with local comparison (this CL).

Change-Id: I66b006d5ee11b3192ef81a2e5cefc07e9f3d10a2
2023-10-18 19:37:24 +00:00
Colin Cross
c292fa1797 Merge "Export resource processor R.jar files to ASfP" into main 2023-10-18 18:24:48 +00:00
usta
15ab550d04 Shard Javac
Test: m nothing
Test: allowlist frameworks/opt/calendar to bp2build convert
Test: add `javac_shard_size: 2` to calendar-common
Test: b //frameworks/opt/calendar:calendar-common
Bug: 297356812
Change-Id: Ie22bcf04946f3945952a74a46772b777b1522b70
2023-10-18 13:25:55 -04:00
Treehugger Robot
a815d9bf79 Merge changes from topic "import-sdk-version-none" into main
* changes:
  Do not convert sdk_version: "none"
  Don't use java_library for java_import neverlink
2023-10-18 17:17:59 +00:00
Liz Kammer
a855f73f4a Merge changes Iceb0b68f,I04865414 into main
* changes:
  Improve error message readability
  Share constants for droidstubs btw Soong & Bazel
2023-10-18 14:19:30 +00:00
Colin Cross
95b53b83eb Export resource processor R.jar files to ASfP
Export the R.jar files generated by ResourceProcessorBusyBox to
module_bp_java_deps.json for use by Android Studio for Platform.

Bug: 305997998
Test: examine module_bp_java_deps.json
Change-Id: I48e3e28b45219646765de7848ec9dbe77d14c662
2023-10-17 13:21:02 -07:00
Jihoon Kang
1975d3e326 Disable from-text stub build for coverage build
Coverage builds depend on `native` properties for API elements, which
are not included in the API signature files and consequently in
from-text stubs. As no robust solution for handling this has been
planned out at the moment, from-text stub build is disabled for
coverage builds.

Per go/android-code-coverage-quickstart , Java code coverage is
enabled by the three environment variables: `EMMA_INSTRUMENT`,
`EMMA_INSTRUMENT_STAIC` and `EMMA_INSTRUMENT_FRAMEWORK`. This change
disables from-text stub build if any of the three variables are set
to true.

Test: go test ./java && m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true nothing --build-from-text-stub and inspect ninja query to verify that the stub java library module depends on the from-source stub module
Bug: 304271961
Change-Id: Ie485c784145de6c253611e698354c4f9e4a30685
2023-10-17 20:00:12 +00:00
Treehugger Robot
2b808d0f22 Merge "Fix typo in droidstubs" into main 2023-10-17 15:39:40 +00:00
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
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
b5c3b018d9 Merge "Handle java_resources as deps" into main 2023-10-12 21:10:37 +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
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
57beac1b76 Merge "Ignore dex files in input archives" into main 2023-10-12 06:27:02 +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
c5be9361b6 Merge "Retain concrete overrides of abstract methods by default" into main 2023-10-11 21:02:17 +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
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
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
5a55439d12 Clean up obsolete aliases for Truth.
Bug: 255714762
Test: presubmit
Change-Id: I2d7ef129bc8cad247d805ad392f05cd9d517b67e
2023-10-07 19:59:58 +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
aa46295842 Merge "Remove unnecessary arch variant for patch module" into main 2023-10-06 15:20:20 +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