Merge "Add USE_D8_DESUGAR option in build/core"

This commit is contained in:
Treehugger Robot 2017-12-12 00:06:18 +00:00 committed by Gerrit Code Review
commit 78b99fefd3
3 changed files with 25 additions and 0 deletions

View file

@ -2411,6 +2411,19 @@ $(hide) $(DX_COMMAND) \
$<
endef
define transform-classes-d8.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex
$(hide) $(DX_COMMAND) \
--output $(dir $@) \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
$(subst --no-locals, --release, \
$(filter-out --core-library --multi-dex,$(PRIVATE_DX_FLAGS))) \
$<
endef
# Create a mostly-empty .jar file that we'll add to later.
# The MacOS jar tool doesn't like creating empty jar files,
# so we need to give it something.

View file

@ -173,7 +173,11 @@ else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(built_dex): $(full_classes_desugar_jar) $(DX)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
$(transform-classes-d8.jar-to-dex)
endif
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)

View file

@ -574,6 +574,7 @@ ifdef TARGET_OPENJDK9
LOCAL_DX_FLAGS := $(filter-out --multi-dex,$(LOCAL_DX_FLAGS)) --multi-dex
endif
ifneq ($(USE_D8_DESUGAR),true)
my_desugaring :=
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
my_desugaring := true
@ -581,6 +582,9 @@ $(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(full_classes_desugar_jar): $(full_classes_jar) $(full_java_header_libs) $(DESUGAR)
$(desugar-classes-jar)
endif
else
my_desugaring :=
endif
ifndef my_desugaring
full_classes_desugar_jar := $(full_classes_jar)
@ -774,7 +778,11 @@ endif # LOCAL_PROGUARD_ENABLED
ifndef my_r8
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX)
ifneq ($(USE_D8_DESUGAR),true)
$(transform-classes.jar-to-dex)
else
$(transform-classes-d8.jar-to-dex)
endif
endif
$(built_dex): $(built_dex_intermediate)