Merge changes I3bafbb2d,If30943ef

* changes:
  Desugar default methods if required
  Fix desugaring when LOCAL_SDK_VERSION is not set
This commit is contained in:
Colin Cross 2017-10-27 01:40:15 +00:00 committed by Gerrit Code Review
commit 0239edea1d
4 changed files with 22 additions and 37 deletions

View file

@ -2385,7 +2385,6 @@ $(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1))
endef
# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
# --desugar_try_with_resources_if_needed=false is needed due to b/63180735, b/63901645, b/63900665
define desugar-classes-jar
@echo Desugar: $@
@mkdir -p $(dir $@)
@ -2397,9 +2396,8 @@ $(hide) $(JAVA) \
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
-jar $(DESUGAR) \
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) \
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
--desugar_try_with_resources_if_needed=false \
$(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
--allow_empty_bootclasspath \
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
-i $< -o $@.tmp

View file

@ -28,10 +28,6 @@ USE_CORE_LIB_BOOTCLASSPATH := true
include $(BUILD_SYSTEM)/host_java_library_common.mk
#######################################
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex $(LOCAL_JAVA_LIBRARIES)
endif
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar

View file

@ -18,25 +18,6 @@ endif #PDK
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
ifneq ($(LOCAL_MODULE),jacocoagent)
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
ifeq ($(EMMA_INSTRUMENT),true)
ifneq ($(EMMA_INSTRUMENT_STATIC),true)
# For instrumented build, if Jacoco is not being included statically
# in instrumented packages then include Jacoco classes into the
# bootclasspath.
LOCAL_JAVA_LIBRARIES := jacocoagent $(LOCAL_JAVA_LIBRARIES)
endif # EMMA_INSTRUMENT_STATIC
endif # EMMA_INSTRUMENT
endif # !LOCAL_NO_STANDARD_LIBRARIES
endif # LOCAL_MODULE == jacocoagent
ifndef LOCAL_SDK_VERSION
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES := $(TARGET_DEFAULT_JAVA_LIBRARIES) $(LOCAL_JAVA_LIBRARIES)
endif
endif
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
ifneq ($(proto_sources),)
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)

View file

@ -200,8 +200,6 @@ full_java_bootclasspath_libs :=
empty_bootclasspath :=
my_system_modules :=
# full_java_libs: The list of files that should be used as the classpath.
# Using this list as a dependency list WILL NOT WORK.
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
@ -212,8 +210,19 @@ ifndef LOCAL_IS_HOST_MODULE
# now, so just always assume that they want the default system modules
my_system_modules := $(DEFAULT_SYSTEM_MODULES)
else # LOCAL_NO_STANDARD_LIBRARIES
full_java_bootclasspath_libs := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES))
full_java_bootclasspath_libs := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
LOCAL_JAVA_LIBRARIES := $(filter-out $(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES),$(LOCAL_JAVA_LIBRARIES))
my_system_modules := $(DEFAULT_SYSTEM_MODULES)
ifneq ($(LOCAL_MODULE),jacocoagent)
ifeq ($(EMMA_INSTRUMENT),true)
ifneq ($(EMMA_INSTRUMENT_STATIC),true)
# For instrumented build, if Jacoco is not being included statically
# in instrumented packages then include Jacoco classes into the
# bootclasspath.
full_java_bootclasspath_libs += $(call java-lib-header-files,jacocoagent)
endif # EMMA_INSTRUMENT_STATIC
endif # EMMA_INSTRUMENT
endif # LOCAL_MODULE == jacocoagent
endif # LOCAL_NO_STANDARD_LIBRARIES
else
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
@ -265,6 +274,7 @@ else # LOCAL_IS_HOST_MODULE
full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
full_shared_java_header_libs := $(full_shared_java_libs)
endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
@ -294,9 +304,6 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := $(full_java_bootclasspat
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EMPTY_BOOTCLASSPATH := $(empty_bootclasspath)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES := $(my_system_modules_dir)
full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs)
ifndef LOCAL_IS_HOST_MODULE
# This is set by packages that are linking to other packages that export
# shared libraries, allowing them to make use of the code in the linked apk.
@ -307,8 +314,7 @@ ifneq ($(apk_libraries),)
# link against the jar with full original names (before proguard processing).
full_shared_java_libs += $(link_apk_libraries)
full_java_libs += $(link_apk_libraries)
full_java_header_libs += $(link_apk_header_libs)
full_shared_java_header_libs += $(link_apk_header_libs)
endif
# This is set by packages that contain instrumentation, allowing them to
@ -330,8 +336,8 @@ ifdef LOCAL_INSTRUMENTATION_FOR
else
link_instr_classes_header_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
endif
full_java_libs += $(link_instr_classes_jar)
full_java_header_libs += $(link_instr_classes_header_jar)
full_shared_java_libs += $(link_instr_classes_jar)
full_shared_java_header_libs += $(link_instr_classes_header_jar)
endif # LOCAL_INSTRUMENTATION_FOR
endif # LOCAL_IS_HOST_MODULE
@ -378,8 +384,12 @@ ALL_MODULES.$(my_register_name).RS_FILES := $(renderscript_sources_fullpath)
endif
endif # !LOCAL_IS_HOST_MODULE
full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_LIBRARIES := $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_JAVA_HEADER_LIBRARIES := $(full_java_header_libs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SHARED_JAVA_HEADER_LIBRARIES := $(full_shared_java_header_libs)
ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
$(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)