Merge "add [static|shared].apex_available to cc_library"

This commit is contained in:
Treehugger Robot
2019-10-16 02:09:44 +00:00
committed by Gerrit Code Review
4 changed files with 66 additions and 5 deletions

View File

@@ -2143,6 +2143,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()
}

View File

@@ -131,6 +131,8 @@ type StaticOrSharedProperties struct {
Export_shared_lib_headers []string `android:"arch_variant"`
Export_static_lib_headers []string `android:"arch_variant"`
Apex_available []string `android:"arch_variant"`
}
type LibraryMutatedProperties struct {
@@ -573,6 +575,8 @@ type libraryInterface interface {
// Write LOCAL_ADDITIONAL_DEPENDENCIES for ABI diff
androidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer)
availableFor(string) bool
}
func (library *libraryDecorator) getLibName(ctx BaseModuleContext) string {
@@ -1134,6 +1138,19 @@ func (library *libraryDecorator) stubsVersion() string {
return library.MutatedProperties.StubsVersion
}
func (library *libraryDecorator) availableFor(what string) bool {
var list []string
if library.static() {
list = library.StaticProperties.Static.Apex_available
} else if library.shared() {
list = library.SharedProperties.Shared.Apex_available
}
if len(list) == 0 {
return false
}
return android.CheckAvailableForApex(what, list)
}
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
func versioningMacroNamesList(config android.Config) *map[string]string {