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/java.mk b/core/java.mk
index 75bc387..ea43311 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -574,6 +574,7 @@
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): $(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 @@
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)