forked from openkylin/platform_build
Merge "Revert "Revert "Remove desugar support""" am: 50ad8c97ac
am: 9f0e4a430f
Change-Id: I8ef7ec33394af7fd7afab4455f79a932ee774b92
This commit is contained in:
commit
b71570fc8c
|
@ -576,9 +576,7 @@ USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
|
|||
|
||||
# Work around for b/68406220
|
||||
# This should match the soong version.
|
||||
ifndef USE_D8
|
||||
USE_D8 := true
|
||||
endif
|
||||
USE_D8 := true
|
||||
|
||||
# Default R8 behavior when USE_R8 is not specified.
|
||||
ifndef USE_R8
|
||||
|
@ -592,7 +590,6 @@ ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
|
|||
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
|
||||
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
|
||||
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
|
||||
DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
|
||||
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
|
||||
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
|
||||
|
@ -602,7 +599,6 @@ else # TARGET_BUILD_APPS || TARGET_BUILD_PDK
|
|||
AIDL := $(prebuilt_build_tools_bin)/aidl
|
||||
AAPT := $(prebuilt_sdk_tools_bin)/aapt
|
||||
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
|
||||
DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar
|
||||
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
|
||||
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
||||
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
|
||||
|
|
|
@ -2374,48 +2374,10 @@ define codename-or-sdk-to-sdk
|
|||
$(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1))
|
||||
endef
|
||||
|
||||
# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
|
||||
define desugar-classes-jar
|
||||
@echo Desugar: $@
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) rm -f $@ $@.tmp
|
||||
@rm -rf $(dir $@)/desugar_dumped_classes
|
||||
@mkdir $(dir $@)/desugar_dumped_classes
|
||||
$(hide) $(JAVA) \
|
||||
$(if $(USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
|
||||
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
|
||||
-jar $(DESUGAR) \
|
||||
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
|
||||
$(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
|
||||
mv $@.tmp $@
|
||||
endef
|
||||
|
||||
|
||||
define transform-classes.jar-to-dex
|
||||
@echo "target Dex: $(PRIVATE_MODULE)"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) rm -f $(dir $@)classes*.dex
|
||||
$(hide) $(DX_COMMAND) \
|
||||
--dex --output=$(dir $@) \
|
||||
--min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
|
||||
$(if $(NO_OPTIMIZE_DX), \
|
||||
--no-optimize) \
|
||||
$(if $(GENERATE_DEX_DEBUG), \
|
||||
--debug --verbose \
|
||||
--dump-to=$(@:.dex=.lst) \
|
||||
--dump-width=1000) \
|
||||
$(PRIVATE_DX_FLAGS) \
|
||||
$<
|
||||
endef
|
||||
|
||||
|
||||
define transform-classes-d8.jar-to-dex
|
||||
@echo "target Dex: $(PRIVATE_MODULE)"
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
|
||||
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
|
||||
$(hide) $(DX_COMMAND) \
|
||||
|
|
|
@ -33,7 +33,6 @@ full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
|||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
||||
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
||||
full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
|
||||
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
||||
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
||||
built_dex := $(intermediates.COMMON)/classes.dex
|
||||
|
@ -43,7 +42,6 @@ LOCAL_INTERMEDIATE_TARGETS += \
|
|||
$(full_classes_turbine_jar) \
|
||||
$(full_classes_compiled_jar) \
|
||||
$(full_classes_combined_jar) \
|
||||
$(full_classes_desugar_jar) \
|
||||
$(full_classes_jarjar_jar) \
|
||||
$(full_classes_jar) \
|
||||
$(built_dex) \
|
||||
|
@ -158,22 +156,6 @@ endif
|
|||
|
||||
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
|
||||
|
||||
ifneq ($(USE_D8_DESUGAR),true)
|
||||
my_desugaring :=
|
||||
ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
|
||||
my_desugaring := true
|
||||
$(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)
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
||||
# No dex; all we want are the .class files with resources.
|
||||
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
|
||||
|
@ -184,12 +166,8 @@ $(LOCAL_BUILT_MODULE) : $(full_classes_jar)
|
|||
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) $(ZIP2ZIP)
|
||||
ifneq ($(USE_D8_DESUGAR),true)
|
||||
$(built_dex): $(full_classes_jar) $(DX) $(ZIP2ZIP)
|
||||
$(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)
|
||||
|
|
24
core/java.mk
24
core/java.mk
|
@ -72,7 +72,6 @@ full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
|||
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
||||
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
||||
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
|
||||
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
|
||||
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
||||
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
|
||||
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
||||
|
@ -94,7 +93,6 @@ endif
|
|||
LOCAL_INTERMEDIATE_TARGETS += \
|
||||
$(full_classes_turbine_jar) \
|
||||
$(full_classes_compiled_jar) \
|
||||
$(full_classes_desugar_jar) \
|
||||
$(full_classes_jarjar_jar) \
|
||||
$(full_classes_jar) \
|
||||
$(full_classes_combined_jar) \
|
||||
|
@ -376,23 +374,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
|
||||
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
||||
$(full_classes_desugar_jar): $(LOCAL_FULL_CLASSES_JACOCO_JAR) $(full_java_header_libs) $(DESUGAR)
|
||||
$(desugar-classes-jar)
|
||||
endif
|
||||
else
|
||||
my_desugaring :=
|
||||
endif
|
||||
|
||||
ifndef my_desugaring
|
||||
full_classes_desugar_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
|
||||
endif
|
||||
|
||||
full_classes_pre_proguard_jar := $(full_classes_desugar_jar)
|
||||
full_classes_pre_proguard_jar := $(LOCAL_FULL_CLASSES_JACOCO_JAR)
|
||||
|
||||
# Keep a copy of the jar just before proguard processing.
|
||||
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
|
||||
|
@ -553,11 +535,7 @@ endif # LOCAL_PROGUARD_ENABLED
|
|||
|
||||
ifndef my_r8
|
||||
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
|
||||
ifneq ($(USE_D8_DESUGAR),true)
|
||||
$(transform-classes.jar-to-dex)
|
||||
else
|
||||
$(transform-classes-d8.jar-to-dex)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
|
||||
|
|
Loading…
Reference in New Issue