Support robolectric_test

robolectric_test will compile a suite of tests that run in
robolectric.  For now it also generates a Run* rule, later
that will be removed in favor of atest.

Bug: 123248659
Test: m RunSettingsLibRoboTests
Change-Id: I12407d0b0d639e31c1969077ba787e8985e6a506
This commit is contained in:
Colin Cross
2019-05-01 15:50:51 -07:00
parent 60a839dd42
commit 0ef0816727
3 changed files with 124 additions and 0 deletions

View File

@@ -143,6 +143,7 @@ type ModuleContext interface {
OtherModuleErrorf(m blueprint.Module, fmt string, args ...interface{})
OtherModuleDependencyTag(m blueprint.Module) blueprint.DependencyTag
GetDirectDepsWithTag(tag blueprint.DependencyTag) []Module
GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module
GetDirectDep(name string) (blueprint.Module, blueprint.DependencyTag)
@@ -1093,6 +1094,18 @@ func (a *androidModuleContext) getDirectDepInternal(name string, tag blueprint.D
}
}
func (a *androidModuleContext) GetDirectDepsWithTag(tag blueprint.DependencyTag) []Module {
var deps []Module
a.VisitDirectDepsBlueprint(func(m blueprint.Module) {
if aModule, _ := m.(Module); aModule != nil {
if a.ModuleContext.OtherModuleDependencyTag(aModule) == tag {
deps = append(deps, aModule)
}
}
})
return deps
}
func (a *androidModuleContext) GetDirectDepWithTag(name string, tag blueprint.DependencyTag) blueprint.Module {
m, _ := a.getDirectDepInternal(name, tag)
return m