Make *Context.Config return a Config instead of a interface{}

In Soong, a Config() method will always return a Config.  Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere.  Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.

Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.

Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
This commit is contained in:
Colin Cross
2017-11-29 00:27:14 -08:00
parent 178d5fefc0
commit aabf67968c
13 changed files with 90 additions and 51 deletions

View File

@@ -105,13 +105,11 @@ type makeVarsVariable struct {
}
func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) {
config := ctx.Config().(Config)
if !config.EmbeddedInMake() {
if !ctx.Config().EmbeddedInMake() {
return
}
outFile := PathForOutput(ctx, "make_vars"+proptools.String(config.ProductVariables.Make_suffix)+".mk").String()
outFile := PathForOutput(ctx, "make_vars"+proptools.String(ctx.Config().ProductVariables.Make_suffix)+".mk").String()
if ctx.Failed() {
return
@@ -120,7 +118,7 @@ func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) {
vars := []makeVarsVariable{}
for _, provider := range makeVarsProviders {
mctx := &makeVarsContext{
config: config,
config: ctx.Config(),
ctx: ctx,
pctx: provider.pctx,
}