diff options
| author | colincross <github@colincross.com> | 2019-02-27 16:13:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-27 16:13:57 -0800 |
| commit | 02c110735d44497cca7a2ca28956d815dddcd7c6 (patch) | |
| tree | c3c2d75f83b7bf8cb5f1d3e4c5fed6147ac5f70d | |
| parent | 8908a0a8062251125786b1e518737dfc5d7abe83 (diff) | |
| parent | 142de248fa3fe49aa8e9e382e6b7e16fc7ff9315 (diff) | |
| download | android_build_blueprint-02c110735d44497cca7a2ca28956d815dddcd7c6.tar.gz android_build_blueprint-02c110735d44497cca7a2ca28956d815dddcd7c6.tar.bz2 android_build_blueprint-02c110735d44497cca7a2ca28956d815dddcd7c6.zip | |
Merge pull request #238 from allight/rebase-add-java-services
GetDirectDepWithTag needs to check all tags before panicing
| -rw-r--r-- | module_ctx.go | 12 |
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 } |
