diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2019-03-06 03:29:20 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-03-06 03:29:20 +0000 |
commit | f14277fc3aa6e1734b3972ccc8918878e62d01f5 (patch) | |
tree | 058f2ee9fe455c5f73a883134921f33d10682181 /android | |
parent | e3ad4144dbb449a0c7188dc27db00bf1c72ec5cb (diff) | |
parent | a70f067899c73b45558b862953ae229c313dcb12 (diff) | |
download | build_soong-f14277fc3aa6e1734b3972ccc8918878e62d01f5.tar.gz build_soong-f14277fc3aa6e1734b3972ccc8918878e62d01f5.tar.bz2 build_soong-f14277fc3aa6e1734b3972ccc8918878e62d01f5.zip |
Merge "Add checks for double_loadable dependencies"
Diffstat (limited to 'android')
-rw-r--r-- | android/mutator.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/android/mutator.go b/android/mutator.go index e5f742f7..509b67fa 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -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, |