2014-02-06 03:24:45 +01:00
|
|
|
# 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
|
2018-06-18 22:18:37 +02:00
|
|
|
main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
2014-02-06 03:24:45 +01:00
|
|
|
else
|
2018-06-18 22:18:37 +02:00
|
|
|
main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
2014-02-06 03:24:45 +01:00
|
|
|
endif
|
|
|
|
|
2015-05-28 00:14:28 +02:00
|
|
|
LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
|
2018-06-12 22:43:10 +02:00
|
|
|
|
|
|
|
my_full_libs_manifest_files :=
|
|
|
|
|
|
|
|
ifndef LOCAL_DONT_MERGE_MANIFESTS
|
|
|
|
my_full_libs_manifest_files += $(LOCAL_FULL_LIBS_MANIFEST_FILES)
|
|
|
|
|
2018-06-08 01:44:07 +02:00
|
|
|
my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES) $(LOCAL_STATIC_ANDROID_LIBRARIES),\
|
|
|
|
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/manifest/AndroidManifest.xml)
|
2018-06-12 22:43:10 +02:00
|
|
|
endif
|
|
|
|
|
2018-06-08 01:44:07 +02:00
|
|
|
# With aapt2, we'll link in the built resource from the AAR.
|
|
|
|
ifneq ($(LOCAL_USE_AAPT2),true)
|
|
|
|
LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
|
|
|
|
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
|
2018-06-12 22:43:10 +02:00
|
|
|
endif
|
2014-10-29 23:48:32 +01:00
|
|
|
|
2018-06-18 22:18:37 +02:00
|
|
|
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
|
|
|
|
|
|
|
|
ifdef LOCAL_MIN_SDK_VERSION
|
|
|
|
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(LOCAL_MIN_SDK_VERSION)
|
|
|
|
else ifneq (,$(filter-out current system_current test_current core_current, $(LOCAL_SDK_VERSION)))
|
|
|
|
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(call get-numeric-sdk-version,$(LOCAL_SDK_VERSION))
|
|
|
|
else
|
|
|
|
$(full_android_manifest): PRIVATE_MIN_SDK_VERSION := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
endif
|
|
|
|
|
2014-02-06 03:24:45 +01:00
|
|
|
# Set up rules to merge library manifest files
|
2018-05-22 08:39:59 +02:00
|
|
|
my_exported_sdk_libs_file := $(call local-intermediates-dir,COMMON)/exported-sdk-libs
|
|
|
|
$(full_android_manifest): PRIVATE_EXPORTED_SDK_LIBS_FILE := $(my_exported_sdk_libs_file)
|
|
|
|
$(full_android_manifest): $(my_exported_sdk_libs_file)
|
|
|
|
$(full_android_manifest): $(MANIFEST_FIXER)
|
|
|
|
|
2018-06-13 21:34:51 +02:00
|
|
|
ifneq (,$(strip $(my_full_libs_manifest_files)))
|
|
|
|
|
2014-10-29 23:48:32 +01:00
|
|
|
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
|
2017-09-08 22:29:54 +02:00
|
|
|
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
|
2018-06-13 21:34:51 +02:00
|
|
|
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
|
2014-10-29 23:48:32 +01:00
|
|
|
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
|
2014-02-06 03:24:45 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2018-05-22 08:39:59 +02:00
|
|
|
$(call fix-manifest,$<,$@.tmp,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
|
2018-06-18 22:18:37 +02:00
|
|
|
$(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
|
2017-09-08 22:29:54 +02:00
|
|
|
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
|
2014-02-06 03:24:45 +01:00
|
|
|
--out $@
|
2018-06-18 22:18:37 +02:00
|
|
|
rm $@.tmp
|
|
|
|
|
|
|
|
else
|
|
|
|
$(full_android_manifest): $(main_android_manifest)
|
|
|
|
@echo "Fix manifest: $@"
|
2018-05-22 08:39:59 +02:00
|
|
|
$(call fix-manifest,$<,$@,$(PRIVATE_MIN_SDK_VERSION),$(PRIVATE_EXPORTED_SDK_LIBS_FILE))
|
2014-02-06 03:24:45 +01:00
|
|
|
|
|
|
|
endif
|