Implement a (partial) cc_stub_library rule for cc_library.stubs in
Android.bp file.

This rule is responsible for emitting an object generated from a
.map.txt files for symbols associated to a shared library for a
particular API level. These libraries set the "stubs" property in their
Android.bp definitions. These libraries are used as build-time
dependencies of Mainline modules (not the platform, i.e. NDK!). For stub
libraries in the NDK, see ndk_library modules).

These dependencies are *not* included in the Mainline modules
themselves, because the non-stub versions are made available in the
device environment through other means (e.g. installed onto the system
partition or via other APEXes).

These libraries are ABI stable.

For this CL's scope, we introduce a new rule that calls ndkstubgen, a
python binary, on a library's .map.txt file, which is actually in the
format of a LD version script, to generate a .c file containing function
prototypes, and two additional metadata files. The .c file would be
eventually compiled into a stub .so, replacing the real .so for APEX
dependents.

The stub .so will be made available through a dedicated
cc_shared_library_proxy provider so dependents can easily determine if a
transitive dep has stubs for a requested API level.

Bug: 207812332
Test: CI
Change-Id: I47689c15c375b5dd9f5e70ad213d7d113a9442cc
5 files changed
tree: b10105a1f123a940ee808948f9d6ef5fa26b7660
  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. bazel.BUILD
  13. bazel.sh
  14. bazel.WORKSPACE
  15. common.bazelrc
  16. darwin.bazelrc
  17. linux.bazelrc
  18. OWNERS
  19. 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.