Run appcompat on all /product modules.

The output of the appcompat tool is store on $(PRODUCT_OUT)/appcompat.

Bug: 110073830
Bug: 78924201
Test: m
Change-Id: Ia77cc53fc241a048958cf243ba298298f800f933
diff --git a/core/definitions.mk b/core/definitions.mk
index 1bdbf10..7108e09 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2557,6 +2557,17 @@
   mv $@.compressed $@;
 endef
 
+ifeq ($(HOST_OS),linux)
+# Runs appcompat and store logs in $(PRODUCT_OUT)/appcompat
+define run-appcompat
+$(hide) \
+  mkdir -p $(PRODUCT_OUT)/appcompat; \
+  art/tools/veridex/appcompat.sh --dex-file=$@ 2>&1 > $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log;
+endef
+else
+run-appcompat =
+endif
+
 # Remove dynamic timestamps from packages
 #
 define remove-timestamps-from-package