Inform Jack of the min sdk

Set Jack min sdk according to LOCAL_SDK_VERSION. Gives Jack current
version when LOCAL_SDK_VERSION is not available.

Bug: 27371864

Change-Id: I5db233fe09aed0fae37fe9a92658bc8f24b86cdf
This commit is contained in:
Yohann Roussel 2016-03-09 17:19:58 +01:00
parent d2ca52df8c
commit c6383d6ec6
6 changed files with 23 additions and 0 deletions

View file

@ -1991,6 +1991,7 @@ $(call call-jack) \
$(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
-D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \
--output-jack $(PRIVATE_CLASSES_JACK) \
@ -2034,6 +2035,7 @@ $(hide) if [ -s $@.java-source-list-uniq ] ; then \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES)) $(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
-D jack.import.resource.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
-D jack.import.type.policy=keep-first \
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
@$@.java-source-list-uniq; \
@ -2050,6 +2052,7 @@ define transform-jar-to-jack
$(PRIVATE_JACK_FLAGS) \
-D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
--import $< \
--import-resource $@.tmpjill.res \
--output-jack $@
@ -2157,6 +2160,7 @@ $(call call-jack) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
-D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
--output-jack $@ \
$(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \

View file

@ -128,6 +128,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): \
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
$(jar_manifest_file) $(proto_java_sources_file_stamp) \

View file

@ -37,6 +37,7 @@ include $(BUILD_SYSTEM)/host_java_library.mk
# *.proto files are not supported
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
$(full_classes_jack): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jack): \

View file

@ -29,14 +29,18 @@ ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
my_jack_min_sdk_version := $(LOCAL_SDK_VERSION)
endif
endif
endif
else
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
endif
@ -371,6 +375,9 @@ $(error $(LOCAL_PATH): Target java module does not define any source or resource
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(my_jack_min_sdk_version)
my_jack_min_sdk_version :=
# Since we're using intermediates.COMMON, make sure that it gets cleaned
# properly.
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)

View file

@ -339,6 +339,7 @@ endif
# We may be building classes.jack from a host jar for host dalvik Java library.
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_FLAGS:=$(LOCAL_JACK_FLAGS)
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_MIN_SDK_VERSION := 1
$(intermediates.COMMON)/classes.jack : $(my_src_jar) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
$(transform-jar-to-jack)

View file

@ -58,6 +58,15 @@ ifeq "" "$(PLATFORM_SDK_VERSION)"
PLATFORM_SDK_VERSION := 23
endif
ifeq "" "$(PLATFORM_JACK_MIN_SDK_VERSION)"
# This is definition of the min SDK version given to Jack for the current
# platform. For released version it should be the same as
# PLATFORM_SDK_VERSION. During development, this number may be incremented
# before PLATFORM_SDK_VERSION if the plateform starts to add new java
# language supports.
PLATFORM_JACK_MIN_SDK_VERSION := 24
endif
ifeq "" "$(PLATFORM_VERSION_CODENAME)"
# This is the current development code-name, if the build is not a final
# release build. If this is a final release build, it is simply "REL".