bp2build: make libdl build.

This CL adds support for the static and shared props, forwarding
whole_static_libs and srcs to the underlying shared library's
static_deps and static library's srcs respectively.

Test: TH
Fixes: 186609667
Change-Id: I84f838361c7758b256b2a163af894c502de03109
This commit is contained in:
Jingwen Chen
2021-04-29 08:15:13 +00:00
parent af44591fbe
commit 53681ef590
4 changed files with 105 additions and 13 deletions

View File

@@ -217,13 +217,14 @@ func RegisterLibraryBuildComponents(ctx android.RegistrationContext) {
// For bp2build conversion.
type bazelCcLibraryAttributes struct {
Srcs bazel.LabelListAttribute
Hdrs bazel.LabelListAttribute
Copts bazel.StringListAttribute
Linkopts bazel.StringListAttribute
Deps bazel.LabelListAttribute
User_link_flags bazel.StringListAttribute
Includes bazel.StringListAttribute
Srcs bazel.LabelListAttribute
Hdrs bazel.LabelListAttribute
Copts bazel.StringListAttribute
Linkopts bazel.StringListAttribute
Deps bazel.LabelListAttribute
User_link_flags bazel.StringListAttribute
Includes bazel.StringListAttribute
Static_deps_for_shared bazel.LabelListAttribute
}
type bazelCcLibrary struct {
@@ -254,16 +255,23 @@ func CcLibraryBp2Build(ctx android.TopDownMutatorContext) {
return
}
sharedAttrs := bp2BuildParseSharedProps(ctx, m)
staticAttrs := bp2BuildParseStaticProps(ctx, m)
compilerAttrs := bp2BuildParseCompilerProps(ctx, m)
linkerAttrs := bp2BuildParseLinkerProps(ctx, m)
exportedIncludes := bp2BuildParseExportedIncludes(ctx, m)
var srcs bazel.LabelListAttribute
srcs.Append(compilerAttrs.srcs)
srcs.Append(staticAttrs.srcs)
attrs := &bazelCcLibraryAttributes{
Srcs: compilerAttrs.srcs,
Copts: compilerAttrs.copts,
Linkopts: linkerAttrs.linkopts,
Deps: linkerAttrs.deps,
Includes: exportedIncludes,
Srcs: srcs,
Copts: compilerAttrs.copts,
Linkopts: linkerAttrs.linkopts,
Deps: linkerAttrs.deps,
Static_deps_for_shared: sharedAttrs.staticDeps,
Includes: exportedIncludes,
}
props := bazel.BazelTargetModuleProperties{