Respect LOCAL_MIN_SDK_VERSION for dx
Follow Jack's behavior for now and pass LOCAL_MIN_SDK_VERSION to dx. Don't pass it to desugar for now, desugar with low --min_sdk_version numbers enables features we haven't verified yet, and existing apps won't be using the new language features that require extra desugaring. Test: examine classes.dex from an app with LOCAL_MIN_SDK_VERSION Change-Id: Ic7d679b1b11fba98a33418a4f79d4762a91f1f9c
This commit is contained in:
parent
e984c78faf
commit
9deb331f20
3 changed files with 37 additions and 9 deletions
|
@ -2535,7 +2535,7 @@ define transform-classes.jar-to-dex
|
|||
$(hide) rm -f $(dir $@)classes*.dex
|
||||
$(hide) $(DX_COMMAND) \
|
||||
--dex --output=$(dir $@) \
|
||||
--min-sdk-version=$(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
|
||||
--min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
|
||||
$(if $(NO_OPTIMIZE_DX), \
|
||||
--no-optimize) \
|
||||
$(if $(GENERATE_DEX_DEBUG), \
|
||||
|
|
|
@ -209,13 +209,23 @@ $(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|||
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
||||
|
||||
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
|
||||
my_default_app_target_sdk := $(LOCAL_SDK_VERSION)
|
||||
my_sdk_version := $(LOCAL_SDK_VERSION)
|
||||
else
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
|
||||
my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
|
||||
my_sdk_version := $(PLATFORM_SDK_VERSION)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_MIN_SDK_VERSION
|
||||
my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
|
||||
else
|
||||
my_min_sdk_version := $(call codename-or-sdk-to-sdk,$(my_default_app_target_sdk))
|
||||
endif
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(my_default_app_target_sdk)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(my_sdk_version)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
|
||||
|
||||
else # LOCAL_JACK_ENABLED
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
|
||||
|
|
26
core/java.mk
26
core/java.mk
|
@ -73,6 +73,13 @@ ifdef LOCAL_JACK_ENABLED
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef LOCAL_MIN_SDK_VERSION
|
||||
my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
|
||||
else
|
||||
my_min_sdk_version := $(call codename-or-sdk-to-sdk,\
|
||||
$(PRIVATE_DEFAULT_APP_TARGET_SDK))
|
||||
endif
|
||||
|
||||
ifndef LOCAL_SDK_VERSION
|
||||
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
||||
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
|
||||
|
@ -805,13 +812,24 @@ $(LOCAL_MODULE)-findbugs : $(findbugs_html)
|
|||
endif # full_classes_jar is defined
|
||||
|
||||
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
|
||||
my_default_app_target_sdk := $(LOCAL_SDK_VERSION)
|
||||
my_sdk_version := $(LOCAL_SDK_VERSION)
|
||||
else
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
|
||||
my_default_app_target_sdk := $(DEFAULT_APP_TARGET_SDK)
|
||||
my_sdk_version := $(PLATFORM_SDK_VERSION)
|
||||
endif
|
||||
|
||||
|
||||
ifdef LOCAL_MIN_SDK_VERSION
|
||||
my_min_sdk_version := $(LOCAL_MIN_SDK_VERSION)
|
||||
else
|
||||
my_min_sdk_version := $(call codename-or-sdk-to-sdk,$(my_default_app_target_sdk))
|
||||
endif
|
||||
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(my_default_app_target_sdk)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(my_sdk_version)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(my_min_sdk_version)
|
||||
|
||||
ifdef LOCAL_JACK_ENABLED
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): \
|
||||
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
|
||||
|
|
Loading…
Reference in a new issue