Add stub generation support to cc_prebuilt_library
The `stubs` property in `cc_prebuilt_library` currently does not support generating stubs from an API symbol file. Reverse dependencies are always linked against the .so file listed in `srcs`. This CL adds support to generate the shared library from the .map.txt symbol file of the prebuilt library. Implementation details: 1. Add a compiler. This will convert the .map.txt file to a stub .c file. The build rules for this are common to the compiler of the source cc_* moudule types. This has been refactored into a new function named `compileModuleLibApiStubs` 2. Update the linker to link the aforementioned stub.c file into a .so file. Since this happens only for stub variants, it is conditionally called only when p.buildStubs is true. 3. Call `addStubDependencyProviders`. This will populate the impl variant of the library with Stub information. cc#ChooseStubOrImpl will use this information to resolve rdeps to the stub .so file if the dependency crosses an api domain boundary. (2) requires some special casing for now, since the module sdk at HEAD does not contain symbol files, so the stub.c files will be empty. Once the symbol files are added to module sdk, the special casing will be removed. Test: m nothing --no-skip-soong-tests Bug: 275273834 Change-Id: I57f5b0a97fac4dfc8c24e07b06a330015add977d
Loading
Please register or sign in to comment