Add ApexModule interface for APEX-aware modules

am: 9d45299ba4

Change-Id: Ica517fea677af7098e7ac082cb15997b25c90f0a
This commit is contained in:
Jiyong Park
2018-10-11 00:56:00 -07:00
committed by android-build-merger
4 changed files with 121 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ func (c *Module) subAndroidMk(data *android.AndroidMkData, obj interface{}) {
}
func (c *Module) AndroidMk() android.AndroidMkData {
if c.Properties.HideFromMake {
if c.Properties.HideFromMake || !c.IsForPlatform() {
return android.AndroidMkData{
Disabled: true,
}

View File

@@ -320,6 +320,7 @@ var (
type Module struct {
android.ModuleBase
android.DefaultableModuleBase
android.ApexModuleBase
Properties BaseProperties
VendorProperties VendorProperties
@@ -416,6 +417,8 @@ func (c *Module) Init() android.Module {
android.InitDefaultableModule(c)
android.InitApexModule(c)
return c
}
@@ -794,7 +797,7 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
c.outputFile = android.OptionalPathForPath(outputFile)
}
if c.installer != nil && !c.Properties.PreventInstall && c.outputFile.Valid() {
if c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid() {
c.installer.install(ctx, c.outputFile.Path())
if ctx.Failed() {
return
@@ -1511,12 +1514,24 @@ func (c *Module) getMakeLinkType() string {
}
}
// Overrides ApexModule.IsInstallabeToApex()
// Only shared libraries are installable to APEX.
func (c *Module) IsInstallableToApex() bool {
if shared, ok := c.linker.(interface {
shared() bool
}); ok {
return shared.shared()
}
return false
}
//
// Defaults
//
type Defaults struct {
android.ModuleBase
android.DefaultsModuleBase
android.ApexModuleBase
}
func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -1558,6 +1573,7 @@ func DefaultsFactory(props ...interface{}) android.Module {
)
android.InitDefaultsModule(module)
android.InitApexModule(module)
return module
}