Merge "Revert "Inject minSdkVersion from the build system""

This commit is contained in:
Colin Cross 2018-06-18 18:35:41 +00:00 committed by Gerrit Code Review
commit 71c0434af2

View file

@ -6,9 +6,9 @@ ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
LOCAL_MANIFEST_FILE := AndroidManifest.xml
endif
ifdef LOCAL_FULL_MANIFEST_FILE
main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
else
main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
endif
LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
@ -32,35 +32,18 @@ ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
endif
endif
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
# Set up rules to merge library manifest files
ifneq (,$(strip $(my_full_libs_manifest_files)))
main_android_manifest := $(full_android_manifest)
full_android_manifest := $(intermediates.COMMON)/manifest/AndroidManifest.xml
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
$(full_android_manifest): $(ANDROID_MANIFEST_MERGER_CLASSPATH)
$(full_android_manifest): $(MANIFEST_FIXER)
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_files)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
$(MANIFEST_FIXER) $< $@.tmp --minSdkVersion $(PRIVATE_MIN_SDK_VERSION)
$(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
--libs $(call normalize-path-list,$(PRIVATE_LIBS_MANIFESTS)) \
--out $@
rm $@.tmp
else
$(full_android_manifest): $(MANIFEST_FIXER)
$(full_android_manifest): $(main_android_manifest)
@echo "Fix manifest: $@"
$(MANIFEST_FIXER) $< $@ --minSdkVersion $(PRIVATE_MIN_SDK_VERSION)
endif