Merge "Remove proguard support"

This commit is contained in:
Treehugger Robot 2018-08-15 01:14:45 +00:00 committed by Gerrit Code Review
commit 72150c147e
5 changed files with 11 additions and 74 deletions

View File

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

View File

@ -580,12 +580,6 @@ USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
USE_D8 := true USE_D8 := true
.KATI_READONLY := USE_D8 .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 # Tools that are prebuilts for TARGET_BUILD_APPS
# #

View File

@ -2909,22 +2909,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) $(MERGE_ZIPS) -D -zipToNotStrip $${OUTPUT_JAR} -stripFile "classes*.dex" $(2) $${OUTPUT_JAR} $(1)
endef 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 ## Commands to call R8

View File

@ -15,10 +15,6 @@ endif
endif # !PDK_JAVA endif # !PDK_JAVA
endif #PDK endif #PDK
ifndef LOCAL_USE_R8
LOCAL_USE_R8 := $(USE_R8)
endif
LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES)) LOCAL_NO_STANDARD_LIBRARIES:=$(strip $(LOCAL_NO_STANDARD_LIBRARIES))
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) 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_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar full_classes_processed_jar := $(intermediates.COMMON)/classes-processed.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.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 full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex built_dex_intermediate := $(intermediates.COMMON)/dex/classes.dex
built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
@ -97,7 +92,6 @@ LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_jarjar_jar) \ $(full_classes_jarjar_jar) \
$(full_classes_jar) \ $(full_classes_jar) \
$(full_classes_combined_jar) \ $(full_classes_combined_jar) \
$(full_classes_proguard_jar) \
$(built_dex_intermediate) \ $(built_dex_intermediate) \
$(built_dex) \ $(built_dex) \
$(full_classes_stubs_jar) \ $(full_classes_stubs_jar) \
@ -405,12 +399,7 @@ else
endif endif
endif endif
ifeq ($(USE_R8),true) legacy_proguard_flags := $(addprefix -libraryjars ,$(my_proguard_sdk_raise) \
proguard_jars_prefix := -libraryjars
else
proguard_jars_prefix := -systemjars
endif
legacy_proguard_flags := $(addprefix $(proguard_jars_prefix) ,$(my_proguard_sdk_raise) \
$(filter-out $(my_proguard_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)))
@ -477,9 +466,7 @@ endif # no obfuscation
endif # LOCAL_INSTRUMENTATION_FOR endif # LOCAL_INSTRUMENTATION_FOR
proguard_flag_files := $(addprefix $(LOCAL_PATH)/, $(LOCAL_PROGUARD_FLAG_FILES)) 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)) proguard_flag_files += $(addprefix $(LOCAL_PATH)/, $(LOCAL_R8_FLAG_FILES))
endif # LOCAL_USE_R8
LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files)) LOCAL_PROGUARD_FLAGS += $(addprefix -include , $(proguard_flag_files))
ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH ifdef LOCAL_TEST_MODULE_TO_PROGUARD_WITH
@ -489,60 +476,33 @@ extra_input_jar :=
endif endif
ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),) 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) $(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
endif 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 else # LOCAL_PROGUARD_ENABLED not defined
proguard_flag_files := proguard_flag_files :=
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # LOCAL_PROGUARD_ENABLED defined endif # LOCAL_PROGUARD_ENABLED defined
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true) ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) $(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
my_r8 :=
ifdef LOCAL_PROGUARD_ENABLED ifdef LOCAL_PROGUARD_ENABLED
ifeq ($(LOCAL_USE_R8),true) $(built_dex_intermediate): PRIVATE_EXTRA_INPUT_JAR := $(extra_input_jar)
# These are the dependencies for the proguarded jar when running $(built_dex_intermediate): PRIVATE_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
# Proguard + dx. They are used for the generated dex when using R8, as $(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)
# 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)
$(transform-jar-to-dex-r8) $(transform-jar-to-dex-r8)
endif # LOCAL_USE_R8 else # !LOCAL_PROGUARD_ENABLED
endif # LOCAL_PROGUARD_ENABLED $(built_dex_intermediate): $(full_classes_pre_proguard_jar) $(DX) $(ZIP2ZIP)
ifndef my_r8
$(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(ZIP2ZIP)
$(transform-classes.jar-to-dex) $(transform-classes.jar-to-dex)
endif endif
ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar ifneq ($(filter $(LOCAL_MODULE),$(PRODUCT_BOOT_JARS)),) # is_boot_jar
# Derive API greylist from the classes jar. # Derive API greylist from the classes jar.
# We use full_classes_proguard_jar here, as that is what is converted to dex # We use full_classes_pre_proguard_jar here, as that is what is converted to
# later on. The difference is academic currently, as we don't proguard any # 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 # bootclasspath code at the moment. If we were to do that, we should add keep
# rules for all members with the @UnsupportedAppUsage annotation. # 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) LOCAL_INTERMEDIATE_TARGETS += $(greylist_txt)
$(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi))) $(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
built_dex_copy_from := $(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) ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# There are some dependencies outside the build system that assume classes.jar # There are some dependencies outside the build system that assume classes.jar
# is available as javalib.jar so copy it there too. # 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 else # !LOCAL_IS_STATIC_JAVA_LIBRARY