Ying Wang | dc7fee9 | 2014-02-05 18:24:45 -0800 | [diff] [blame] | 1 | # Handle AndroidManifest.xmls |
| 2 | # Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES |
| 3 | # Output: full_android_manifest |
| 4 | |
| 5 | ifeq ($(strip $(LOCAL_MANIFEST_FILE)),) |
| 6 | LOCAL_MANIFEST_FILE := AndroidManifest.xml |
| 7 | endif |
| 8 | ifdef LOCAL_FULL_MANIFEST_FILE |
| 9 | full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE) |
| 10 | else |
| 11 | full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE) |
| 12 | endif |
| 13 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 14 | my_full_libs_manifest_files := $(LOCAL_FULL_LIBS_MANIFEST_FILES) |
| 15 | my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES) |
| 16 | |
| 17 | # Set up dependency on aar libraries |
| 18 | ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES |
| 19 | my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\ |
| 20 | $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar) |
| 21 | my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\ |
| 22 | $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml) |
| 23 | |
| 24 | LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\ |
| 25 | $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res) |
| 26 | endif |
| 27 | |
Ying Wang | dc7fee9 | 2014-02-05 18:24:45 -0800 | [diff] [blame] | 28 | # Set up rules to merge library manifest files |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 29 | ifdef my_full_libs_manifest_files |
Ying Wang | dc7fee9 | 2014-02-05 18:24:45 -0800 | [diff] [blame] | 30 | main_android_manifest := $(full_android_manifest) |
| 31 | full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 32 | $(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 Wang | dc7fee9 | 2014-02-05 18:24:45 -0800 | [diff] [blame] | 35 | @mkdir -p $(dir $@) |
| 36 | $(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \ |
| 37 | --out $@ |
| 38 | |
| 39 | endif |