Set up rules to merge AndroidManifest.xmls
Now you can merge the library manifest files to the main app's AndroidManifest.xml with LOCAL_FULL_LIBS_MANIFEST_FILES. LOCAL_FULL_LIBS_MANIFEST_FILES is a list of paths relative to the top of the source tree. Bug: 12907528 Change-Id: I16a347c83dfb6fbbb7d5d40284b7c65aa682fdd2
This commit is contained in:
parent
7b734fd8d1
commit
dc7fee9fbf
5 changed files with 32 additions and 19 deletions
25
core/android_manifest.mk
Normal file
25
core/android_manifest.mk
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Handle AndroidManifest.xmls
|
||||
# Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES
|
||||
# Output: full_android_manifest
|
||||
|
||||
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
||||
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
||||
endif
|
||||
ifdef LOCAL_FULL_MANIFEST_FILE
|
||||
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
||||
else
|
||||
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
||||
endif
|
||||
|
||||
# Set up rules to merge library manifest files
|
||||
ifdef LOCAL_FULL_LIBS_MANIFEST_FILES
|
||||
main_android_manifest := $(full_android_manifest)
|
||||
full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
|
||||
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
|
||||
$(full_android_manifest) : $(main_android_manifest) $(LOCAL_FULL_LIBS_MANIFEST_FILES)
|
||||
@echo "Merge android manifest files: $@ <-- $^"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \
|
||||
--out $@
|
||||
|
||||
endif
|
|
@ -109,6 +109,7 @@ LOCAL_EMMA_COVERAGE_FILTER:=
|
|||
LOCAL_WARNINGS_ENABLE:=
|
||||
LOCAL_FULL_MANIFEST_FILE:=
|
||||
LOCAL_MANIFEST_FILE:=
|
||||
LOCAL_FULL_LIBS_MANIFEST_FILES:=
|
||||
LOCAL_RENDERSCRIPT_INCLUDES:=
|
||||
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:=
|
||||
LOCAL_RENDERSCRIPT_CC:=
|
||||
|
|
|
@ -341,6 +341,9 @@ ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
|
|||
FINDBUGS := prebuilt/common/findbugs/bin/findbugs
|
||||
EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
|
||||
# Tool to merge AndroidManifest.xmls
|
||||
ANDROID_MANIFEST_MERGER := java -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
|
||||
|
||||
YACC_HEADER_SUFFIX:= .hpp
|
||||
|
||||
# Don't use column under Windows, cygwin or not
|
||||
|
|
|
@ -58,16 +58,6 @@ $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
|
|||
endif
|
||||
LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
|
||||
|
||||
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
||||
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
||||
endif
|
||||
|
||||
# If you need to put the MANIFEST_FILE outside of LOCAL_PATH
|
||||
# you can use FULL_MANIFEST_FILE
|
||||
ifeq ($(strip $(LOCAL_FULL_MANIFEST_FILE)),)
|
||||
LOCAL_FULL_MANIFEST_FILE := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
||||
endif
|
||||
|
||||
ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
|
||||
$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
|
||||
endif
|
||||
|
@ -197,7 +187,8 @@ ifeq ($(LOCAL_SDK_RES_VERSION),)
|
|||
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
||||
endif
|
||||
|
||||
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
||||
include $(BUILD_SYSTEM)/android_manifest.mk
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
|
||||
ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
|
||||
|
|
|
@ -66,14 +66,7 @@ include $(BUILD_SYSTEM)/java_library.mk
|
|||
ifneq (,$(all_resources))
|
||||
R_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.stamp
|
||||
|
||||
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
||||
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
||||
endif
|
||||
ifdef LOCAL_FULL_MANIFEST_FILE
|
||||
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
||||
else
|
||||
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
||||
endif
|
||||
include $(BUILD_SYSTEM)/android_manifest.mk
|
||||
|
||||
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
||||
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
||||
|
|
Loading…
Reference in a new issue