Fail when a module depends on a disabled module

Copy the logic from cc.go to fail when a module depends on a disabled
module.  A future change will refactor this to remove the duplication
and cover all other module types.

Test: m TARGET_BUILD_PDK=true doesn't panic
Bug: 67663308
Change-Id: Iab2b142cebdbd74df934e4733f0de83bd3334d86
This commit is contained in:
Colin Cross
2017-10-23 16:43:47 -07:00
parent 254aaec328
commit 1e45cb77a0

View File

@@ -410,6 +410,21 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module)
aDep, _ := module.(android.Module)
if aDep == nil {
ctx.ModuleErrorf("module %q not an android module", ctx.OtherModuleName(aDep))
return
}
if !aDep.Enabled() {
if ctx.AConfig().AllowMissingDependencies() {
ctx.AddMissingDependencies([]string{ctx.OtherModuleName(aDep)})
} else {
ctx.ModuleErrorf("depends on disabled module %q", ctx.OtherModuleName(aDep))
}
return
}
dep, _ := module.(Dependency)
if dep == nil {
switch tag {