Ignore vndk-* subdirectories in the library absence check.
They only contain prebuilts from older releases.
Test: m systemimage on affected internal lunch targets
Bug: 124293228
Change-Id: I059c9d0edb78e52838a25cef0472807847d77417
diff --git a/core/Makefile b/core/Makefile
index 7205a8c..16262bb 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -2198,7 +2198,7 @@
# libprofile.so
# libsigchain.so - cf_x86_phone-userdebug builds get this in system/lib/arm
# libtombstoned_client.so
-APEX_MODULE_LIBS= \
+APEX_MODULE_LIBS := \
libadbconnection.so \
libandroidicu.so \
libdt_fd_forward.so \
@@ -2224,7 +2224,10 @@
# on the native architecture.
# TODO(b/130630776): Introduce a make variable for the appropriate directory
# when native bridge is active.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE=lib/arm lib/arm64
+APEX_LIBS_ABSENCE_CHECK_EXCLUDE := lib/arm lib/arm64
+
+# Exclude vndk-sp-* subdirectories which contain prebuilts from older releases.
+APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/vndk-% lib64/vndk-%
# If the check below fails, some library has ended up in system/lib or
# system/lib64 that is intended to only go into some APEX package. The likely
@@ -2252,7 +2255,7 @@
$(hide) ( \
cd $(TARGET_OUT) && \
findres=$$(find lib* \
- $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path $(dir) -prune -o) \
+ $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path "$(subst %,*,$(dir))" -prune -o) \
-type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
-print) && \
if [ -n "$$findres" ]; then \