add [static|shared].apex_available to cc_library

apex_available property can be appended differently per the linkage
type. This will be used to restrict certain libs (e.g.
libc_malloc_debug) to an APEX while allowing them to be statically
linkable from platform for testing purpose.

Test: m (apex_test amended)
Change-Id: I6dec23129c5ac93a3ef06fea28f26f240c0ba410
This commit is contained in:
Jiyong Park
2019-10-07 15:47:24 +09:00
parent 8785e55e1c
commit a90ca00786
4 changed files with 66 additions and 5 deletions

View File

@@ -2152,6 +2152,16 @@ func (c *Module) IsInstallableToApex() bool {
return false
}
func (c *Module) AvailableFor(what string) bool {
if linker, ok := c.linker.(interface {
availableFor(string) bool
}); ok {
return c.ApexModuleBase.AvailableFor(what) || linker.availableFor(what)
} else {
return c.ApexModuleBase.AvailableFor(what)
}
}
func (c *Module) installable() bool {
return c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid()
}