Create os and arch variants for GoBinaryTool modules
AddFarVariationDependencies was broken, which allowed modules to add dependencies on GoBinaryTool modules using os and arch variations even though GoBinaryTool modules did not have any variations. Mutate GoBinaryTool modules in the os and arch mutators so that they have the expected os and arch variations. Test: all soong tests Change-Id: Ida7bc75a51ab1d2d38a6be11f574399097380cc9
This commit is contained in:
@@ -75,6 +75,7 @@ type registerMutatorsContext struct {
|
||||
type RegisterMutatorsContext interface {
|
||||
TopDown(name string, m TopDownMutator) MutatorHandle
|
||||
BottomUp(name string, m BottomUpMutator) MutatorHandle
|
||||
BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle
|
||||
}
|
||||
|
||||
type RegisterMutatorFunc func(RegisterMutatorsContext)
|
||||
@@ -143,9 +144,9 @@ var preArch = []RegisterMutatorFunc{
|
||||
}
|
||||
|
||||
func registerArchMutator(ctx RegisterMutatorsContext) {
|
||||
ctx.BottomUp("os", osMutator).Parallel()
|
||||
ctx.BottomUpBlueprint("os", osMutator).Parallel()
|
||||
ctx.BottomUp("image", imageMutator).Parallel()
|
||||
ctx.BottomUp("arch", archMutator).Parallel()
|
||||
ctx.BottomUpBlueprint("arch", archMutator).Parallel()
|
||||
}
|
||||
|
||||
var preDeps = []RegisterMutatorFunc{
|
||||
@@ -225,16 +226,21 @@ type bottomUpMutatorContext struct {
|
||||
finalPhase bool
|
||||
}
|
||||
|
||||
func bottomUpMutatorContextFactory(ctx blueprint.BottomUpMutatorContext, a Module,
|
||||
finalPhase bool) BottomUpMutatorContext {
|
||||
|
||||
return &bottomUpMutatorContext{
|
||||
bp: ctx,
|
||||
baseModuleContext: a.base().baseModuleContextFactory(ctx),
|
||||
finalPhase: finalPhase,
|
||||
}
|
||||
}
|
||||
|
||||
func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) MutatorHandle {
|
||||
finalPhase := x.finalPhase
|
||||
f := func(ctx blueprint.BottomUpMutatorContext) {
|
||||
if a, ok := ctx.Module().(Module); ok {
|
||||
actx := &bottomUpMutatorContext{
|
||||
bp: ctx,
|
||||
baseModuleContext: a.base().baseModuleContextFactory(ctx),
|
||||
finalPhase: finalPhase,
|
||||
}
|
||||
m(actx)
|
||||
m(bottomUpMutatorContextFactory(ctx, a, finalPhase))
|
||||
}
|
||||
}
|
||||
mutator := &mutator{name: name, bottomUpMutator: f}
|
||||
@@ -242,6 +248,12 @@ func (x *registerMutatorsContext) BottomUp(name string, m BottomUpMutator) Mutat
|
||||
return mutator
|
||||
}
|
||||
|
||||
func (x *registerMutatorsContext) BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle {
|
||||
mutator := &mutator{name: name, bottomUpMutator: m}
|
||||
x.mutators = append(x.mutators, mutator)
|
||||
return mutator
|
||||
}
|
||||
|
||||
func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle {
|
||||
f := func(ctx blueprint.TopDownMutatorContext) {
|
||||
if a, ok := ctx.Module().(Module); ok {
|
||||
|
Reference in New Issue
Block a user