Don't desugar static java libraries

Static java libraires are designed to be included in another
java library.  If desugar runs on the static java library,
the resulting jar will contain the desugared lambda classes.
When the static jar is included into another java library
and desugar runs again, it desugars the static java library
classes again, producing the same desugared lambda classes
and colliding in the final jar.

Test: m -j ANDROID_COMPILE_WITH_JACK=false
Change-Id: I0508b2cc9c56dbbd4ac0aba44fb99ea2a27715e0
This commit is contained in:
Colin Cross 2017-03-21 10:17:04 -07:00
parent d01997faa6
commit 31060fdde1
1 changed files with 2 additions and 0 deletions

View File

@ -456,12 +456,14 @@ javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
my_desugaring :=
ifndef LOCAL_JACK_ENABLED
ifeq ($(LOCAL_JAVA_LANGUAGE_VERSION),1.8)
ifndef LOCAL_IS_STATIC_JAVA_LIBRARY
my_desugaring := true
$(full_classes_desugar_jar): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(full_classes_desugar_jar): $(full_classes_compiled_jar) $(DESUGAR)
$(desugar-classes-jar)
endif
endif
endif
ifndef my_desugaring
full_classes_desugar_jar := $(full_classes_compiled_jar)