summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-06-11 20:49:20 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-06-11 20:49:20 +0000
commit01c4f4622b3fda662bccda1ee795cf71ebbd1234 (patch)
tree14c606022df7ed8a0f5920ba1a3a311d45930fe1 /core
parent70ae5e23fc3596c9456e88d38ad346f54e50c95c (diff)
parentdceddd91d9a6516346e752b9f942747bea931cfa (diff)
downloadbuild-01c4f4622b3fda662bccda1ee795cf71ebbd1234.zip
build-01c4f4622b3fda662bccda1ee795cf71ebbd1234.tar.gz
build-01c4f4622b3fda662bccda1ee795cf71ebbd1234.tar.bz2
am dceddd91: am 79b46720: am 02f98a26: Merge "Fix loophole in module expansion."
* commit 'dceddd91d9a6516346e752b9f942747bea931cfa': Fix loophole in module expansion.
Diffstat (limited to 'core')
-rw-r--r--core/binary.mk2
-rw-r--r--core/definitions.mk14
-rw-r--r--core/main.mk60
-rw-r--r--core/prebuilt_internal.mk2
-rw-r--r--core/tasks/vendor_module_check.mk15
5 files changed, 40 insertions, 53 deletions
diff --git a/core/binary.mk b/core/binary.mk
index 775baad..be0776e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -211,7 +211,7 @@ installed_shared_library_module_names := $(sort $(installed_shared_library_modul
ifdef LOCAL_INSTALLED_MODULE
ifdef installed_shared_library_module_names
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
- $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
+ $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
endif
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index 882c611..37a7c70 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2136,20 +2136,6 @@ define set-inherited-package-variables-internal
endef
###########################################################
-## Expand a module name list with REQUIRED modules
-###########################################################
-# $(1): The variable name that holds the initial module name list.
-# the variable will be modified to hold the expanded results.
-# $(2): The initial module name list.
-# Returns empty string (maybe with some whitespaces).
-define expand-required-modules
-$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
- $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
-$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
- $(call expand-required-modules,$(1),$(_erm_new_modules)))
-endef
-
-###########################################################
## API Check
###########################################################
diff --git a/core/main.mk b/core/main.mk
index 6dbc8a6..33b3309 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -626,37 +626,36 @@ h_m :=
t_r :=
h_r :=
-# Resolve the dependencies on shared libraries.
-$(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,$(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,$(word 2,$(p)),$(r))))
+# Establish the dependecies on the shared libraries.
+# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
+# so they can be expanded to product_MODULES later.
+# $(1): TARGET_ or HOST_.
+# $(2): non-empty for 2nd arch.
+define resolve-shared-libs-depes
+$(foreach m,$($(if $(2),$($(1)2ND_ARCH_VAR_PREFIX))$(1)DEPENDENCIES_ON_SHARED_LIBRARIES),\
+ $(eval p := $(subst :,$(space),$(m)))\
+ $(eval mod := $(firstword $(p)))\
+ $(eval deps := $(subst $(comma),$(space),$(lastword $(p))))\
+ $(if $(2),$(eval deps := $(addsuffix $($(1)2ND_ARCH_MODULE_SUFFIX),$(deps))))\
+ $(eval r := $(filter $($(1)OUT_ROOT)/%,$(call module-installed-files,\
+ $(deps))))\
+ $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))\
+ $(eval ALL_MODULES.$(mod).REQUIRED += $(deps)))
+endef
+
+$(call resolve-shared-libs-depes,TARGET_)
ifdef TARGET_2ND_ARCH
-$(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES), \
- $(eval p := $(subst :,$(space),$(m))) \
- $(eval r := $(filter $(TARGET_OUT_ROOT)/%,$(call module-installed-files,\
- $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX), \
- $(subst $(comma),$(space),$(lastword $(p))))))) \
- $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+$(call resolve-shared-libs-depes,TARGET_,true)
endif
+$(call resolve-shared-libs-depes,HOST_)
ifdef HOST_2ND_ARCH
-$(foreach m,$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \
- $(eval p := $(subst :,$(space),$(m))) \
- $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\
- $(addsuffix $(HOST_2ND_ARCH_MODULE_SUFFIX), \
- $(subst $(comma),$(space),$(lastword $(p))))))) \
- $(eval $(call add-required-deps,$(word 2,$(p)),$(r))))
+$(call resolve-shared-libs-depes,HOST_,true)
endif
m :=
r :=
p :=
+deps :=
add-required-deps :=
# -------------------------------------------------------------------
@@ -665,6 +664,20 @@ add-required-deps :=
# Of the modules defined by the component makefiles,
# determine what we actually want to build.
+###########################################################
+## Expand a module name list with REQUIRED modules
+###########################################################
+# $(1): The variable name that holds the initial module name list.
+# the variable will be modified to hold the expanded results.
+# $(2): The initial module name list.
+# Returns empty string (maybe with some whitespaces).
+define expand-required-modules
+$(eval _erm_new_modules := $(sort $(filter-out $($(1)),\
+ $(foreach m,$(2),$(ALL_MODULES.$(m).REQUIRED)))))\
+$(if $(_erm_new_modules),$(eval $(1) += $(_erm_new_modules))\
+ $(call expand-required-modules,$(1),$(_erm_new_modules)))
+endef
+
ifdef FULL_BUILD
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
@@ -689,6 +702,7 @@ ifdef FULL_BUILD
endif
$(call expand-required-modules,product_MODULES,$(product_MODULES))
+
product_FILES := $(call module-installed-files, $(product_MODULES))
ifeq (0,1)
$(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index b248e1f..08d33d5 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -92,7 +92,7 @@ endif # prebuilt_module_is_a_library
ifdef LOCAL_INSTALLED_MODULE
ifdef LOCAL_SHARED_LIBRARIES
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
- $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
+ $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
# We also need the LOCAL_BUILT_MODULE dependency,
# since we use -rpath-link which points to the built module's path.
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index ceb166c..50fe120 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -42,20 +42,7 @@ _vendor_owner_whitelist := \
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_check_modules := $(product_MODULES)
_vendor_module_owner_info :=
# Restrict owners