Do not run veridex on unbundled app builds

Unbundled app builds do not build the framework, only apps against
the prebuilt public API. Running veridex from the local tree does,
however, depend on the framework to generate the list of non-SDK
APIs. Disable veridex on such builds and remove appcompat.zip from
artifacts.

Test: make ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Change-Id: I16289adc7fc660109d61260e8a49e992228e727c
diff --git a/core/package_internal.mk b/core/package_internal.mk
index be87bb2..312635f 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -592,7 +592,16 @@
 endif
 endif
 
+# Run veridex on product modules.
+# We skip it for unbundled app builds where we cannot build veridex.
+module_run_appcompat :=
 ifdef LOCAL_PRODUCT_MODULE
+ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))  # ! unbundled app build
+  module_run_appcompat := true
+endif
+endif
+
+ifeq ($(module_run_appcompat),true)
 $(LOCAL_BUILT_MODULE) : $(call intermediates-dir-for,PACKAGING,veridex,HOST)/veridex.zip
 endif
 
@@ -637,9 +646,9 @@
 	$(uncompress-dexs)
 endif
 # Run appcompat before stripping the classes.dex file.
-ifdef LOCAL_PRODUCT_MODULE
+ifeq ($(module_run_appcompat),true)
 	$(run-appcompat)
-endif  # LOCAL_PRODUCT_MODULE
+endif  # module_run_appcompat
 ifdef LOCAL_DEX_PREOPT
 ifneq ($(BUILD_PLATFORM_ZIP),)
 	@# Keep a copy of apk with classes.dex unstripped