Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 542aa57f authored by Shinichiro Hamaji's avatar Shinichiro Hamaji Committed by Gerrit Code Review
Browse files

Merge "Reduce unnecessary rebuilds of .dex files with restat=1"

parents 6725b4b0 f972a4a9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -571,6 +571,7 @@ endif
# ijar converts a .jar file to a smaller .jar file which only has its
# interfaces.
IJAR := $(HOST_OUT_EXECUTABLES)/ijar$(BUILD_EXECUTABLE_SUFFIX)
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)

# relocation packer
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
+31 −2
Original line number Diff line number Diff line
@@ -1948,9 +1948,9 @@ $(hide) mv $1.tmp $1
endef
endif

## Rule to creates a table of contents from a .jar file.
## Rule to create a table of contents from a .jar file.
## Must be called with $(eval).
# $1: A .jar file
# $(1): A .jar file
define _transform-jar-to-toc
$1.toc: $1 | $(IJAR)
	@echo Generating TOC: $$@
@@ -1959,11 +1959,40 @@ $1.toc: $1 | $(IJAR)
endef

## Define a rule which generates .jar.toc and mark it as .KATI_RESTAT.
# $(1): A .jar file
define define-jar-to-toc-rule
$(eval $(call _transform-jar-to-toc,$1))\
$(eval .KATI_RESTAT: $1.toc)
endef

ifeq (,$(TARGET_BUILD_APPS))

## Rule to create a table of contents from a .dex file.
## Must be called with $(eval).
# $(1): The directory which contains classes*.dex files
define _transform-dex-to-toc
$1/classes.dex.toc: PRIVATE_INPUT_DEX_FILES := $1/classes*.dex
$1/classes.dex.toc: $1/classes.dex $(DEXDUMP)
	@echo Generating TOC: $$@
	$(hide) $(DEXDUMP) -l xml $$(PRIVATE_INPUT_DEX_FILES) > $$@.tmp
	$$(call commit-change-for-toc,$$@)
endef

## Define a rule which generates .dex.toc and mark it as .KATI_RESTAT.
# $(1): The directory which contains classes*.dex files
define define-dex-to-toc-rule
$(eval $(call _transform-dex-to-toc,$1))\
$(eval .KATI_RESTAT: $1/classes.dex.toc)
endef

else

# Turn off .toc optimization for apps build as we cannot build dexdump.
define define-dex-to-toc-rule
endef

endif  # TARGET_BUILD_APPS


# Invoke Jack to compile java from source to jack files without shrink or obfuscation.
#
+7 −0
Original line number Diff line number Diff line
@@ -658,6 +658,11 @@ $(full_classes_jack): $(jack_all_deps)
	@echo Building with Jack: $@
	$(java-to-jack)

# Update timestamps of .toc files for static java libraries so
# dependents will be always rebuilt.
$(built_dex).toc: $(full_classes_jack)
	touch $@

else #LOCAL_IS_STATIC_JAVA_LIBRARY
$(built_dex_intermediate): PRIVATE_CLASSES_JACK := $(full_classes_jack)

@@ -671,6 +676,8 @@ $(built_dex_intermediate): $(jack_all_deps)
$(full_classes_jack): $(built_dex_intermediate)
	$(hide) touch $@

$(call define-dex-to-toc-rule, $(intermediates.COMMON))

endif #LOCAL_IS_STATIC_JAVA_LIBRARY

$(noshrob_classes_jack): PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-noshrob-rsc
+4 −0
Original line number Diff line number Diff line
@@ -293,6 +293,10 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH_JAVA_LIBRARIES := $(my_boot

full_shared_jack_libs := $(call jack-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_jack_lib_deps := $(call jack-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
# Turn off .toc optimization for apps build as we cannot build dexdump.
ifeq (,$(TARGET_BUILD_APPS))
full_jack_lib_deps := $(patsubst %.jack, %.dex.toc, $(full_jack_lib_deps))
endif

else # LOCAL_IS_HOST_MODULE

+5 −0
Original line number Diff line number Diff line
@@ -328,6 +328,11 @@ $(intermediates.COMMON)/classes.jack : $(my_src_jar) $(LOCAL_MODULE_MAKEFILE_DEP
        $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK)
	$(transform-jar-to-jack)

# Update timestamps of .toc files for prebuilts so dependents will be
# always rebuilt.
$(intermediates.COMMON)/classes.dex.toc: $(intermediates.COMMON)/classes.jack
	touch $@

endif # JAVA_LIBRARIES

$(built_module) : $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES)