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
diff --git a/android/androidmk.go b/android/androidmk.go
index aff43fa..d88ba8f 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -60,9 +60,7 @@
type androidMkSingleton struct{}
func (c *androidMkSingleton) GenerateBuildActions(ctx SingletonContext) {
- config := ctx.Config().(Config)
-
- if !config.EmbeddedInMake() {
+ if !ctx.Config().EmbeddedInMake() {
return
}
@@ -74,7 +72,7 @@
sort.Sort(AndroidModulesByName{androidMkModulesList, ctx})
- transMk := PathForOutput(ctx, "Android"+String(config.ProductVariables.Make_suffix)+".mk")
+ transMk := PathForOutput(ctx, "Android"+String(ctx.Config().ProductVariables.Make_suffix)+".mk")
if ctx.Failed() {
return
}
@@ -184,8 +182,7 @@
}
- config := ctx.Config().(Config)
- if amod.Arch().ArchType != config.Targets[amod.Os().Class][0].Arch.ArchType {
+ if amod.Arch().ArchType != ctx.Config().Targets[amod.Os().Class][0].Arch.ArchType {
prefix = "2ND_" + prefix
}
}