From d6b1d61d84a95ba74bb3e4f9053014357ac363d1 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Mon, 15 Apr 2013 17:32:21 -0700 Subject: [PATCH] Do vendor check on modules installed by LOCAL_SHARED_LIBRARIES Since commit 6c86a1 we have split LOCAL_SHARED_LIBRARIES out of LOCAL_REQUIRED_MODULES and the vendor check does no longer cover the installed modules introduced by LOCAL_SHARED_LIBRARIES. This change brings back the coverage. Change-Id: Ie78692e48f173a3350792eb2fee8127ff9433caa --- core/binary.mk | 2 +- core/definitions.mk | 2 +- core/main.mk | 4 ++-- core/prebuilt.mk | 2 +- core/tasks/vendor_module_check.mk | 12 ++++++++++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index d70edbb9f..10d4927d8 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -86,7 +86,7 @@ include $(BUILD_SYSTEM)/base_rules.mk # of the shared libraries are determined. ifdef LOCAL_INSTALLED_MODULE ifdef installed_shared_library_module_names -$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) +$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names)) endif endif diff --git a/core/definitions.mk b/core/definitions.mk index 7bee582cb..7834baa4d 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -82,7 +82,7 @@ ALL_FINDBUGS_FILES:= ALL_GPL_MODULE_LICENSE_FILES:= # Target and host installed module's dependencies on shared libraries. -# They are list of ":lib1,lib2...". +# They are list of "::lib1,lib2...". TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := HOST_DEPENDENCIES_ON_SHARED_LIBRARIES := diff --git a/core/main.mk b/core/main.mk index 49e0a9ae5..e03801ce5 100644 --- a/core/main.mk +++ b/core/main.mk @@ -556,12 +556,12 @@ $(foreach m,$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \ $(eval p := $(subst :,$(space),$(m))) \ $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\ $(subst $(comma),$(space),$(lastword $(p)))))) \ - $(eval $(call add-required-deps,$(firstword $(p)),$(r)))) + $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) $(foreach m,$(HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \ $(eval p := $(subst :,$(space),$(m))) \ $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\ $(subst $(comma),$(space),$(lastword $(p)))))) \ - $(eval $(call add-required-deps,$(firstword $(p)),$(r)))) + $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) m := r := diff --git a/core/prebuilt.mk b/core/prebuilt.mk index 6b8e3f8c9..6e088327c 100644 --- a/core/prebuilt.mk +++ b/core/prebuilt.mk @@ -83,7 +83,7 @@ endif # prebuilt_module_is_a_library # of the shared libraries are determined. ifdef LOCAL_INSTALLED_MODULE ifdef LOCAL_SHARED_LIBRARIES -$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) +$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES)) endif endif diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk index 8d4eb057f..fcf2bbedd 100644 --- a/core/tasks/vendor_module_check.mk +++ b/core/tasks/vendor_module_check.mk @@ -40,6 +40,18 @@ ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) _vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)) $(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules)) +# Expand the target modules installed via LOCAL_SHARED_LIBRARIES +# $(1): the list of modules to expand. +define expand-required-shared-libraries +$(eval _ersl_new_modules := $(filter $(addsuffix :%,$(1)),$(TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES)))\ +$(eval _ersl_new_modules := $(foreach p,$(_ersl_new_modules),$(word 3,$(subst :,$(space),$(p)))))\ +$(eval _ersl_new_modules := $(sort $(subst $(comma),$(space),$(_ersl_new_modules))))\ +$(eval _ersl_new_modules := $(filter-out $(_vendor_check_modules),$(_ersl_new_modules)))\ +$(if $(_ersl_new_modules),$(eval _vendor_check_modules += $(_ersl_new_modules))\ + $(call expand-required-shared-libraries,$(_ersl_new_modules))) +endef +$(call expand-required-shared-libraries,$(_vendor_check_modules)) + _vendor_module_owner_info := # Restrict owners ifneq (,$(filter true owner all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)))