Merge "Deprecate inherit-package."

This commit is contained in:
Jaewoong Jung 2019-05-29 19:48:46 +00:00 committed by Gerrit Code Review
commit cd56c0df95
2 changed files with 2 additions and 69 deletions

View File

@ -2723,60 +2723,6 @@ $$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1)
endef
###########################################################
# Override the package defined in $(1), setting the
# variables listed below differently.
#
# $(1): The makefile to override (relative to the source
# tree root)
# $(2): Old LOCAL_PACKAGE_NAME value.
# $(3): New LOCAL_PACKAGE_NAME value.
# $(4): New LOCAL_MANIFEST_PACKAGE_NAME value.
# $(5): New LOCAL_CERTIFICATE value.
# $(6): New LOCAL_INSTRUMENTATION_FOR value.
# $(7): New LOCAL_MANIFEST_INSTRUMENTATION_FOR value.
# $(8): New LOCAL_COMPATIBILITY_SUITE value.
#
# Note that LOCAL_PACKAGE_OVERRIDES is NOT cleared in
# clear_vars.mk.
###########################################################
define inherit-package
$(eval $(call inherit-package-internal,$(1),$(2),$(3),$(4),$(5),$(6),$(7),$(8)))
endef
define inherit-package-internal
LOCAL_PACKAGE_OVERRIDES \
:= $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||&&$(strip $(5))||&&$(strip $(6))||&&$(strip $(7))||&&$(strip $(8)) $(LOCAL_PACKAGE_OVERRIDES)
include $(1)
LOCAL_PACKAGE_OVERRIDES \
:= $(wordlist 1,$(words $(LOCAL_PACKAGE_OVERRIDES)), $(LOCAL_PACKAGE_OVERRIDES))
endef
# To be used with inherit-package above
# Evalutes to true if the package was overridden
define set-inherited-package-variables
$(strip $(call set-inherited-package-variables-internal))
endef
define keep-or-override
$(eval $(1) := $(if $(2),$(2),$($(1))))
endef
define set-inherited-package-variables-internal
$(eval _o := $(subst ||, ,$(lastword $(LOCAL_PACKAGE_OVERRIDES))))
$(eval _n := $(subst ||, ,$(firstword $(LOCAL_PACKAGE_OVERRIDES))))
$(if $(filter $(word 2,$(_n)),$(LOCAL_PACKAGE_NAME)), \
$(eval LOCAL_PACKAGE_NAME := $(word 3,$(_o))) \
$(eval LOCAL_MANIFEST_PACKAGE_NAME := $(word 4,$(_o))) \
$(call keep-or-override,LOCAL_CERTIFICATE,$(patsubst &&%,%,$(word 5,$(_o)))) \
$(call keep-or-override,LOCAL_INSTRUMENTATION_FOR,$(patsubst &&%,%,$(word 6,$(_o)))) \
$(call keep-or-override,LOCAL_MANIFEST_INSTRUMENTATION_FOR,$(patsubst &&%,%,$(word 7,$(_o)))) \
$(call keep-or-override,LOCAL_COMPATIBILITY_SUITE,$(patsubst &&%,%,$(word 8,$(_o)))) \
$(eval LOCAL_OVERRIDES_PACKAGES := $(sort $(LOCAL_OVERRIDES_PACKAGES) $(word 2,$(_o)))) \
true \
,)
endef
###########################################################
## API Check
###########################################################
@ -3309,7 +3255,8 @@ endef
$(KATI_obsolete_var \
create-empty-package \
initialize-package-file \
add-jni-shared-libs-to-package,\
add-jni-shared-libs-to-package \
inherit-package,\
These functions have been removed)
###########################################################

View File

@ -25,18 +25,6 @@
## be set for you.
###########################################################
# If this makefile is being read from within an inheritance,
# use the new values.
skip_definition:=
ifdef LOCAL_PACKAGE_OVERRIDES
package_overridden := $(call set-inherited-package-variables)
ifeq ($(strip $(package_overridden)),)
skip_definition := true
endif
endif
ifndef skip_definition
LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
ifeq ($(LOCAL_PACKAGE_NAME),)
$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
@ -717,8 +705,6 @@ PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
endif # skip_definition
# Reset internal variables.
all_res_assets :=