Fix genrule depending on disabled module with ALLOW_MISSING_DEPENDENCIES=true
If a genrule depends on a module that is disabled, in this case because
it is a device module in a host-only build, it can cause panics when
getPathsFromModuleDep retrieves a nil Path from the disabled module.
Treat disabled modules as missing dependencies.
Test: TestGenruleAllowMissingDependencies
Change-Id: I3c689c6b5505b21eaf7ae7cb93c00f96f438ac17
diff --git a/android/paths.go b/android/paths.go
index f648c55..babf48c 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -511,6 +511,9 @@
if module == nil {
return nil, missingDependencyError{[]string{moduleName}}
}
+ if aModule, ok := module.(Module); ok && !aModule.Enabled() {
+ return nil, missingDependencyError{[]string{moduleName}}
+ }
if outProducer, ok := module.(OutputFileProducer); ok {
outputFiles, err := outProducer.OutputFiles(tag)
if err != nil {