Merge changes I81796b45,Iaf585336
* changes: Desugar default methods if required Always raise proguard libraries
This commit is contained in:
commit
437bbed858
|
@ -2385,7 +2385,6 @@ $(if $(filter $(1),$(PLATFORM_VERSION_CODENAME)),10000,$(1))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
|
# --add-opens is required because desugar reflects via java.lang.invoke.MethodHandles.Lookup
|
||||||
# --desugar_try_with_resources_if_needed=false is needed due to b/63180735, b/63901645, b/63900665
|
|
||||||
define desugar-classes-jar
|
define desugar-classes-jar
|
||||||
@echo Desugar: $@
|
@echo Desugar: $@
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
|
@ -2398,8 +2397,7 @@ $(hide) $(JAVA) \
|
||||||
-jar $(DESUGAR) \
|
-jar $(DESUGAR) \
|
||||||
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
|
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
|
||||||
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) \
|
$(addprefix --classpath_entry ,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)) \
|
||||||
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
|
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
|
||||||
--desugar_try_with_resources_if_needed=false \
|
|
||||||
--allow_empty_bootclasspath \
|
--allow_empty_bootclasspath \
|
||||||
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
|
$(if $(filter --core-library,$(PRIVATE_DX_FLAGS)),--core_library) \
|
||||||
-i $< -o $@.tmp
|
-i $< -o $@.tmp
|
||||||
|
|
26
core/java.mk
26
core/java.mk
|
@ -605,33 +605,33 @@ ifneq ($(filter-out full custom nosystem obfuscation optimization shrinktests,$(
|
||||||
endif
|
endif
|
||||||
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
|
proguard_dictionary := $(intermediates.COMMON)/proguard_dictionary
|
||||||
|
|
||||||
# Hack: see b/20667396
|
# When an app contains references to APIs that are not in the SDK specified by
|
||||||
# When an app's LOCAL_SDK_VERSION is lower than the support library's LOCAL_SDK_VERSION,
|
# its LOCAL_SDK_VERSION for example added by support library or by runtime
|
||||||
# we artifically raises the "SDK version" "linked" by ProGuard, to
|
# classes added by desugar, we artifically raise the "SDK version" "linked" by
|
||||||
|
# ProGuard, to
|
||||||
# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
|
# - suppress ProGuard warnings of referencing symbols unknown to the lower SDK version.
|
||||||
# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
|
# - prevent ProGuard stripping subclass in the support library that extends class added in the higher SDK version.
|
||||||
my_support_library_sdk_raise :=
|
# See b/20667396
|
||||||
ifneq (,$(filter android-support-%,$(LOCAL_STATIC_JAVA_LIBRARIES)))
|
my_proguard_sdk_raise :=
|
||||||
ifdef LOCAL_SDK_VERSION
|
ifdef LOCAL_SDK_VERSION
|
||||||
ifdef TARGET_BUILD_APPS
|
ifdef TARGET_BUILD_APPS
|
||||||
ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
|
ifeq (,$(filter current system_current test_current, $(LOCAL_SDK_VERSION)))
|
||||||
my_support_library_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
|
my_proguard_sdk_raise := $(call java-lib-header-files, sdk_vcurrent)
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
# For platform build, we can't just raise to the "current" SDK,
|
# For platform build, we can't just raise to the "current" SDK,
|
||||||
# that would break apps that use APIs removed from the current SDK.
|
# that would break apps that use APIs removed from the current SDK.
|
||||||
my_support_library_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
|
my_proguard_sdk_raise := $(call java-lib-header-files,$(TARGET_DEFAULT_BOOTCLASSPATH_LIBRARIES) $(TARGET_DEFAULT_JAVA_LIBRARIES))
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_support_library_sdk_raise) \
|
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_proguard_sdk_raise) \
|
||||||
$(filter-out $(my_support_library_sdk_raise), \
|
$(filter-out $(my_proguard_sdk_raise), \
|
||||||
$(full_java_bootclasspath_libs) \
|
$(full_java_bootclasspath_libs) \
|
||||||
$(full_shared_java_header_libs)))
|
$(full_shared_java_header_libs)))
|
||||||
|
|
||||||
legacy_proguard_lib_deps := $(my_support_library_sdk_raise) \
|
legacy_proguard_lib_deps := $(my_proguard_sdk_raise) \
|
||||||
$(filter-out $(my_support_library_sdk_raise),$(full_shared_java_header_libs))
|
$(filter-out $(my_proguard_sdk_raise),$(full_shared_java_header_libs))
|
||||||
|
|
||||||
legacy_proguard_flags += -printmapping $(proguard_dictionary)
|
legacy_proguard_flags += -printmapping $(proguard_dictionary)
|
||||||
|
|
||||||
|
@ -729,7 +729,7 @@ ifneq ($(USE_R8),true)
|
||||||
$(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
|
$(full_classes_proguard_jar): PRIVATE_PROGUARD_INJAR_FILTERS := $(proguard_injar_filters)
|
||||||
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
$(full_classes_proguard_jar): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
|
||||||
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
$(full_classes_proguard_jar): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
|
||||||
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) | $(PROGUARD)
|
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) | $(PROGUARD)
|
||||||
$(call transform-jar-to-proguard)
|
$(call transform-jar-to-proguard)
|
||||||
else # !USE_R8
|
else # !USE_R8
|
||||||
# Running R8 instead of Proguard, proguarded jar is actually the pre-Proguarded jar.
|
# Running R8 instead of Proguard, proguarded jar is actually the pre-Proguarded jar.
|
||||||
|
|
Loading…
Reference in New Issue