Merge "Move proguard before classes.jar"

This commit is contained in:
Treehugger Robot 2017-04-06 02:39:11 +00:00 committed by Gerrit Code Review
commit 41d5cd7420
6 changed files with 21 additions and 17 deletions

View File

@ -36,7 +36,7 @@ ifneq ($(full_classes_jar),)
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
ifndef LOCAL_JACK_ENABLED
# Use the jarjar processed arhive as the initial package file.
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(built_dpi_apk): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
else
$(built_dpi_apk): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
endif # LOCAL_JACK_ENABLED

View File

@ -110,14 +110,14 @@ LOCAL_PROGUARD_ENABLED :=
endif
full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
full_classes_desugar_jar := $(intermediates.COMMON)/desugar.classes.jar
full_classes_desugar_jar := $(intermediates.COMMON)/classes-desugar.jar
jarjar_leaf := classes-jarjar.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/$(jarjar_leaf)
emma_intermediates_dir := $(intermediates.COMMON)/emma_out
# emma is hardcoded to use the leaf name of its input for the output file --
# only the output directory can be changed
full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(jarjar_leaf)
full_classes_proguard_jar := $(intermediates.COMMON)/proguard.classes.jar
full_classes_proguard_jar := $(intermediates.COMMON)/classes-proguard.jar
built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_intermediate_leaf)/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
@ -483,11 +483,11 @@ else
full_classes_emma_jar := $(full_classes_jarjar_jar)
endif
# Keep a copy of the jar just before proguard processing.
# TODO: this should depend on full_classes_emma_jar once coverage works again
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
full_classes_pre_proguard_jar := $(full_classes_jarjar_jar)
$(call define-jar-to-toc-rule, $(full_classes_jar))
# Keep a copy of the jar just before proguard processing.
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),$(intermediates.COMMON)/classes-pre-proguard.jar))
# Run proguard if necessary
ifdef LOCAL_PROGUARD_ENABLED
@ -618,13 +618,17 @@ endif
$(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_PROGUARD_FLAGS := $(legacy_proguard_flags) $(common_proguard_flags) $(LOCAL_PROGUARD_FLAGS)
$(full_classes_proguard_jar) : $(full_classes_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
$(full_classes_proguard_jar) : $(full_classes_pre_proguard_jar) $(extra_input_jar) $(my_support_library_sdk_raise) $(common_proguard_flag_files) $(proguard_flag_files) | $(PROGUARD)
$(call transform-jar-to-proguard)
else # LOCAL_PROGUARD_ENABLED not defined
full_classes_proguard_jar := $(full_classes_jar)
full_classes_proguard_jar := $(full_classes_pre_proguard_jar)
endif # LOCAL_PROGUARD_ENABLED defined
$(eval $(call copy-one-file,$(full_classes_proguard_jar),$(full_classes_jar)))
$(call define-jar-to-toc-rule, $(full_classes_jar))
ifndef LOCAL_JACK_ENABLED
$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
# If you instrument class files that have local variable debug information in
@ -650,7 +654,7 @@ findbugs_xml := $(intermediates.COMMON)/findbugs.xml
$(findbugs_xml): PRIVATE_AUXCLASSPATH := $(addprefix -auxclasspath ,$(strip \
$(call normalize-path-list,$(filter %.jar,$(full_java_libs)))))
$(findbugs_xml): PRIVATE_FINDBUGS_FLAGS := $(LOCAL_FINDBUGS_FLAGS)
$(findbugs_xml) : $(full_classes_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
$(findbugs_xml) : $(full_classes_pre_proguard_jar) $(filter %.xml, $(LOCAL_FINDBUGS_FLAGS))
@echo Findbugs: $@
$(hide) $(FINDBUGS) -textui -effort:min -xml:withMessages \
$(PRIVATE_AUXCLASSPATH) $(PRIVATE_FINDBUGS_FLAGS) \

View File

@ -242,7 +242,7 @@ ifneq ($(apk_libraries),)
link_apk_libraries := \
$(foreach lib,$(apk_libraries), \
$(call intermediates-dir-for, \
APPS,$(lib),,COMMON)/classes.jar)
APPS,$(lib),,COMMON)/classes-pre-proguard.jar)
# link against the jar with full original names (before proguard processing).
full_shared_java_libs += $(link_apk_libraries)
@ -263,7 +263,7 @@ ifdef LOCAL_INSTRUMENTATION_FOR
link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
# link against the jar with full original names (before proguard processing).
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes-pre-proguard.jar
full_java_libs += $(link_instr_classes_jar)
full_java_lib_deps += $(link_instr_classes_jar)
endif # LOCAL_INSTRUMENTATION_FOR

View File

@ -67,11 +67,7 @@ include $(BUILD_SYSTEM)/java.mk
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
# No dex; all we want are the .class files with resources.
$(common_javalib.jar) : $(java_resource_sources)
ifdef LOCAL_PROGUARD_ENABLED
$(common_javalib.jar) : $(full_classes_proguard_jar)
else
$(common_javalib.jar) : $(full_classes_jar)
endif
@echo "target Static Jar: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
@ -85,7 +81,7 @@ endif
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(common_javalib.jar): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"

View File

@ -484,7 +484,7 @@ endif # LOCAL_NO_STANDARD_LIBRARIES
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
# Use the jarjar processed arhive as the initial package file.
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(LOCAL_BUILT_MODULE): $(built_dex)
else
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE :=

View File

@ -437,6 +437,7 @@ ifeq ($(LOCAL_IS_HOST_MODULE),)
# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
# while the deps should be in the common dir, so we make a copy in the common dir.
common_classes_jar := $(intermediates.COMMON)/classes.jar
common_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
common_javalib_jar := $(intermediates.COMMON)/javalib.jar
$(common_classes_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE)
@ -479,6 +480,9 @@ endif
$(common_classes_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
$(common_classes_pre_proguard_jar) : $(my_src_jar)
$(transform-prebuilt-to-target)
$(common_javalib_jar) : $(common_classes_jar)
$(transform-prebuilt-to-target)