• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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
14my_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
18LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
19ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
20my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
21  $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
22my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
23  $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
24
25# With aapt2, we'll link in the built resource from the AAR.
26ifndef LOCAL_USE_AAPT2
27LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
28  $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
29endif  # LOCAL_USE_AAPT2
30endif  # LOCAL_STATIC_JAVA_AAR_LIBRARIES
31
32# Set up rules to merge library manifest files
33ifdef my_full_libs_manifest_files
34main_android_manifest := $(full_android_manifest)
35full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
36$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
37$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_deps)
38	@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
39	@mkdir -p $(dir $@)
40	$(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \
41	    --out $@
42
43endif
44