Skip to content

Commit

Permalink
Revert "Revert "Inject minSdkVersion from the build system""
Browse files Browse the repository at this point in the history
This reverts commit 4cd1a75.

PackageParser no longer treats minSdkVersion=Q as targetSdkVersion=Q
when targetSdkVersion is set to a number.

Bug: 110167203
Bug: 110353795
Change-Id: Ib44743e4c49e59cd29a57af1bf885090e380b1b6
  • Loading branch information
colincross committed Jun 18, 2018
1 parent 4cd1a75 commit 2d61e47
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions core/android_manifest.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
LOCAL_MANIFEST_FILE := AndroidManifest.xml
endif
ifdef LOCAL_FULL_MANIFEST_FILE
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
main_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
else
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
main_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
endif

LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES))
Expand All @@ -32,18 +32,35 @@ 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 $@)
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< \
$(MANIFEST_FIXER) $< $@.tmp --minSdkVersion $(PRIVATE_MIN_SDK_VERSION)
$(hide) $(ANDROID_MANIFEST_MERGER) --main $@.tmp \
--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

0 comments on commit 2d61e47

Please sign in to comment.