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

Commit 1509ee5a authored by Jihoon Kang's avatar Jihoon Kang
Browse files

Create symbols.zip per test suite

This change defines the build rule to generate symbols.zip and the
mapping.textproto file per test suite. These files are disted for the
test suite name goal.

The followup change will remove the symbols files of the test suites
dependencies modules from the <product name>-symbols-*.zip file.

Test: m device-test dist --no-soong-only && aninja -t query device-test
Bug: 402471392
Change-Id: Idecd2f0049eeddca030883947efb375f9aff1051
parent c54aa6db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -7182,6 +7182,12 @@ dexpreopt_config_zip: $(DEXPREOPT_CONFIG_ZIP)

$(call declare-1p-target,$(DEXPREOPT_CONFIG_ZIP),)

# -----------------------------------------------------------------
# Zips of the symbols directory per test suites
#

$(foreach suite,$(ALL_COMPATIBILITY_SUITES),$(eval $(call create-suite-symbols-map,$(suite))))

# -----------------------------------------------------------------
# A zip of the symbols directory.  Keep the full paths to make it
# more obvious where these files came from.
+26 −0
Original line number Diff line number Diff line
@@ -3689,6 +3689,32 @@ $(eval $(my_all_targets) : \
    $(sort $(foreach suite,$(LOCAL_COMPATIBILITY_SUITE),$(my_compat_dist_config_$(suite))))))
endef

# Define symbols.zip and symbols-mapping.textproto build rule per test suite
#
# $(1): Name of the test suite to create the zip and mapping build rules
define create-suite-symbols-map
_suite_symbols_zip := $$(PRODUCT_OUT)/$(1)-symbols.zip
_suite_symbols_mapping := $$(PRODUCT_OUT)/$(1)-symbols-mapping.textproto
_suite_modules_symbols_files := $$(foreach m,$$(COMPATIBILITY.$(1).MODULES),$$(ALL_MODULES.$$(m).SYMBOLIC_OUTPUT_PATH))
_suite_modules_mapping_files := $$(foreach m,$$(COMPATIBILITY.$(1).MODULES),$$(ALL_MODULES.$$(m).ELF_SYMBOL_MAPPING_PATH))

$$(_suite_symbols_zip): PRIVATE_SUITE_SYMBOLS_MAPPING := $$(_suite_symbols_mapping)
$$(_suite_symbols_zip): PRIVATE_SUITE_MODULES_SYMBOLS_FILES := $$(_suite_modules_symbols_files)
$$(_suite_symbols_zip): PRIVATE_SUITE_MODULES_MAPPING_FILES := $$(_suite_modules_mapping_files)
$$(_suite_symbols_zip): $$(SOONG_ZIP) $$(SYMBOLS_MAP) $$(_suite_modules_symbols_files) $$(_suite_modules_mapping_files)
	@echo "Package $(1) symbols: $$@"
	$(hide) rm -rf $$@ $$@.symbols_list $$@.mapping_list
	echo "$$(PRIVATE_SUITE_MODULES_SYMBOLS_FILES)" | tr " " "\n" | sort > $$@.symbols_list
	$(hide) $$(SOONG_ZIP) -d -o $$@ -l $$@.symbols_list
	echo "$$(PRIVATE_SUITE_MODULES_MAPPING_FILES)" | tr " " "\n" | sort > $$@.mapping_list
	$(hide) $$(SYMBOLS_MAP) -merge $$(PRIVATE_SUITE_SYMBOLS_MAPPING) @$$@.mapping_list
$$(_suite_symbols_zip): .KATI_IMPLICIT_OUTPUTS := $$(_suite_symbols_mapping)

.PHONY: $(1)
$(1): $$(_suite_symbols_zip) $$(_suite_symbols_mapping)
$$(call dist-for-goals-with-filenametag,$(1), $$(_suite_symbols_zip) $$(_suite_symbols_mapping))
endef

###########################################################
## Path Cleaning
###########################################################
+4 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ endif
symbolic_input := $(inject_module)
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
elf_mapping_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/%,$(call intermediates-dir-for,PACKAGING,elf_symbol_mapping)/%,$(symbolic_output).textproto)

ALL_MODULES.$(my_register_name).SYMBOLIC_OUTPUT_PATH := $(symbolic_output)
ALL_MODULES.$(my_register_name).ELF_SYMBOL_MAPPING_PATH := $(elf_mapping_path)

$(eval $(call copy-unstripped-elf-file-with-mapping,$(symbolic_input),$(symbolic_output),$(elf_mapping_path)))

###########################################################
+2 −0
Original line number Diff line number Diff line
@@ -153,6 +153,8 @@ $(foreach f, $(my_jni_lib_symbols_copy_files), \

symbolic_outputs := $(foreach f,$(my_jni_lib_symbols_copy_files),$(call word-colon,2,$(f)))
symbolic_mappings := $(foreach f,$(symbolic_outputs),$(patsubst $(TARGET_OUT_UNSTRIPPED)/%,$(call intermediates-dir-for,PACKAGING,elf_symbol_mapping)/%,$(f).textproto))
ALL_MODULES.$(my_register_name).SYMBOLIC_OUTPUT_PATH := $(symbolic_outputs)
ALL_MODULES.$(my_register_name).ELF_SYMBOL_MAPPING_PATH := $(symbolic_mappings)

$(LOCAL_BUILT_MODULE): | $(symbolic_outputs)

+3 −0
Original line number Diff line number Diff line
@@ -192,6 +192,9 @@ ifndef LOCAL_IS_HOST_MODULE
      symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
      elf_symbol_mapping_path := $(patsubst $(TARGET_OUT_UNSTRIPPED)/%,$(call intermediates-dir-for,PACKAGING,elf_symbol_mapping)/%,$(symbolic_output).textproto)

      ALL_MODULES.$(my_register_name).SYMBOLIC_OUTPUT_PATH := $(symbolic_output)
      ALL_MODULES.$(my_register_name).ELF_SYMBOL_MAPPING_PATH := $(elf_symbol_mapping_path)

      $(eval $(call copy-unstripped-elf-file-with-mapping,$(LOCAL_SOONG_UNSTRIPPED_BINARY),$(symbolic_output),$(elf_symbol_mapping_path)))
      $(LOCAL_BUILT_MODULE): | $(symbolic_output)