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

Commit 9291155a authored by Jihoon Kang's avatar Jihoon Kang
Browse files

Remove redundant entries from symbols.zip

Currently, symbols.zip contains multiple duplicates of the symbols file,
which are derived from uninstalled soong modules that produce androidmk
entries and share the identical symbols file with the installed modules.
These are likely unintended behavior, given that the current build rule
of the symbols.zip creates dependency on all generated images instead of
all modules that generate the symbols file.

This change modifies the build rule of the symbols.zip file so that
only the symbols files of the installed modules or the dependencies of
the test suites are included in the zip file.

Test: m droid dist && inspect the entries included in the symbols.zip file
Bug: 395989947
Change-Id: Icd55ed1bd76b688829f302daebbd1cc32356fe30
parent 1509ee5a
Loading
Loading
Loading
Loading
+22 −14
Original line number Diff line number Diff line
@@ -7206,29 +7206,37 @@ SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name)-symbols.zip
# The path to a file containing mappings from elf IDs to filenames.
SYMBOLS_MAPPING := $(PRODUCT_OUT)/$(name)-symbols-mapping.textproto
.KATI_READONLY := SYMBOLS_ZIP SYMBOLS_MAPPING
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.

ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(SYMBOLS_ZIP): $(INTERNAL_ALLIMAGES_FILES) $(updater_dep)
  _symbols_zip_modules := $(call product-installed-modules,$(INTERNAL_PRODUCT))
  $(SYMBOLS_ZIP): $(updater_dep)
else
  _symbols_zip_modules := $(unbundled_build_modules)
endif
$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
$(SYMBOLS_ZIP): PRIVATE_MAPPING_PACKAGING_DIR := $(call intermediates-dir-for,PACKAGING,elf_symbol_mapping)
$(SYMBOLS_ZIP): $(SOONG_ZIP) $(SYMBOLS_MAP)

_symbols_zip_modules_symbols_files := $(foreach m,$(_symbols_zip_modules),$(ALL_MODULES.$(m).SYMBOLIC_OUTPUT_PATH))
_symbols_zip_modules_mapping_files := $(foreach m,$(_symbols_zip_modules),$(ALL_MODULES.$(m).ELF_SYMBOL_MAPPING_PATH))

$(SYMBOLS_ZIP): PRIVATE_SYMBOLS_MODULES_FILES := $(_symbols_zip_modules_symbols_files)
$(SYMBOLS_ZIP): PRIVATE_SYMBOLS_MODULES_MAPPING_FILES := $(_symbols_zip_modules_mapping_files)
$(SYMBOLS_ZIP): $(SOONG_ZIP) $(SYMBOLS_MAP) $(_symbols_zip_modules_symbols_files) $(_symbols_zip_modules_mapping_files)
	@echo "Package symbols: $@"
	$(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
	$(hide) mkdir -p $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE)) $(PRIVATE_MAPPING_PACKAGING_DIR)
	# Find all of the files in the symbols directory and zip them into the symbols zip.
	$(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE)
	$(hide) $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
	# Find all of the files in the symbols mapping directory and merge them into the symbols mapping textproto.
	$(hide) find -L $(PRIVATE_MAPPING_PACKAGING_DIR) -type f | sort >$(PRIVATE_LIST_FILE)
	$(hide) $(SYMBOLS_MAP) -merge $(SYMBOLS_MAPPING) -ignore_missing_files @$(PRIVATE_LIST_FILE)
	$(hide) rm -rf $@ $@.symbols_list $@.mapping_list
	# Find all installed files in the symbols directory and zip them into the symbols zip.
	echo "$(PRIVATE_SYMBOLS_MODULES_FILES)" | tr " " "\n" | sort > $@.symbols_list
	$(hide) $(SOONG_ZIP) -d -o $@ -l $@.symbols_list
	# Find all installed files in the symbols mapping directory and merge them into the symbols mapping textproto.
	echo "$(PRIVATE_SYMBOLS_MODULES_MAPPING_FILES)" | tr " " "\n" | sort > $@.mapping_list
	$(hide) $(SYMBOLS_MAP) -merge $(SYMBOLS_MAPPING) @$@.mapping_list
$(SYMBOLS_ZIP): .KATI_IMPLICIT_OUTPUTS := $(SYMBOLS_MAPPING)

$(call declare-1p-container,$(SYMBOLS_ZIP),)
ifeq (,$(TARGET_BUILD_UNBUNDLED))
$(call declare-container-license-deps,$(SYMBOLS_ZIP),$(INTERNAL_ALLIMAGES_FILES) $(updater_dep),$(PRODUCT_OUT)/:/)
$(call declare-container-license-deps,$(SYMBOLS_ZIP),$(PRIVATE_SYMBOLS_MODULES_FILES) $(updater_dep),$(PRODUCT_OUT)/:/)
endif

_symbols_zip_modules_symbols_files :=
_symbols_zip_modules_mapping_files :=
# -----------------------------------------------------------------
# A zip of the coverage directory.
#