Merge "Soong generates vndk-related .libraries.txt files"

This commit is contained in:
Jooyung Han
2019-11-01 01:57:50 +00:00
committed by Gerrit Code Review
8 changed files with 233 additions and 182 deletions

View File

@@ -745,17 +745,18 @@ func (c *Module) isNdk() bool {
func (c *Module) isLlndk(config android.Config) bool {
// Returns true for both LLNDK (public) and LLNDK-private libs.
return inList(c.BaseModuleName(), *llndkLibraries(config))
return isLlndkLibrary(c.BaseModuleName(), config)
}
func (c *Module) isLlndkPublic(config android.Config) bool {
// Returns true only for LLNDK (public) libs.
return c.isLlndk(config) && !c.isVndkPrivate(config)
name := c.BaseModuleName()
return isLlndkLibrary(name, config) && !isVndkPrivateLibrary(name, config)
}
func (c *Module) isVndkPrivate(config android.Config) bool {
// Returns true for LLNDK-private, VNDK-SP-private, and VNDK-core-private.
return inList(c.BaseModuleName(), *vndkPrivateLibraries(config))
return isVndkPrivateLibrary(c.BaseModuleName(), config)
}
func (c *Module) IsVndk() bool {
@@ -1517,7 +1518,6 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
// The caller can then know to add the variantLibs dependencies differently from the
// nonvariantLibs
llndkLibraries := llndkLibraries(actx.Config())
vendorPublicLibraries := vendorPublicLibraries(actx.Config())
rewriteNdkLibs := func(list []string) (nonvariantLibs []string, variantLibs []string) {
variantLibs = []string{}
@@ -1531,7 +1531,7 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
} else {
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
}
} else if ctx.useVndk() && inList(name, *llndkLibraries) {
} else if ctx.useVndk() && isLlndkLibrary(name, ctx.Config()) {
nonvariantLibs = append(nonvariantLibs, name+llndkLibrarySuffix)
} else if (ctx.Platform() || ctx.ProductSpecific()) && inList(name, *vendorPublicLibraries) {
vendorPublicLib := name + vendorPublicLibrarySuffix
@@ -1841,7 +1841,6 @@ func checkLinkType(ctx android.ModuleContext, from LinkableInterface, to Linkabl
// it is subject to be double loaded. Such lib should be explicitly marked as double_loadable: true
// or as vndk-sp (vndk: { enabled: true, support_system_process: true}).
func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
llndkLibraries := llndkLibraries(ctx.Config())
check := func(child, parent android.Module) bool {
to, ok := child.(*Module)
if !ok {
@@ -1858,7 +1857,7 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
return true
}
if to.isVndkSp() || inList(child.Name(), *llndkLibraries) || Bool(to.VendorProperties.Double_loadable) {
if to.isVndkSp() || to.isLlndk(ctx.Config()) || Bool(to.VendorProperties.Double_loadable) {
return false
}
@@ -1873,7 +1872,7 @@ func checkDoubleLoadableLibraries(ctx android.TopDownMutatorContext) {
}
if module, ok := ctx.Module().(*Module); ok {
if lib, ok := module.linker.(*libraryDecorator); ok && lib.shared() {
if inList(ctx.ModuleName(), *llndkLibraries) || Bool(module.VendorProperties.Double_loadable) {
if module.isLlndk(ctx.Config()) || Bool(module.VendorProperties.Double_loadable) {
ctx.WalkDeps(check)
}
}
@@ -1887,7 +1886,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
directStaticDeps := []LinkableInterface{}
directSharedDeps := []LinkableInterface{}
llndkLibraries := llndkLibraries(ctx.Config())
vendorPublicLibraries := vendorPublicLibraries(ctx.Config())
reexportExporter := func(exporter exportedFlagsProducer) {
@@ -2159,7 +2157,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
libName := strings.TrimSuffix(depName, llndkLibrarySuffix)
libName = strings.TrimSuffix(libName, vendorPublicLibrarySuffix)
libName = strings.TrimPrefix(libName, "prebuilt_")
isLLndk := inList(libName, *llndkLibraries)
isLLndk := isLlndkLibrary(libName, ctx.Config())
isVendorPublicLib := inList(libName, *vendorPublicLibraries)
bothVendorAndCoreVariantsExist := ccDep.HasVendorVariant() || isLLndk