Use the right directory for the csv file.
And return an error if absent.
Test: appcompat.sh
Change-Id: I212df0f9eac323fa6b5e2cf272684a31bf14cdea
diff --git a/tools/veridex/appcompat.sh b/tools/veridex/appcompat.sh
index 46d62db..99537a4 100755
--- a/tools/veridex/appcompat.sh
+++ b/tools/veridex/appcompat.sh
@@ -57,8 +57,20 @@
ANDROID_HOST_OUT=${OUT}/host/linux-x86
fi
+extra_flags=
+
+# If --api-flags is not passed directly, take it from the build.
+if [[ "$@" != "*--api-flags=*" ]]; then
+ file="${OUT}/soong/hiddenapi/hiddenapi-flags.csv"
+ if [ ! -f $file ]; then
+ echo "Missing API flags file $file"
+ exit 1
+ fi
+ extra_flags="--api-flags=$file"
+fi
+
${ANDROID_HOST_OUT}/bin/veridex \
--core-stubs=${PACKAGING}/core_dex_intermediates/classes.dex:${PACKAGING}/oahl_dex_intermediates/classes.dex \
- --api-flags=${PACKAGING}/hiddenapi-flags.csv \
+ $extra_flags \
$@