Compare existing ABI dump list with LSDUMP_PATHS

This commit fixes the check for redundant files in prebuilts/abi-dumps.
Some ABI dump file names are different from the module names. The list
of existing files should be compared with LSDUMP_PATHS which are the
files generated by soong.

This commit also adds the check for the files in
prebuilts/abi-dumps/platform.

Bug: 147409497
Test: make
Change-Id: If304afb116e9b5d3cb7ceaf74822d5a19ebe1a35
This commit is contained in:
Hsin-Yi Chen 2020-01-10 19:19:34 +08:00
parent 4506b17dd3
commit 62de555119
1 changed files with 25 additions and 8 deletions

View File

@ -93,8 +93,8 @@ endif
@chmod a+x $@ @chmod a+x $@
##################################################################### #####################################################################
# Check that all ABI reference dumps have corresponding NDK/VNDK # Check that all ABI reference dumps have corresponding
# libraries. # NDK/VNDK/PLATFORM libraries.
# $(1): The directory containing ABI dumps. # $(1): The directory containing ABI dumps.
# Return a list of ABI dump paths ending with .so.lsdump. # Return a list of ABI dump paths ending with .so.lsdump.
@ -104,25 +104,42 @@ $(if $(wildcard $(1)), \
$(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.))) $(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.)))
endef endef
# $(1): A list of tags.
# $(2): A list of tag:path.
# Return the file names of the ABI dumps that match the tags.
define filter-abi-dump-paths
$(eval tag_patterns := $(foreach tag,$(1),$(tag):%))
$(notdir $(patsubst $(tag_patterns),%,$(filter $(tag_patterns),$(2))))
endef
VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION) VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION) NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION)
PLATFORM_ABI_DUMP_DIR := prebuilts/abi-dumps/platform/$(PLATFORM_VNDK_VERSION)
VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR)) VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR))
NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR)) NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR))
PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR))
$(check-vndk-abi-dump-list-timestamp): $(VNDK_ABI_DUMPS) $(NDK_ABI_DUMPS) $(check-vndk-abi-dump-list-timestamp): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS)
$(check-vndk-abi-dump-list-timestamp):
$(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \ $(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \
$(addsuffix .so.lsdump,$(filter-out $(NDK_MIGRATED_LIBS) $(VNDK_PRIVATE_LIBRARIES),$(LLNDK_LIBRARIES) $(VNDK_SAMEPROCESS_LIBRARIES) $(VNDK_CORE_LIBRARIES))), \ $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(VNDK_ABI_DUMPS)))))) $(notdir $(VNDK_ABI_DUMPS))))))
$(if $(added_vndk_abi_dumps), \ $(if $(added_vndk_abi_dumps), \
echo -e "Found ABI reference dumps for non-VNDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dumps.") echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.")
$(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \ $(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \
$(addsuffix .so.lsdump,$(NDK_MIGRATED_LIBS)), \ $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(NDK_ABI_DUMPS)))))) $(notdir $(NDK_ABI_DUMPS))))))
$(if $(added_ndk_abi_dumps), \ $(if $(added_ndk_abi_dumps), \
echo -e "Found ABI reference dumps for non-NDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dumps.") echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.")
$(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps),exit 1) $(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \
$(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)), \
$(notdir $(PLATFORM_ABI_DUMPS))))))
$(if $(added_platform_abi_dumps), \
echo -e "Found unexpected ABI reference dump files under $(PLATFORM_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(PLATFORM_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_platform_abi_dumps)) ')' -delete\` to delete the dump files.")
$(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps)$(added_platform_abi_dumps),exit 1)
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) touch $@ $(hide) touch $@