bp2build: cc_object converter.

This CL introduces a basic bp2build converter for cc_object modules.
cc_objects maps cleanly to cc_library targets, but with -fnoaddrsig.

This CL also demonstrates generating include deps within a macro to
allow the cc_object compilation to depend on a relative-include header
within an include dir.

e.g. if "foo.cc" includes "android/log.h" and the latter is located at
"include/android/log.h", the autogenerated header deps would export
"android/log.h" correctly to the foo.cc upstream target.

Test: GENERATE_BAZEL_FILES=true m nothing && bp2build-sync write && bazel build //bionic/libc:crtbegin_so1

Change-Id: Ifd9e097051ec184ab0a1929d07918f0ff4f24d98
This commit is contained in:
Jingwen Chen
2021-02-18 03:21:34 -05:00
parent abf3f3c0ef
commit 8c1b97e01b
7 changed files with 269 additions and 9 deletions

View File

@@ -86,6 +86,10 @@ func CcLibraryHeadersBp2Build(ctx android.TopDownMutatorContext) {
return
}
if !module.Properties.Bazel_module.Bp2build_available {
return
}
lib, ok := module.linker.(*libraryDecorator)
if !ok {
// Not a cc_library module
@@ -96,10 +100,6 @@ func CcLibraryHeadersBp2Build(ctx android.TopDownMutatorContext) {
return
}
if !lib.Properties.Bazel_module.Bp2build_available {
return
}
// list of directories that will be added to the include path (using -I) for this
// module and any module that links against this module.
includeDirs := lib.flagExporter.Properties.Export_system_include_dirs