Merge "Add checks for double_loadable dependencies"

This commit is contained in:
Treehugger Robot
2019-03-06 03:29:20 +00:00
committed by Gerrit Code Review
3 changed files with 356 additions and 21 deletions

View File

@@ -132,11 +132,15 @@ type TopDownMutatorContext interface {
VisitDepsDepthFirst(visit func(Module))
VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
WalkDeps(visit func(Module, Module) bool)
// GetWalkPath is supposed to be called in visit function passed in WalkDeps()
// and returns a top-down dependency path from a start module to current child module.
GetWalkPath() []Module
}
type androidTopDownMutatorContext struct {
blueprint.TopDownMutatorContext
androidBaseContextImpl
walkPath []Module
}
type AndroidBottomUpMutator func(BottomUpMutatorContext)
@@ -287,10 +291,16 @@ func (a *androidTopDownMutatorContext) VisitDepsDepthFirstIf(pred func(Module) b
}
func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool) {
a.walkPath = []Module{a.Module()}
a.TopDownMutatorContext.WalkDeps(func(child, parent blueprint.Module) bool {
childAndroidModule, _ := child.(Module)
parentAndroidModule, _ := parent.(Module)
if childAndroidModule != nil && parentAndroidModule != nil {
// record walkPath before visit
for a.walkPath[len(a.walkPath)-1] != parentAndroidModule {
a.walkPath = a.walkPath[0 : len(a.walkPath)-1]
}
a.walkPath = append(a.walkPath, childAndroidModule)
return visit(childAndroidModule, parentAndroidModule)
} else {
return false
@@ -298,6 +308,10 @@ func (a *androidTopDownMutatorContext) WalkDeps(visit func(Module, Module) bool)
})
}
func (a *androidTopDownMutatorContext) GetWalkPath() []Module {
return a.walkPath
}
func (a *androidTopDownMutatorContext) AppendProperties(props ...interface{}) {
for _, p := range props {
err := proptools.AppendMatchingProperties(a.Module().base().customizableProperties,