Check for module names in LOCAL_ADDITIONAL_DEPENDENCIES

If anything looks like a module name instead of a path (so if it doesn't
have a / in it), forbid it from being in LOCAL_ADDITIONAL_DEPENDENCIES.

Phony modules should not be dependencies, since they're never considered
clean, and will force rebuilds. It will also force installation when
we're only attempting to checkbuild. Most of the time
LOCAL_REQUIRED_MODULES should be used instead, which will trigger the
required modules to be installed if the local module is installed.

Bug: 68042065
Test: build/soong/build_test.bash on aosp and internal
Change-Id: I058ed6734d895eba3417b1d47c7f4a6b341bc137
diff --git a/core/base_rules.mk b/core/base_rules.mk
index a178b55..a5ba75b 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -96,6 +96,13 @@
 # base_rules.mk, but it will fix the most common ones.
 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
 
+my_bad_deps := $(strip $(foreach dep,$(filter-out | ||,$(LOCAL_ADDITIONAL_DEPENDENCIES)),\
+                 $(if $(findstring /,$(dep)),,$(dep))))
+ifneq ($(my_bad_deps),)
+$(call pretty-warning,"Bad LOCAL_ADDITIONAL_DEPENDENCIES: $(my_bad_deps)")
+$(call pretty-error,"LOCAL_ADDITIONAL_DEPENDENCIES must only contain paths (not module names)")
+endif
+
 ###########################################################
 ## Validate and define fallbacks for input LOCAL_* variables.
 ###########################################################