Merge "Remove moduleContextImpl struct"
This commit is contained in:
68
rust/rust.go
68
rust/rust.go
@@ -514,39 +514,50 @@ type DepsContext interface {
|
||||
}
|
||||
|
||||
type ModuleContextIntf interface {
|
||||
RustModule() *Module
|
||||
toolchain() config.Toolchain
|
||||
baseModuleName() string
|
||||
CrateName() string
|
||||
nativeCoverage() bool
|
||||
}
|
||||
|
||||
type depsContext struct {
|
||||
android.BottomUpMutatorContext
|
||||
moduleContextImpl
|
||||
}
|
||||
|
||||
type moduleContext struct {
|
||||
android.ModuleContext
|
||||
moduleContextImpl
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) nativeCoverage() bool {
|
||||
return ctx.mod.nativeCoverage()
|
||||
type baseModuleContext struct {
|
||||
android.BaseModuleContext
|
||||
}
|
||||
|
||||
func (ctx *moduleContext) RustModule() *Module {
|
||||
return ctx.Module().(*Module)
|
||||
}
|
||||
|
||||
func (ctx *moduleContext) toolchain() config.Toolchain {
|
||||
return ctx.RustModule().toolchain(ctx)
|
||||
}
|
||||
|
||||
func (ctx *depsContext) RustModule() *Module {
|
||||
return ctx.Module().(*Module)
|
||||
}
|
||||
|
||||
func (ctx *depsContext) toolchain() config.Toolchain {
|
||||
return ctx.RustModule().toolchain(ctx)
|
||||
}
|
||||
|
||||
func (ctx *baseModuleContext) RustModule() *Module {
|
||||
return ctx.Module().(*Module)
|
||||
}
|
||||
|
||||
func (ctx *baseModuleContext) toolchain() config.Toolchain {
|
||||
return ctx.RustModule().toolchain(ctx)
|
||||
}
|
||||
|
||||
func (mod *Module) nativeCoverage() bool {
|
||||
return mod.compiler != nil && mod.compiler.nativeCoverage()
|
||||
}
|
||||
|
||||
type moduleContextImpl struct {
|
||||
mod *Module
|
||||
ctx BaseModuleContext
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) toolchain() config.Toolchain {
|
||||
return ctx.mod.toolchain(ctx.ctx)
|
||||
}
|
||||
|
||||
func (mod *Module) toolchain(ctx android.BaseModuleContext) config.Toolchain {
|
||||
if mod.cachedToolchain == nil {
|
||||
mod.cachedToolchain = config.FindToolchain(ctx.Os(), ctx.Arch())
|
||||
@@ -560,11 +571,7 @@ func (d *Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||
ctx := &moduleContext{
|
||||
ModuleContext: actx,
|
||||
moduleContextImpl: moduleContextImpl{
|
||||
mod: mod,
|
||||
},
|
||||
}
|
||||
ctx.ctx = ctx
|
||||
|
||||
toolchain := mod.toolchain(ctx)
|
||||
|
||||
@@ -618,14 +625,6 @@ func (mod *Module) deps(ctx DepsContext) Deps {
|
||||
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) baseModuleName() string {
|
||||
return ctx.mod.ModuleBase.BaseModuleName()
|
||||
}
|
||||
|
||||
func (ctx *moduleContextImpl) CrateName() string {
|
||||
return ctx.mod.CrateName()
|
||||
}
|
||||
|
||||
type dependencyTag struct {
|
||||
blueprint.BaseDependencyTag
|
||||
name string
|
||||
@@ -822,11 +821,7 @@ func libNameFromFilePath(filepath android.Path) string {
|
||||
func (mod *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
ctx := &depsContext{
|
||||
BottomUpMutatorContext: actx,
|
||||
moduleContextImpl: moduleContextImpl{
|
||||
mod: mod,
|
||||
},
|
||||
}
|
||||
ctx.ctx = ctx
|
||||
|
||||
deps := mod.deps(ctx)
|
||||
commonDepVariations := []blueprint.Variation{}
|
||||
@@ -873,19 +868,10 @@ func BeginMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
type baseModuleContext struct {
|
||||
android.BaseModuleContext
|
||||
moduleContextImpl
|
||||
}
|
||||
|
||||
func (mod *Module) beginMutator(actx android.BottomUpMutatorContext) {
|
||||
ctx := &baseModuleContext{
|
||||
BaseModuleContext: actx,
|
||||
moduleContextImpl: moduleContextImpl{
|
||||
mod: mod,
|
||||
},
|
||||
}
|
||||
ctx.ctx = ctx
|
||||
|
||||
mod.begin(ctx)
|
||||
}
|
||||
|
Reference in New Issue
Block a user