aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-10-23 16:43:47 -0700
committerColin Cross <ccross@android.com>2017-10-23 16:43:47 -0700
commit1e45cb77a0fdd774e672a84d8fc3c90eb4f56da3 (patch)
tree43f4a95df59ced1739dcc352bfd9822832fa4f04 /java
parent254aaec32870c16d97a7c8b1320c250f71c5d3f7 (diff)
downloadbuild_soong-1e45cb77a0fdd774e672a84d8fc3c90eb4f56da3.tar.gz
build_soong-1e45cb77a0fdd774e672a84d8fc3c90eb4f56da3.tar.bz2
build_soong-1e45cb77a0fdd774e672a84d8fc3c90eb4f56da3.zip
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
Diffstat (limited to 'java')
-rw-r--r--java/java.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go
index 8941b4d7..c12ada27 100644
--- a/java/java.go
+++ b/java/java.go
@@ -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 {