aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2019-02-27 15:31:52 -0800
committerAlex Light <allight@google.com>2019-02-27 15:34:26 -0800
commit142de248fa3fe49aa8e9e382e6b7e16fc7ff9315 (patch)
treec3c2d75f83b7bf8cb5f1d3e4c5fed6147ac5f70d
parent8908a0a8062251125786b1e518737dfc5d7abe83 (diff)
downloadandroid_build_blueprint-142de248fa3fe49aa8e9e382e6b7e16fc7ff9315.tar.gz
android_build_blueprint-142de248fa3fe49aa8e9e382e6b7e16fc7ff9315.tar.bz2
android_build_blueprint-142de248fa3fe49aa8e9e382e6b7e16fc7ff9315.zip
GetDirectDepWithTag needs to check all tags before panicing
GetDirectDeWithTag would panic if the first possible directDep did not have the correct tag. It should check to see if any version of that dependency has the right tag. Test: atest CtsJdwpTunnelHostTestCases Bug: 124507633 Bug: 125933724 Change-Id: I00d269130e9f136a93fd30c58b8fd929372d5b37
-rw-r--r--module_ctx.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/module_ctx.go b/module_ctx.go
index 62646f1..9dbf43d 100644
--- a/module_ctx.go
+++ b/module_ctx.go
@@ -338,16 +338,20 @@ func (m *baseModuleContext) GetDirectDep(name string) (Module, DependencyTag) {
// GetDirectDepWithTag returns the Module the direct dependency with the specified name, or nil if
// none exists. It panics if the dependency does not have the specified tag.
func (m *baseModuleContext) GetDirectDepWithTag(name string, tag DependencyTag) Module {
+ var deps []depInfo
for _, dep := range m.module.directDeps {
if dep.module.Name() == name {
- if dep.tag != tag {
- panic(fmt.Errorf("found dependency %q with tag %#v, expected tag %#v",
- dep.module, dep.tag, tag))
+ if dep.tag == tag {
+ return dep.module.logicModule
}
- return dep.module.logicModule
+ deps = append(deps, dep)
}
}
+ if len(deps) != 0 {
+ panic(fmt.Errorf("Unable to find dependency %q with requested tag %#v. Found: %#v", deps[0].module, tag, deps))
+ }
+
return nil
}