Remove cc.ModuleContext.module()

cc.ModuleContext.module() returns a *cc.Module, and is left over from
when the cc package tried to use inheritance.  Remove it and the last
few users.

Change-Id: I9b42ca59689c1b0ada7980fbec923747ed3a53d3
This commit is contained in:
Colin Cross
2016-07-08 10:41:41 -07:00
parent 3c316bc03b
commit 6886183d8f
2 changed files with 9 additions and 33 deletions

View File

@@ -23,7 +23,6 @@ import (
"android/soong/glob" "android/soong/glob"
"github.com/google/blueprint" "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
) )
var ( var (
@@ -90,7 +89,6 @@ type Module interface {
GenerateAndroidBuildActions(ModuleContext) GenerateAndroidBuildActions(ModuleContext)
base() *ModuleBase base() *ModuleBase
Disable()
Enabled() bool Enabled() bool
Target() Target Target() Target
InstallInData() bool InstallInData() bool
@@ -294,10 +292,6 @@ func (a *ModuleBase) DeviceSupported() bool {
a.hostAndDeviceProperties.Device_supported a.hostAndDeviceProperties.Device_supported
} }
func (a *ModuleBase) Disable() {
a.commonProperties.Enabled = proptools.BoolPtr(false)
}
func (a *ModuleBase) Enabled() bool { func (a *ModuleBase) Enabled() bool {
if a.commonProperties.Enabled == nil { if a.commonProperties.Enabled == nil {
return a.Os().Class != HostCross return a.Os().Class != HostCross

View File

@@ -451,7 +451,6 @@ type UnusedProperties struct {
} }
type ModuleContextIntf interface { type ModuleContextIntf interface {
module() *Module
static() bool static() bool
staticBinary() bool staticBinary() bool
clang() bool clang() bool
@@ -599,10 +598,6 @@ type moduleContextImpl struct {
ctx BaseModuleContext ctx BaseModuleContext
} }
func (ctx *moduleContextImpl) module() *Module {
return ctx.mod
}
func (ctx *moduleContextImpl) clang() bool { func (ctx *moduleContextImpl) clang() bool {
return ctx.mod.clang(ctx.ctx) return ctx.mod.clang(ctx.ctx)
} }
@@ -866,16 +861,16 @@ func (c *Module) depsMutator(actx android.BottomUpMutatorContext) {
actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag, actx.AddVariationDependencies([]blueprint.Variation{{"link", "shared"}}, lateSharedDepTag,
deps.LateSharedLibs...) deps.LateSharedLibs...)
actx.AddDependency(ctx.module(), genSourceDepTag, deps.GeneratedSources...) actx.AddDependency(c, genSourceDepTag, deps.GeneratedSources...)
actx.AddDependency(ctx.module(), genHeaderDepTag, deps.GeneratedHeaders...) actx.AddDependency(c, genHeaderDepTag, deps.GeneratedHeaders...)
actx.AddDependency(ctx.module(), objDepTag, deps.ObjFiles...) actx.AddDependency(c, objDepTag, deps.ObjFiles...)
if deps.CrtBegin != "" { if deps.CrtBegin != "" {
actx.AddDependency(ctx.module(), crtBeginDepTag, deps.CrtBegin) actx.AddDependency(c, crtBeginDepTag, deps.CrtBegin)
} }
if deps.CrtEnd != "" { if deps.CrtEnd != "" {
actx.AddDependency(ctx.module(), crtEndDepTag, deps.CrtEnd) actx.AddDependency(c, crtEndDepTag, deps.CrtEnd)
} }
} }
@@ -1554,21 +1549,6 @@ type libraryLinker struct {
var _ linker = (*libraryLinker)(nil) var _ linker = (*libraryLinker)(nil)
func (library *libraryLinker) begin(ctx BaseModuleContext) {
library.baseLinker.begin(ctx)
if library.static() {
if library.Properties.Static.Enabled != nil &&
!*library.Properties.Static.Enabled {
ctx.module().Disable()
}
} else {
if library.Properties.Shared.Enabled != nil &&
!*library.Properties.Shared.Enabled {
ctx.module().Disable()
}
}
}
func (library *libraryLinker) props() []interface{} { func (library *libraryLinker) props() []interface{} {
props := library.baseLinker.props() props := library.baseLinker.props()
return append(props, return append(props,
@@ -1743,11 +1723,13 @@ func (library *libraryLinker) link(ctx ModuleContext,
} }
func (library *libraryLinker) buildStatic() bool { func (library *libraryLinker) buildStatic() bool {
return library.dynamicProperties.BuildStatic return library.dynamicProperties.BuildStatic &&
(library.Properties.Static.Enabled == nil || *library.Properties.Static.Enabled)
} }
func (library *libraryLinker) buildShared() bool { func (library *libraryLinker) buildShared() bool {
return library.dynamicProperties.BuildShared return library.dynamicProperties.BuildShared &&
(library.Properties.Shared.Enabled == nil || *library.Properties.Shared.Enabled)
} }
func (library *libraryLinker) getWholeStaticMissingDeps() []string { func (library *libraryLinker) getWholeStaticMissingDeps() []string {