Multi-tree API bp2build converter for ndk_library

This is a partial bp2build conversion that only emits the
cc_api_contribution target of ndk_library. We also need to convert this
to cc_stub_suite eventually to enable building vendor/product API
domains with Bazel

Also create an enum for the three known Multi-tree API surfaces (will
likely be expanded in the future)

Test: go test ./bp2build
Test: b cquery //bionic/libc:libc.ndk.contribution --output=starlark
--starlark:expr="providers(target)"

Change-Id: Idb24871ba20aae132b61eb31ef35c917cacae9e1
This commit is contained in:
Spandan Das
2022-08-19 18:17:28 +00:00
parent 81593891ee
commit 1278c2cb24
4 changed files with 143 additions and 0 deletions

View File

@@ -28,6 +28,28 @@ func RegisterApiDomainBuildComponents(ctx RegistrationContext) {
ctx.RegisterModuleType("api_domain", ApiDomainFactory)
}
type ApiSurface int
// TODO(b/246656800): Reconcile with android.SdkKind
const (
PublicApi ApiSurface = iota
SystemApi
VendorApi
)
func (a ApiSurface) String() string {
switch a {
case PublicApi:
return "publicapi"
case SystemApi:
return "systemapi"
case VendorApi:
return "vendorapi"
default:
return "invalid"
}
}
type apiDomain struct {
ModuleBase
BazelModuleBase