Export the list of required and provided native libs in the apex manifest.

These lists are used by linkerconfig on device to identify the
relationship between apexes and the libs they provide/require.

See https://cs.android.com/android/platform/superproject/+/master:system/linkerconfig/modules/apex.cc;l=181-184;drc=88eefd5fded5d1b21c47ab5a2dc6cf16bf284921

Summary of this change:

* Add a new action that modifies the final apex_manifest.pb with entries
pertaining to the native libs required by, and provided by, an apex.
* Apply the apex_cc_aspect on apex.binaries, so the transitive
shared lib dependencies of binaries are collected as well.
* Updated the apex_cc_aspect to export the list of required and provided
libs, based on the direct dependency state and whether the library
exports stubs.
    * If a library is a direct dep and a stub, the library is provided by the apex to the device.
    * If a library is not a direct dep and a stub, the library is
    required by the apex (i.e. provided by the platform or other APEXes).

The new tests closely model apex_test.go#TestDependenciesInApexManifest,
and the new diff test shows the new requireNativeLibs and
provideNativeLibs fields of the adbd apex manifest.

Test: CI (bp2build-incremental)
Test: b test //build/bazel/tests/apex/... --config=android_arm64
Test: b test //build/bazel/rules/apex/... --config=android_arm64

Bug: 235057628
Bug: 220030716
Bug: 215500321
Fixes: 222588061
Change-Id: Ib8b45c58a0197aa22371029320bc53f96b95c109
9 files changed
tree: 34ea4d092da6110f2c8e79619657311964c6b429
  1. ci/
  2. docs/
  3. examples/
  4. json_module_graph/
  5. mk2rbc/
  6. platforms/
  7. product_variables/
  8. rules/
  9. rules_cc/
  10. scripts/
  11. tests/
  12. vendor/
  13. bazel.BUILD
  14. bazel.sh
  15. bazel.WORKSPACE
  16. common.bazelrc
  17. darwin.bazelrc
  18. linux.bazelrc
  19. OWNERS
  20. README.md
README.md

Bazel

The code in this directory is experimental. Bazel support for Android Platform is undergoing active development and workflow stability is currently not guaranteed.