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: Ieba0219494f29d2737d2ca234317c3af7e5e72c8
This commit is contained in:
Yohann Roussel 2016-03-09 17:19:58 +01:00
parent 6be54d774b
commit 94451580af
7 changed files with 24 additions and 0 deletions

View file

@ -827,6 +827,7 @@ TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
# We don't have prebuilt system_current SDK yet. # We don't have prebuilt system_current SDK yet.
TARGET_AVAILABLE_SDK_VERSIONS := $(TARGET_AVAILABLE_SDK_VERSIONS) TARGET_AVAILABLE_SDK_VERSIONS := $(TARGET_AVAILABLE_SDK_VERSIONS)
$(info PLATFORM_JACK_MIN_SDK_VERSION = $(PLATFORM_JACK_MIN_SDK_VERSION))
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt

View file

@ -1986,6 +1986,7 @@ $(call call-jack) \
$(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \
$(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \ $(addprefix --import ,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES))) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \ $(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.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \ -D jack.import.type.policy=keep-first \
--output-jack $(PRIVATE_CLASSES_JACK) \ --output-jack $(PRIVATE_CLASSES_JACK) \
@ -2029,6 +2030,7 @@ $(hide) if [ -s $@.java-source-list-uniq ] ; then \
$(addprefix --classpath ,$(strip \ $(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(call reverse-list,$(PRIVATE_STATIC_JACK_LIBRARIES)) $(PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES) $(PRIVATE_ALL_JACK_LIBRARIES)))) \ $(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.import.resource.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
-D jack.import.type.policy=keep-first \ -D jack.import.type.policy=keep-first \
$(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \ $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
@$@.java-source-list-uniq; \ @$@.java-source-list-uniq; \
@ -2045,6 +2047,7 @@ define transform-jar-to-jack
$(PRIVATE_JACK_FLAGS) \ $(PRIVATE_JACK_FLAGS) \
-D jack.import.resource.policy=keep-first \ -D jack.import.resource.policy=keep-first \
-D jack.import.type.policy=keep-first \ -D jack.import.type.policy=keep-first \
-D jack.android.min-api-level=$(PRIVATE_JACK_MIN_SDK_VERSION) \
--import $< \ --import $< \
--import-resource $@.tmpjill.res \ --import-resource $@.tmpjill.res \
--output-jack $@ --output-jack $@
@ -2152,6 +2155,7 @@ $(call call-jack) \
$(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \ $(if $(PRIVATE_EXTRA_JAR_ARGS),--import-resource $@.res.tmp) \
-D jack.import.resource.policy=keep-first \ -D jack.import.resource.policy=keep-first \
-D jack.import.type.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)) \ $(if $(PRIVATE_JACK_INCREMENTAL_DIR),--incremental-folder $(PRIVATE_JACK_INCREMENTAL_DIR)) \
--output-jack $@ \ --output-jack $@ \
$(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \ $(addprefix --config-jarjar ,$(strip $(PRIVATE_JARJAR_RULES))) \

View file

@ -128,6 +128,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): \
endif endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(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_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) \ jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
$(jar_manifest_file) $(proto_java_sources_file_stamp) \ $(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 # *.proto files are not supported
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS) $(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_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): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jack): \ $(full_classes_jack): \

View file

@ -29,14 +29,18 @@ ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. # Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES) 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) else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES) LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
else else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES) LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
my_jack_min_sdk_version := $(LOCAL_SDK_VERSION)
endif endif
endif endif
endif endif
else else
my_jack_min_sdk_version := $(PLATFORM_JACK_MIN_SDK_VERSION)
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES) LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
endif endif
@ -371,6 +375,9 @@ $(error $(LOCAL_PATH): Target java module does not define any source or resource
endif endif
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 # Since we're using intermediates.COMMON, make sure that it gets cleaned
# properly. # properly.
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) $(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. # 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_FLAGS:=$(LOCAL_JACK_FLAGS)
$(intermediates.COMMON)/classes.jack : PRIVATE_JACK_MIN_SDK_VERSION := 1
$(intermediates.COMMON)/classes.jack : $(my_src_jar) \ $(intermediates.COMMON)/classes.jack : $(my_src_jar) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK) | setup-jack-server
$(transform-jar-to-jack) $(transform-jar-to-jack)

View file

@ -58,6 +58,15 @@ ifeq "" "$(PLATFORM_SDK_VERSION)"
PLATFORM_SDK_VERSION := 23 PLATFORM_SDK_VERSION := 23
endif 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)" ifeq "" "$(PLATFORM_VERSION_CODENAME)"
# This is the current development code-name, if the build is not a final # 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". # release build. If this is a final release build, it is simply "REL".