From 3839f03b7d4eda7641497fc978a255cd50778320 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Fri, 18 Dec 2020 17:28:50 +0000 Subject: [PATCH] Add check that a module doesn't try to override itself. If that happens it will be left out entirely. It would be nice to catch this on the Soong level, but there are several separate code paths there so this ensures it isn't missed. Test: `m nothing` with packages/modules/ArtPrebuilt/Android.bp that had this mistake Bug: 172480615 Change-Id: I2d31679b2ca5b57bf14f35703c10093275209890 --- core/main.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/main.mk b/core/main.mk index 8857b5d17..1b2eea44b 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1120,7 +1120,11 @@ $(foreach export,$(EXPORTS_LIST),$(eval $(call add-dependency,$$(EXPORTS.$$(expo # Expand a list of modules to the modules that they override (if any) # $(1): The list of modules. define module-overrides -$(foreach m,$(1),$(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES) $(ETC.$(m).OVERRIDES)) +$(foreach m,$(1),\ + $(eval _mo_overrides := $(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES) $(ETC.$(m).OVERRIDES))\ + $(if $(filter $(m),$(_mo_overrides)),\ + $(error Module $(m) cannot override itself),\ + $(_mo_overrides))) endef ###########################################################