Add VisitDirectDepsWithTag
Add a method on ModuleContext and TopDownMutatorContext to visit
direct dependencies that have a given dependency tag.
Test: m checkbuild
Change-Id: Ib875563091dcae6b7282b3e3427d0eb07d8c8af5
diff --git a/android/mutator.go b/android/mutator.go
index 8de57e1..2f13f6c 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -127,6 +127,7 @@
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
VisitDirectDeps(visit func(Module))
+ VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module))
VisitDirectDepsIf(pred func(Module) bool, visit func(Module))
VisitDepsDepthFirst(visit func(Module))
VisitDepsDepthFirstIf(pred func(Module) bool, visit func(Module))
@@ -230,6 +231,16 @@
})
}
+func (a *androidTopDownMutatorContext) VisitDirectDepsWithTag(tag blueprint.DependencyTag, visit func(Module)) {
+ a.TopDownMutatorContext.VisitDirectDeps(func(module blueprint.Module) {
+ if aModule, _ := module.(Module); aModule != nil {
+ if a.TopDownMutatorContext.OtherModuleDependencyTag(aModule) == tag {
+ visit(aModule)
+ }
+ }
+ })
+}
+
func (a *androidTopDownMutatorContext) VisitDirectDepsIf(pred func(Module) bool, visit func(Module)) {
a.TopDownMutatorContext.VisitDirectDepsIf(
// pred