forked from openkylin/platform_build
Merge "Package jacoco and proguard files out of a PACKAGING directory" am: df682c6fe1
am: 20f7c8aa14
Original change: https://android-review.googlesource.com/c/platform/build/+/1666060 Change-Id: Icfcc9ecf69ab23309ba1f4a1626a95d0ec82c997
This commit is contained in:
commit
c501f5e0ae
|
@ -5353,10 +5353,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)
|
||||
|
@ -5372,13 +5380,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.
|
||||
|
@ -5399,11 +5405,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