Merge "Build the proguard dict zip without PACKAGING intermediates" into main
This commit is contained in:
@@ -6964,29 +6964,34 @@ endif # EMMA_INSTRUMENT=true
|
||||
# finding the appropriate dictionary to deobfuscate a stack trace frame.
|
||||
#
|
||||
|
||||
# The path to the zip file containing proguard dictionaries.
|
||||
PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict.zip
|
||||
# The path to the zip file containing mappings from dictionary hashes to filenames.
|
||||
PROGUARD_DICT_MAPPING := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-mapping.textproto
|
||||
.KATI_READONLY := PROGUARD_DICT_ZIP PROGUARD_DICT_MAPPING
|
||||
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
|
||||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
$(PROGUARD_DICT_ZIP): $(INTERNAL_ALLIMAGES_FILES) $(updater_dep)
|
||||
_proguard_dict_zip_modules := $(call product-installed-modules,$(INTERNAL_PRODUCT))
|
||||
else
|
||||
_proguard_dict_zip_modules := $(unbundled_build_modules)
|
||||
endif
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_PACKAGING_DIR := $(call intermediates-dir-for,PACKAGING,proguard_dictionary)
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_MAPPING_PACKAGING_DIR := $(call intermediates-dir-for,PACKAGING,proguard_dictionary_mapping)
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard_dictionary_filelist)/filelist
|
||||
$(PROGUARD_DICT_ZIP): $(SOONG_ZIP) $(SYMBOLS_MAP)
|
||||
|
||||
# The path to the zip file containing proguard dictionaries.
|
||||
PROGUARD_DICT_ZIP :=$= $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict.zip
|
||||
$(PROGUARD_DICT_ZIP): PRIVATE_SOONG_ZIP_ARGUMENTS := $(foreach m,$(_proguard_dict_zip_modules),$(ALL_MODULES.$(m).PROGUARD_DICTIONARY_SOONG_ZIP_ARGUMENTS))
|
||||
$(PROGUARD_DICT_ZIP): $(SOONG_ZIP) $(foreach m,$(_proguard_dict_zip_modules),$(ALL_MODULES.$(m).PROGUARD_DICTIONARY_FILES))
|
||||
@echo "Packaging Proguard obfuscation dictionary files."
|
||||
rm -rf $@ $(PRIVATE_LIST_FILE)
|
||||
mkdir -p $(PRIVATE_PACKAGING_DIR) $(PRIVATE_MAPPING_PACKAGING_DIR) $(dir $(PRIVATE_LIST_FILE))
|
||||
# Zip all of the files in the proguard dictionary directory.
|
||||
$(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(PRIVATE_PACKAGING_DIR) -D $(PRIVATE_PACKAGING_DIR)
|
||||
# Find all of the files in the proguard dictionary mapping directory and merge them into the mapping textproto.
|
||||
# Strip the PRIVATE_PACKAGING_DIR off the filenames to match soong_zip's -C argument.
|
||||
$(hide) find -L $(PRIVATE_MAPPING_PACKAGING_DIR) -type f | sort >$(PRIVATE_LIST_FILE)
|
||||
$(SYMBOLS_MAP) -merge $(PROGUARD_DICT_MAPPING) -strip_prefix $(PRIVATE_PACKAGING_DIR)/ -ignore_missing_files @$(PRIVATE_LIST_FILE)
|
||||
$(PROGUARD_DICT_ZIP): .KATI_IMPLICIT_OUTPUTS := $(PROGUARD_DICT_MAPPING)
|
||||
# Zip all of the files in PROGUARD_DICTIONARY_FILES.
|
||||
echo -n > $@.tmparglist
|
||||
$(foreach arg,$(PRIVATE_SOONG_ZIP_ARGUMENTS),printf "%s\n" "$(arg)" >> $@.tmparglist$(newline))
|
||||
$(SOONG_ZIP) -d -o $@ @$@.tmparglist
|
||||
rm -f $@.tmparglist
|
||||
|
||||
# The path to the zip file containing mappings from dictionary hashes to filenames.
|
||||
PROGUARD_DICT_MAPPING :=$= $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-mapping.textproto
|
||||
_proguard_dict_mapping_files := $(foreach m,$(_proguard_dict_zip_modules),$(ALL_MODULES.$(m).PROGUARD_DICTIONARY_MAPPING))
|
||||
$(PROGUARD_DICT_MAPPING): PRIVATE_MAPPING_FILES := $(_proguard_dict_mapping_files)
|
||||
$(PROGUARD_DICT_MAPPING): $(SYMBOLS_MAP) $(_proguard_dict_mapping_files)
|
||||
@echo "Packaging Proguard obfuscation dictionary mapping files."
|
||||
# Merge all the mapping files together
|
||||
echo -n > $@.tmparglist
|
||||
$(foreach mf,$(PRIVATE_MAPPING_FILES),echo "$(mf)" >> $@.tmparglist$(newline))
|
||||
$(SYMBOLS_MAP) -merge $(PROGUARD_DICT_MAPPING) @$@.tmparglist
|
||||
rm -f $@.tmparglist
|
||||
|
||||
$(call declare-1p-container,$(PROGUARD_DICT_ZIP),)
|
||||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
@@ -6996,31 +7001,19 @@ endif
|
||||
#------------------------------------------------------------------
|
||||
# A zip of Proguard usage files.
|
||||
#
|
||||
PROGUARD_USAGE_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-usage.zip
|
||||
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
|
||||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
$(PROGUARD_USAGE_ZIP): \
|
||||
$(INSTALLED_SYSTEMIMAGE_TARGET) \
|
||||
$(INSTALLED_RAMDISK_TARGET) \
|
||||
$(INSTALLED_BOOTIMAGE_TARGET) \
|
||||
$(INSTALLED_INIT_BOOT_IMAGE_TARGET) \
|
||||
$(INSTALLED_USERDATAIMAGE_TARGET) \
|
||||
$(INSTALLED_VENDORIMAGE_TARGET) \
|
||||
$(INSTALLED_PRODUCTIMAGE_TARGET) \
|
||||
$(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
|
||||
$(INSTALLED_ODMIMAGE_TARGET) \
|
||||
$(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
|
||||
$(INSTALLED_ODM_DLKMIMAGE_TARGET) \
|
||||
$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET) \
|
||||
$(updater_dep)
|
||||
endif
|
||||
$(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)
|
||||
PROGUARD_USAGE_ZIP :=$= $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-usage.zip
|
||||
_proguard_usage_zips := $(foreach m,$(_proguard_dict_zip_modules),$(ALL_MODULES.$(m).PROGUARD_USAGE_ZIP))
|
||||
$(PROGUARD_USAGE_ZIP): PRIVATE_ZIPS := $(_proguard_usage_zips)
|
||||
$(PROGUARD_USAGE_ZIP): $(MERGE_ZIPS) $(_proguard_usage_zips)
|
||||
@echo "Packaging Proguard usage files."
|
||||
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)
|
||||
echo -n > $@.tmparglist
|
||||
$(foreach z,$(PRIVATE_ZIPS),echo "$(z)" >> $@.tmparglist$(newline))
|
||||
$(MERGE_ZIPS) $@ @$@.tmparglist
|
||||
rm -rf $@.tmparglist
|
||||
|
||||
_proguard_dict_mapping_files :=
|
||||
_proguard_usage_zips :=
|
||||
_proguard_dict_zip_modules :=
|
||||
|
||||
$(call declare-1p-container,$(PROGUARD_USAGE_ZIP),)
|
||||
ifeq (,$(TARGET_BUILD_UNBUNDLED))
|
||||
|
@@ -3428,16 +3428,6 @@ $(2): $(1)
|
||||
.KATI_RESTAT: $(2)
|
||||
endef
|
||||
|
||||
# Returns the directory to copy proguard dictionaries into
|
||||
define local-proguard-dictionary-directory
|
||||
$(call intermediates-dir-for,PACKAGING,proguard_dictionary)/out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
|
||||
endef
|
||||
|
||||
# Returns the directory to copy proguard dictionary mappings into
|
||||
define local-proguard-dictionary-mapping-directory
|
||||
$(call intermediates-dir-for,PACKAGING,proguard_dictionary_mapping)/out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates
|
||||
endef
|
||||
|
||||
|
||||
###########################################################
|
||||
## Commands to call R8
|
||||
|
34
core/main.mk
34
core/main.mk
@@ -1232,9 +1232,7 @@ define auto-included-modules
|
||||
|
||||
endef
|
||||
|
||||
# Lists most of the files a particular product installs, including:
|
||||
# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
|
||||
# - PRODUCT_COPY_FILES
|
||||
# Lists the modules particular product installs.
|
||||
# The base list of modules to build for this product is specified
|
||||
# by the appropriate product definition file, which was included
|
||||
# by product_config.mk.
|
||||
@@ -1246,8 +1244,7 @@ endef
|
||||
# Name resolution for LOCAL_REQUIRED_MODULES:
|
||||
# See the select-bitness-of-required-modules definition.
|
||||
# $(1): product makefile
|
||||
|
||||
define product-installed-files
|
||||
define product-installed-modules
|
||||
$(eval _pif_modules := \
|
||||
$(call get-product-var,$(1),PRODUCT_PACKAGES) \
|
||||
$(if $(filter eng,$(tags_to_install)),$(call get-product-var,$(1),PRODUCT_PACKAGES_ENG)) \
|
||||
@@ -1264,7 +1261,14 @@ define product-installed-files
|
||||
$(eval ### Resolve the :32 :64 module name) \
|
||||
$(eval _pif_modules := $(sort $(call resolve-bitness-for-modules,TARGET,$(_pif_modules)))) \
|
||||
$(call expand-required-modules,_pif_modules,$(_pif_modules),$(_pif_overrides)) \
|
||||
$(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(_pif_modules))) \
|
||||
$(_pif_modules)
|
||||
endef
|
||||
|
||||
# Lists most of the files a particular product installs.
|
||||
# It gives all the installed files for all modules returned by product-installed-modules,
|
||||
# and also includes PRODUCT_COPY_FILES.
|
||||
define product-installed-files
|
||||
$(filter-out $(HOST_OUT_ROOT)/%,$(call module-installed-files, $(call product-installed-modules,$(1)))) \
|
||||
$(call resolve-product-relative-paths,\
|
||||
$(foreach cf,$(call get-product-var,$(1),PRODUCT_COPY_FILES),$(call word-colon,2,$(cf))))
|
||||
endef
|
||||
@@ -1437,6 +1441,16 @@ ifdef is_sdk_build
|
||||
$(warning $(ALL_MODULES.$(m).MAKEFILE): Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!)))
|
||||
endif
|
||||
|
||||
ifneq ($(TARGET_BUILD_APPS),)
|
||||
# If this build is just for apps, only build apps and not the full system by default.
|
||||
ifneq ($(filter all,$(TARGET_BUILD_APPS)),)
|
||||
# If they used the magic goal "all" then build all apps in the source tree.
|
||||
unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m)))
|
||||
else
|
||||
unbundled_build_modules := $(sort $(TARGET_BUILD_APPS))
|
||||
endif
|
||||
endif
|
||||
|
||||
# build/make/core/Makefile contains extra stuff that we don't want to pollute this
|
||||
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
|
||||
# contains everything that's built during the current make, but it also further
|
||||
@@ -1712,14 +1726,6 @@ ifeq ($(HOST_OS),darwin)
|
||||
else ifneq ($(TARGET_BUILD_APPS),)
|
||||
# If this build is just for apps, only build apps and not the full system by default.
|
||||
|
||||
unbundled_build_modules :=
|
||||
ifneq ($(filter all,$(TARGET_BUILD_APPS)),)
|
||||
# If they used the magic goal "all" then build all apps in the source tree.
|
||||
unbundled_build_modules := $(foreach m,$(sort $(ALL_MODULES)),$(if $(filter APPS,$(ALL_MODULES.$(m).CLASS)),$(m)))
|
||||
else
|
||||
unbundled_build_modules := $(sort $(TARGET_BUILD_APPS))
|
||||
endif
|
||||
|
||||
# Dist the installed files if they exist, except the installed symlinks. dist-for-goals emits
|
||||
# `cp src dest` commands, which will fail to copy dangling symlinks.
|
||||
apps_only_installed_files := $(foreach m,$(unbundled_build_modules),\
|
||||
|
@@ -102,31 +102,24 @@ ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_DICT
|
||||
my_proguard_dictionary_directory := $(local-proguard-dictionary-directory)
|
||||
my_proguard_dictionary_mapping_directory := $(local-proguard-dictionary-mapping-directory)
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(intermediates.COMMON)/proguard_dictionary))
|
||||
$(eval $(call copy-r8-dictionary-file-with-mapping,\
|
||||
$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(my_proguard_dictionary_directory)/proguard_dictionary,\
|
||||
$(my_proguard_dictionary_mapping_directory)/proguard_dictionary.textproto))
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),\
|
||||
$(my_proguard_dictionary_directory)/classes.jar))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(intermediates.COMMON)/proguard_dictionary)
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(my_proguard_dictionary_directory)/proguard_dictionary)
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(my_proguard_dictionary_mapping_directory)/proguard_dictionary.textproto)
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(my_proguard_dictionary_directory)/classes.jar)
|
||||
$(intermediates.COMMON)/proguard_dictionary,\
|
||||
$(intermediates.COMMON)/proguard_dictionary.textproto))
|
||||
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_FILES := \
|
||||
$(intermediates.COMMON)/proguard_dictionary \
|
||||
$(LOCAL_SOONG_CLASSES_JAR)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_SOONG_ZIP_ARGUMENTS := \
|
||||
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/proguard_dictionary \
|
||||
-f $(intermediates.COMMON)/proguard_dictionary \
|
||||
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/classes.jar \
|
||||
-f $(LOCAL_SOONG_CLASSES_JAR)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_MAPPING := $(intermediates.COMMON)/proguard_dictionary.textproto
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_USAGE_ZIP),\
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip))
|
||||
$(call add-dependency,$(LOCAL_BUILT_MODULE),\
|
||||
$(call local-packaging-dir,proguard_usage)/proguard_usage.zip)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_USAGE_ZIP := $(LOCAL_SOONG_PROGUARD_USAGE_ZIP)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE
|
||||
|
@@ -62,31 +62,24 @@ ifdef LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_DICT
|
||||
my_proguard_dictionary_directory := $(local-proguard-dictionary-directory)
|
||||
my_proguard_dictionary_mapping_directory := $(local-proguard-dictionary-mapping-directory)
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(intermediates.COMMON)/proguard_dictionary))
|
||||
$(eval $(call copy-r8-dictionary-file-with-mapping,\
|
||||
$(LOCAL_SOONG_PROGUARD_DICT),\
|
||||
$(my_proguard_dictionary_directory)/proguard_dictionary,\
|
||||
$(my_proguard_dictionary_mapping_directory)/proguard_dictionary.textproto))
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_CLASSES_JAR),\
|
||||
$(my_proguard_dictionary_directory)/classes.jar))
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(intermediates.COMMON)/proguard_dictionary)
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(my_proguard_dictionary_directory)/proguard_dictionary)
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(my_proguard_dictionary_mapping_directory)/proguard_dictionary.textproto)
|
||||
$(call add-dependency,$(common_javalib.jar),\
|
||||
$(my_proguard_dictionary_directory)/classes.jar)
|
||||
$(intermediates.COMMON)/proguard_dictionary,\
|
||||
$(intermediates.COMMON)/proguard_dictionary.textproto))
|
||||
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_FILES := \
|
||||
$(intermediates.COMMON)/proguard_dictionary \
|
||||
$(LOCAL_SOONG_CLASSES_JAR)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_SOONG_ZIP_ARGUMENTS := \
|
||||
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/proguard_dictionary \
|
||||
-f $(intermediates.COMMON)/proguard_dictionary \
|
||||
-e out/target/common/obj/$(LOCAL_MODULE_CLASS)/$(LOCAL_MODULE)_intermediates/classes.jar \
|
||||
-f $(LOCAL_SOONG_CLASSES_JAR)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_DICTIONARY_MAPPING := $(intermediates.COMMON)/proguard_dictionary.textproto
|
||||
endif
|
||||
|
||||
ifdef LOCAL_SOONG_PROGUARD_USAGE_ZIP
|
||||
$(eval $(call copy-one-file,$(LOCAL_SOONG_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)
|
||||
ALL_MODULES.$(my_register_name).PROGUARD_USAGE_ZIP := $(LOCAL_SOONG_PROGUARD_USAGE_ZIP)
|
||||
endif
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user