Use AndroidProducts.mk list from Soong's finder
This saves ~300ms from get_build_var on our internal tree (1.3s ->
1.0s). On AOSP, it only saves ~60ms (0.60s -> 0.54s).
It's also ran during lunch, and twice during every build (though the
second time it was run with Kati's find emulator, which significantly
reduces the overhead).
Bug: 78020936
Test: diff out/.module_paths/AndroidProducts.mk.list with existing find
results
Change-Id: I195b2840854122e41275e24e886ca8c8cda13dac
diff --git a/core/product.mk b/core/product.mk
index 1a15c9f..976c939 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -23,21 +23,12 @@
# and the .mk suffix) of the product makefile, "<product_name>:" can be
# omitted.
-# Search for AndroidProducts.mks in the given dir.
-# $(1): the path to the dir
-define _search-android-products-files-in-dir
-$(sort $(shell test -d $(1) && find -L $(1) \
- -maxdepth 6 \
- -name .git -prune \
- -o -name AndroidProducts.mk -print))
-endef
-
#
# Returns the list of all AndroidProducts.mk files.
# $(call ) isn't necessary.
#
define _find-android-products-files
-$(foreach d, device vendor product,$(call _search-android-products-files-in-dir,$(d))) \
+$(file <$(OUT_DIR)/.module_paths/AndroidProducts.mk.list) \
$(SRC_TARGET_DIR)/product/AndroidProducts.mk
endef