Support to override instr target package in inherit-package

http://b/issue?id=2451361
With this CL, you can inherit a testing package to test a inheriting package.
Note: we change the meaning of $(5), so we need to change any existing calls
to inherit-package in other projects.

Change-Id: I673155d1b8b6006953d14e1ab87066536ebd1e54
This commit is contained in:
Ying Wang 2010-03-16 16:13:56 -07:00
parent 283e2a1e1b
commit 8c254825a0
2 changed files with 10 additions and 5 deletions

View File

@ -411,6 +411,7 @@ $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_POST_PROCESS_COMMAND:= $(LOCAL_POST_PROC
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME:= $(LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)

View File

@ -1234,7 +1234,8 @@ $(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \
$(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
$(addprefix --version-name , $(PLATFORM_VERSION)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME))
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME))
endef
ifeq ($(HOST_OS),windows)
@ -1378,6 +1379,7 @@ $(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
$(addprefix --version-name , $(PLATFORM_VERSION)) \
$(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
$(addprefix --rename-instrumentation-target-package , $(PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME)) \
-F $@
endef
@ -1742,18 +1744,19 @@ endef
# $(2): Old LOCAL_PACKAGE_NAME value.
# $(3): New LOCAL_PACKAGE_NAME value.
# $(4): New LOCALE_MANIFEST_PACKAGE_NAME value.
# $(5): New LOCAL_CERTIFICATE value.
# $(5): New LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME value.
# $(6): New LOCAL_CERTIFICATE 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)))
$(eval $(call inherit-package-internal,$(1),$(2),$(3),$(4),$(5)))
endef
define inherit-package-internal
LOCAL_PACKAGE_OVERRIDES \
:= $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||$(strip $(5)) $(LOCAL_PACKAGE_OVERRIDES)
:= $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||&&$(strip $(5))||$(strip $(6)) $(LOCAL_PACKAGE_OVERRIDES)
include $(1)
LOCAL_PACKAGE_OVERRIDES \
:= $(wordlist 1,$(words $(LOCAL_PACKAGE_OVERRIDES)), $(LOCAL_PACKAGE_OVERRIDES))
@ -1775,7 +1778,8 @@ define set-inherited-package-variables-internal
$(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,$(word 5,$(_o))) \
$(call keep-or-override,LOCAL_INSTRUMENTATION_FOR_PACKAGE_NAME,$(patsubst &&%,%,$(word 5,$(_o)))) \
$(call keep-or-override,LOCAL_CERTIFICATE,$(word 6,$(_o))) \
$(eval LOCAL_OVERRIDES_PACKAGES := $(sort $(LOCAL_OVERRIDES_PACKAGES) $(word 2,$(_o)))) \
true \
,)