Remove proguard support

R8 is always used now.

Bug: 111885749
Test: m checkbuild
Change-Id: I9ae586c6360f2e3050422090b4e08f27ae167758
This commit is contained in:
Colin Cross 2018-07-25 13:41:42 -07:00
parent e1feef5025
commit 3ebfe7309f
5 changed files with 11 additions and 74 deletions

View File

@ -281,7 +281,6 @@ LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_USE_AAPT2:=$(USE_AAPT2)
LOCAL_USE_CLANG_LLD:=
LOCAL_USE_R8:=
LOCAL_USE_VNDK:=
LOCAL_USES_LIBRARIES:=
LOCAL_VENDOR_MODULE:=

View File

@ -588,12 +588,6 @@ USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
USE_D8 := true
.KATI_READONLY := USE_D8
# Default R8 behavior when USE_R8 is not specified.
ifndef USE_R8
USE_R8 := true
endif
.KATI_READONLY := USE_R8
#
# Tools that are prebuilts for TARGET_BUILD_APPS
#

View File

@ -2906,22 +2906,6 @@ $(2): $(1) $(call hiddenapi-soong-output-dex,$(2)) | $(SOONG_ZIP) $(MERGE_ZIPS)
$(MERGE_ZIPS) -D -zipToNotStrip $${OUTPUT_JAR} -stripFile "classes*.dex" $(2) $${OUTPUT_JAR} $(1)
endef
###########################################################
## Commands to call Proguard
###########################################################
ifdef TARGET_OPENJDK9
define transform-jar-to-proguard
@echo Skipping Proguard: $< $@
$(hide) cp '$<' $@
endef
else
define transform-jar-to-proguard
@echo Proguard: $@
$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \
$(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR))
endef
endif
###########################################################
## Commands to call R8

View File

@ -15,10 +15,6 @@ endif
endif # !PDK_JAVA
endif #PDK
ifndef LOCAL_USE_R8
LOCAL_USE_R8 := $(USE_R8)
endif
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
@ -73,7 +69,6 @@ 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_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
built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
@ -97,7 +92,6 @@ LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(full_classes_combined_jar) \
$(full_classes_proguard_jar) \
$(built_dex_intermediate) \
$(built_dex) \
$(full_classes_stubs_jar) \
@ -405,12 +399,7 @@ else
endif
endif
ifeq ($(USE_R8),true)
proguard_jars_prefix := -libraryjars
else
proguard_jars_prefix := -systemjars
endif
legacy_proguard_flags := $(addprefix $(proguard_jars_prefix) ,$(my_proguard_sdk_raise) \
legacy_proguard_flags := $(addprefix -libraryjars ,$(my_proguard_sdk_raise) \
$(filter-out $(my_proguard_sdk_raise), \
$(full_java_bootclasspath_libs) \
$(full_shared_java_header_libs)))
@ -477,9 +466,7 @@ endif # no obfuscation
endif # LOCAL_INSTRUMENTATION_FOR
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES))
ifeq ($(LOCAL_USE_R8),true)
proguard_flag_files += $(addprefix $(LOCAL_PATH)/, $(LOCAL_R8_FLAG_FILES))
endif # LOCAL_USE_R8
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
@ -489,60 +476,33 @@ extra_input_jar :=
endif
ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
ifneq ($(LOCAL_USE_R8),true)
$(full_classes_proguard_jar): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
else
$(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
endif
endif
# If R8 is not enabled run Proguard.
ifneq ($(LOCAL_USE_R8),true)
# Changes to these dependencies need to be replicated below when using R8
# instead of Proguard + dx.
$(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) : $(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)
else # !LOCAL_USE_R8
# Running R8 instead of Proguard, proguarded jar is actually the pre-Proguarded jar.
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # !LOCAL_USE_R8
else # LOCAL_PROGUARD_ENABLED not defined
proguard_flag_files :=
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # LOCAL_PROGUARD_ENABLED defined
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
my_r8 :=
ifdef LOCAL_PROGUARD_ENABLED
ifeq ($(LOCAL_USE_R8),true)
# These are the dependencies for the proguarded jar when running
# Proguard + dx. They are used for the generated dex when using R8, as
# R8 does Proguard + dx
my_r8 := true
$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
$(built_dex_intermediate) : $(full_classes_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
$(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
$(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
$(built_dex_intermediate) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_proguard_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) $(legacy_proguard_lib_deps) $(R8_COMPAT_PROGUARD)
$(transform-jar-to-dex-r8)
endif # LOCAL_USE_R8
endif # LOCAL_PROGUARD_ENABLED
ifndef my_r8
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
else # !LOCAL_PROGUARD_ENABLED
$(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP)
$(transform-classes.jar-to-dex)
endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
# Derive API greylist from the classes jar.
# We use full_classes_proguard_jar here, as that is what is converted to dex
# later on. The difference is academic currently, as we don't proguard any
# We use full_classes_pre_proguard_jar here, as that is what is converted to
# dex later on. The difference is academic currently, as we don't proguard any
# bootclasspath code at the moment. If we were to do that, we should add keep
# rules for all members with the @UnsupportedAppUsage annotation.
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_proguard_jar),$(greylist_txt)))
$(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_pre_proguard_jar),$(greylist_txt)))
LOCAL_INTERMEDIATE_TARGETS += $(greylist_txt)
$(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
built_dex_copy_from := $(built_dex_hiddenapi)

View File

@ -57,9 +57,9 @@ include $(BUILD_SYSTEM)/java.mk
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# There are some dependencies outside the build system that assume classes.jar
# is available as javalib.jar so copy it there too.
$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(common_javalib.jar)))
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(common_javalib.jar)))
$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(LOCAL_BUILT_MODULE)))
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(LOCAL_BUILT_MODULE)))
else # !LOCAL_IS_STATIC_JAVA_LIBRARY