blob: c641b75c8cc3072cd34abf35f3a4497cb1b2ee80 [file] [log] [blame]
Ying Wangdc7fee92014-02-05 18:24:45 -08001# Handle AndroidManifest.xmls
2# Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES
3# Output: full_android_manifest
4
5ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
6 LOCAL_MANIFEST_FILE := AndroidManifest.xml
7endif
8ifdef LOCAL_FULL_MANIFEST_FILE
9 full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
10else
11 full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
12endif
13
Ying Wange9dd9f22014-10-29 15:48:32 -070014my_full_libs_manifest_files := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
15my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
16
17# Set up dependency on aar libraries
18ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
19my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
20 $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
21my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
22 $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
23
24LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
25 $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
26endif
27
Ying Wangdc7fee92014-02-05 18:24:45 -080028# Set up rules to merge library manifest files
Ying Wange9dd9f22014-10-29 15:48:32 -070029ifdef my_full_libs_manifest_files
Ying Wangdc7fee92014-02-05 18:24:45 -080030main_android_manifest := $(full_android_manifest)
31full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
Ying Wange9dd9f22014-10-29 15:48:32 -070032$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
33$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_deps)
34 @echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
Ying Wangdc7fee92014-02-05 18:24:45 -080035 @mkdir -p $(dir $@)
36 $(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \
37 --out $@
38
39endif