Wrap PackageContext and SingletonContext

Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
This commit is contained in:
Colin Cross
2017-11-28 17:34:01 -08:00
parent f2a56f0e0d
commit 0875c52de7
21 changed files with 479 additions and 243 deletions

View File

@@ -21,7 +21,6 @@ import (
"os"
"strconv"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
@@ -66,7 +65,7 @@ type MakeVarsContext interface {
type MakeVarsProvider func(ctx MakeVarsContext)
func RegisterMakeVarsProvider(pctx blueprint.PackageContext, provider MakeVarsProvider) {
func RegisterMakeVarsProvider(pctx PackageContext, provider MakeVarsProvider) {
makeVarsProviders = append(makeVarsProviders, makeVarsProvider{pctx, provider})
}
@@ -76,14 +75,14 @@ func init() {
RegisterSingletonType("makevars", makeVarsSingletonFunc)
}
func makeVarsSingletonFunc() blueprint.Singleton {
func makeVarsSingletonFunc() Singleton {
return &makeVarsSingleton{}
}
type makeVarsSingleton struct{}
type makeVarsProvider struct {
pctx blueprint.PackageContext
pctx PackageContext
call MakeVarsProvider
}
@@ -91,8 +90,8 @@ var makeVarsProviders []makeVarsProvider
type makeVarsContext struct {
config Config
ctx blueprint.SingletonContext
pctx blueprint.PackageContext
ctx SingletonContext
pctx PackageContext
vars []makeVarsVariable
}
@@ -105,7 +104,7 @@ type makeVarsVariable struct {
strict bool
}
func (s *makeVarsSingleton) GenerateBuildActions(ctx blueprint.SingletonContext) {
func (s *makeVarsSingleton) GenerateBuildActions(ctx SingletonContext) {
config := ctx.Config().(Config)
if !config.EmbeddedInMake() {