forked from openkylin/platform_build
Package jacoco and proguard files out of a PACKAGING directory
Package jacoco-report-classes.jar, proguard_usage.zip and proguard_dictionary out of directories in $OUT/obj/PACKAGING so that they get cleared by m installclean. This will make incremental builds that package these files accurate as long as installclean was run, which is much faster than a full clean build. Bug: 184583915 Test: m TARGET_BUILD_APPS=DeskClock EMMA_INSTRUMENT=true dist Change-Id: I60c6a0fec1fbce26eab8d5adab25a2231b48e251
This commit is contained in:
parent
25444470db
commit
330b1fef31
|
@ -5331,10 +5331,18 @@ ifeq (true,$(EMMA_INSTRUMENT))
|
|||
# Any dependencies are set up later in build/make/core/main.mk.
|
||||
|
||||
JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
|
||||
$(JACOCO_REPORT_CLASSES_ALL): PRIVATE_TARGET_JACOCO_DIR := $(call intermediates-dir-for,PACKAGING,jacoco)
|
||||
$(JACOCO_REPORT_CLASSES_ALL): PRIVATE_HOST_JACOCO_DIR := $(call intermediates-dir-for,PACKAGING,jacoco,HOST)
|
||||
$(JACOCO_REPORT_CLASSES_ALL): PRIVATE_TARGET_PROGUARD_USAGE_DIR := $(call intermediates-dir-for,PACKAGING,proguard_usage)
|
||||
$(JACOCO_REPORT_CLASSES_ALL): PRIVATE_HOST_PROGUARD_USAGE_DIR := $(call intermediates-dir-for,PACKAGING,proguard_usage,HOST)
|
||||
$(JACOCO_REPORT_CLASSES_ALL) :
|
||||
@echo "Collecting uninstrumented classes"
|
||||
find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" -o -name "proguard_usage.zip" 2>/dev/null | sort > $@.list
|
||||
$(SOONG_ZIP) -o $@ -L 0 -C $(OUT_DIR) -P out -l $@.list
|
||||
mkdir -p $(PRIVATE_TARGET_JACOCO_DIR) $(PRIVATE_HOST_JACOCO_DIR) $(PRIVATE_TARGET_PROGUARD_USAGE_DIR) $(PRIVATE_HOST_PROGUARD_USAGE_DIR)
|
||||
$(SOONG_ZIP) -o $@ -L 0 \
|
||||
-C $(PRIVATE_TARGET_JACOCO_DIR) -P out/target/common/obj -D $(PRIVATE_TARGET_JACOCO_DIR) \
|
||||
-C $(PRIVATE_HOST_JACOCO_DIR) -P out/target/common/obj -D $(PRIVATE_HOST_JACOCO_DIR) \
|
||||
-C $(PRIVATE_TARGET_PROGUARD_USAGE_DIR) -P out/target/common/obj -D $(PRIVATE_TARGET_PROGUARD_USAGE_DIR) \
|
||||
-C $(PRIVATE_HOST_PROGUARD_USAGE_DIR) -P out/target/common/obj -D $(PRIVATE_HOST_PROGUARD_USAGE_DIR)
|
||||
|
||||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
$(JACOCO_REPORT_CLASSES_ALL): $(INTERNAL_ALLIMAGES_FILES)
|
||||
|
@ -5350,13 +5358,11 @@ PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_
|
|||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
$(PROGUARD_DICT_ZIP): $(INTERNAL_ALLIMAGES_FILES) $(updater_dep)
|
||||
endif
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_PACKAGING_DIR := $(call intermediates-dir-for,PACKAGING,proguard_dictionary)
|
||||
$(PROGUARD_DICT_ZIP): $(SOONG_ZIP)
|
||||
@echo "Packaging Proguard obfuscation dictionary files."
|
||||
mkdir -p $(dir $@) $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS $(dir $(PRIVATE_LIST_FILE))
|
||||
find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary | \
|
||||
sed -e 's/\(.*\)\/proguard_dictionary/\0\n\1\/classes.jar/' > $(PRIVATE_LIST_FILE)
|
||||
$(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
|
||||
mkdir -p $(dir $@) $(PRIVATE_PACKAGING_DIR)
|
||||
$(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(PRIVATE_PACKAGING_DIR) -P out/target/common/obj -D $(PRIVATE_PACKAGING_DIR)
|
||||
|
||||
#------------------------------------------------------------------
|
||||
# A zip of Proguard usage files.
|
||||
|
@ -5377,11 +5383,12 @@ $(PROGUARD_USAGE_ZIP): \
|
|||
$(INSTALLED_ODM_DLKMIMAGE_TARGET) \
|
||||
$(updater_dep)
|
||||
endif
|
||||
$(PROGUARD_USAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard_usage)/filelist
|
||||
$(PROGUARD_USAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard_usage.zip)/filelist
|
||||
$(PROGUARD_USAGE_ZIP): PRIVATE_PACKAGING_DIR := $(call intermediates-dir-for,PACKAGING,proguard_usage)
|
||||
$(PROGUARD_USAGE_ZIP): $(MERGE_ZIPS)
|
||||
@echo "Packaging Proguard usage files."
|
||||
mkdir -p $(dir $@) $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS $(dir $(PRIVATE_LIST_FILE))
|
||||
find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_usage.zip > $(PRIVATE_LIST_FILE)
|
||||
mkdir -p $(dir $@) $(PRIVATE_PACKAGING_DIR) $(dir $(PRIVATE_LIST_FILE))
|
||||
find $(PRIVATE_PACKAGING_DIR) -name proguard_usage.zip > $(PRIVATE_LIST_FILE)
|
||||
$(MERGE_ZIPS) $@ @$(PRIVATE_LIST_FILE)
|
||||
|
||||
ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
|
||||
|
|
|
@ -744,6 +744,42 @@ $(strip \
|
|||
)
|
||||
endef
|
||||
|
||||
###########################################################
|
||||
## The packaging directory for a module. Similar to intermedates, but
|
||||
## in a location that will be wiped by an m installclean.
|
||||
###########################################################
|
||||
|
||||
# $(1): subdir in PACKAGING
|
||||
# $(2): target class, like "APPS"
|
||||
# $(3): target name, like "NotePad"
|
||||
# $(4): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> }
|
||||
define packaging-dir-for
|
||||
$(strip \
|
||||
$(eval _pdfClass := $(strip $(2))) \
|
||||
$(if $(_pdfClass),, \
|
||||
$(error $(LOCAL_PATH): Class not defined in call to generated-sources-dir-for)) \
|
||||
$(eval _pdfName := $(strip $(3))) \
|
||||
$(if $(_pdfName),, \
|
||||
$(error $(LOCAL_PATH): Name not defined in call to generated-sources-dir-for)) \
|
||||
$(call intermediates-dir-for,PACKAGING,$(1),$(4))/$(_pdfClass)/$(_pdfName)_intermediates \
|
||||
)
|
||||
endef
|
||||
|
||||
# Uses LOCAL_MODULE_CLASS, LOCAL_MODULE, and LOCAL_IS_HOST_MODULE
|
||||
# to determine the packaging directory.
|
||||
#
|
||||
# $(1): subdir in PACKAGING
|
||||
define local-packaging-dir
|
||||
$(strip \
|
||||
$(if $(strip $(LOCAL_MODULE_CLASS)),, \
|
||||
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \
|
||||
$(if $(strip $(LOCAL_MODULE)),, \
|
||||
$(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \
|
||||
$(call packaging-dir-for,$(1),$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST)) \
|
||||
)
|
||||
endef
|
||||
|
||||
|
||||
###########################################################
|
||||
## Convert a list of short module names (e.g., "framework", "Browser")
|
||||
## into the list of files that are built for those modules.
|
||||
|
|
|
@ -71,7 +71,11 @@ $(my_classes_to_report_on_path): $(my_unzipped_timestamp_path)
|
|||
zip -q $@ \
|
||||
-r $(PRIVATE_UNZIPPED_PATH)
|
||||
|
||||
|
||||
# Make a rule to copy the jacoco-report-classes.jar to a packaging directory.
|
||||
$(eval $(call copy-one-file,$(my_classes_to_report_on_path),\
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar)
|
||||
|
||||
# make a task that invokes instrumentation
|
||||
my_instrumented_path := $(my_files)/work/instrumented/classes
|
||||
|
|
11
core/java.mk
11
core/java.mk
|
@ -470,6 +470,17 @@ endif
|
|||
|
||||
ifneq ($(filter obfuscation,$(LOCAL_PROGUARD_ENABLED)),)
|
||||
$(built_dex_intermediate): .KATI_IMPLICIT_OUTPUTS := $(proguard_dictionary) $(proguard_configuration)
|
||||
|
||||
# Make a rule to copy the proguard_dictionary to a packaging directory.
|
||||
$(eval $(call copy-one-file,$(proguard_dictionary),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary)
|
||||
|
||||
$(eval $(call copy-one-file,$(full_classes_pre_proguard_jar),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar)
|
||||
endif
|
||||
|
||||
endif # LOCAL_PROGUARD_ENABLED defined
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# LOCAL_SOONG_HEADER_JAR
|
||||
# LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
||||
# LOCAL_SOONG_PROGUARD_DICT
|
||||
# LOCAL_SOONG_PROGUARD_USAGE
|
||||
# LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
||||
# LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
||||
# LOCAL_SOONG_RRO_DIRS
|
||||
# LOCAL_SOONG_JNI_LIBS_$(TARGET_ARCH)
|
||||
|
@ -74,23 +74,31 @@ endif
|
|||
|
||||
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
|
||||
$(intermediates.COMMON)/jacoco-report-classes.jar))
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(intermediates.COMMON)/jacoco-report-classes.jar)
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_DICT
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(intermediates.COMMON)/proguard_dictionary))
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary))
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(intermediates.COMMON)/proguard_dictionary)
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary)
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_USAGE_ZIP),\
|
||||
$(intermediates.COMMON)/proguard_usage.zip))
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(intermediates.COMMON)/proguard_usage.zip)
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
||||
|
|
|
@ -47,23 +47,31 @@ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(LOCAL_BUILT_MODULE))
|
|||
|
||||
ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR),\
|
||||
$(intermediates.COMMON)/jacoco-report-classes.jar))
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar))
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(intermediates.COMMON)/jacoco-report-classes.jar)
|
||||
$(call local-packaging-dir,jacoco)/jacoco-report-classes.jar)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_DICT
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(intermediates.COMMON)/proguard_dictionary))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary))
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar))
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(intermediates.COMMON)/proguard_dictionary)
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/proguard_dictionary)
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(call local-packaging-dir,proguard_dictionary)/classes.jar)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_USAGE
|
||||
ifdef LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_USAGE_ZIP),\
|
||||
$(intermediates.COMMON)/proguard_usage.zip))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(intermediates.COMMON)/proguard_usage.zip)
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip))
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip)
|
||||
endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue