From 0c821a98822efe62741ca7cc390675a394fb0024 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 23 Oct 2017 22:14:21 -0700 Subject: [PATCH] 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 --- core/base_rules.mk | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/base_rules.mk b/core/base_rules.mk index a178b55c4..a5ba75b0d 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -96,6 +96,13 @@ endif # 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. ###########################################################