Add USE_D8_DESUGAR option in build/core
Add an option to use D8's desugar instead of the standalone version.
USE_D8_DESUGAR=true m would trigger DCHECK in dex2oat unless
https://android-review.googlesource.com/c/platform/art/+/562595 is
patched in as well.
Bug: 69329508
Test: m && USE_D8_DESUGAR=false m
Change-Id: I601dada44c361e45bbc0e2227ae1544a7d9efa90
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 1b3f967..8647fb4 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -173,7 +173,11 @@
$(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)