build test_mappings.zip

Bug: 186664401
Change-Id: I2483e2e29e3f9833eb37d5321f3f175f6daddae9
(cherry picked from commit 52d48576505346561841906a2a0142823cc20ad5)
diff --git a/build.sh b/build.sh
index e6430f1..873334b 100755
--- a/build.sh
+++ b/build.sh
@@ -972,6 +972,16 @@
 
 fi
 
+echo "========================================================"
+echo " Generating test_mappings.zip"
+TEST_MAPPING_FILES=${OUT_DIR}/test_mapping_files.txt
+find ${ROOT_DIR} -name TEST_MAPPING \
+  -not -path "${ROOT_DIR}/\.git*" \
+  -not -path "${ROOT_DIR}/\.repo*" \
+  -not -path "${ROOT_DIR}/out*" \
+  > ${TEST_MAPPING_FILES}
+soong_zip -o ${DIST_DIR}/test_mappings.zip -C ${ROOT_DIR} -l ${TEST_MAPPING_FILES}
+
 if [ -n "${EXTRA_CMDS}" ]; then
   echo "========================================================"
   echo " Running extra build command(s):"