From cbf76f63533a6b46d6ffe59346b1e4a71ebdcdb6 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 24 Mar 2017 19:31:49 +0900 Subject: [PATCH] Add LOCAL_OVERRIDES_MODULES LOCAL_OVERRIDES_MODULES is similar to LOCAL_OVERRIDES_PACKAGES, but is for executables. Bug: 36491275 Test: LOCAL_OVERRIDES_MODULES := foo should prevent a target executable foo from being installed. If foo is not a target executable, error should be reported. Change-Id: I558f3d94105f9e319f8413c1290799f1c70ee131 --- core/base_rules.mk | 12 ++++++++++++ core/clear_vars.mk | 1 + core/main.mk | 3 +++ 3 files changed, 16 insertions(+) diff --git a/core/base_rules.mk b/core/base_rules.mk index 1763a0646..b4d17b5df 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -360,6 +360,18 @@ intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$( intermediates.COMMON := $(call local-intermediates-dir,COMMON) generated_sources_dir := $(call local-generated-sources-dir) +ifneq ($(LOCAL_OVERRIDES_MODULES),) + ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES) + ifndef LOCAL_IS_HOST_MODULE + EXECUTABLES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES)) + else + $(call pretty-error,host modules cannot use LOCAL_OVERRIDES_MODULES) + endif + else + $(call pretty-error,LOCAL_MODULE_CLASS := $(LOCAL_MODULE_CLASS) cannot use LOCAL_OVERRIDES_MODULES) + endif +endif + ########################################################### # Pick a name for the intermediate and final targets ########################################################### diff --git a/core/clear_vars.mk b/core/clear_vars.mk index f30c4babe..3f8d8224c 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -162,6 +162,7 @@ LOCAL_NOTICE_FILE:= LOCAL_ODM_MODULE:= LOCAL_OEM_MODULE:= LOCAL_OVERRIDES_PACKAGES:= +LOCAL_OVERRIDES_MODULES:= LOCAL_PACKAGE_NAME:= LOCAL_PACKAGE_SPLITS:= LOCAL_PACK_MODULE_RELOCATIONS:= diff --git a/core/main.mk b/core/main.mk index 7433f9076..68a6daf5a 100644 --- a/core/main.mk +++ b/core/main.mk @@ -759,6 +759,9 @@ ifdef FULL_BUILD # Filter out the overridden packages before doing expansion product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \ $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES)) + # Filter out executables as well + product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \ + $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES)) # Resolve the :32 :64 module name modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))