[ART tools] Fix construction of a make target string to build public.libraries.txt

As a result of target testing on Pixel 2 it is found that a make target
string to build public.libraries.txt can be incorrect.
For example, when a target is aosp_walleye-userdebug
TARGET_PRODUCT is set to aosp_walleye but ANDROID_PRODUCT_OUT
is set to <absolute path>/out/target/product/walleye. So buildbot-build.sh
creates the make target ‘out/target/product/aosp_walleye/
system/etc/public.libraries.txt’ which is not correct. This results a
ninja failure: unknow target.

The current CL uses ANDROID_PRODUCT_OUT and ANDROID_BUILD_TOP to construct
a make target string.

Test: lunch hikey960-userdebug && art/tools/buildbot-build.sh --target
Test: lunch aosp_walleye-userdebug && art/tools/buildbot-build.sh --target
Test: lunch aosp_taimen-userdebug && art/tools/buildbot-build.sh --target
Test: lunch aosp_x86-eng && art/tools/buildbot-build.sh --target
Test: lunch aosp_arm64-eng && art/tools/buildbot-build.sh --target
Test: lunch aosp_arm-eng && art/tools/buildbot-build.sh --target
Change-Id: I9c3abcd44310598b56800773893420e1c433553f
diff --git a/tools/buildbot-build.sh b/tools/buildbot-build.sh
index 8305051..b5d39e1 100755
--- a/tools/buildbot-build.sh
+++ b/tools/buildbot-build.sh
@@ -68,15 +68,15 @@
   make_command+=" dx-tests"
   mode_suffix="-host"
 elif [[ $mode == "target" ]]; then
-  if [[ -z "$TARGET_PRODUCT" ]]; then
-    echo 'TARGET_PRODUCT environment variable is empty; did you forget to run `lunch`?'
+  if [[ -z "${ANDROID_PRODUCT_OUT}" ]]; then
+    echo 'ANDROID_PRODUCT_OUT environment variable is empty; did you forget to run `lunch`?'
     exit 1
   fi
   make_command="make $j_arg $extra_args $showcommands build-art-target-tests $common_targets"
   make_command+=" libjavacrypto-target libnetd_client-target linker toybox toolbox sh"
   make_command+=" debuggerd su"
   make_command+=" ${out_dir}/host/linux-x86/bin/adb libstdc++ "
-  make_command+=" ${out_dir}/target/product/${TARGET_PRODUCT}/system/etc/public.libraries.txt"
+  make_command+=" ${ANDROID_PRODUCT_OUT#"${ANDROID_BUILD_TOP}/"}/system/etc/public.libraries.txt"
   if [[ -n "$ART_TEST_CHROOT" ]]; then
     # These targets are needed for the chroot environment.
     make_command+=" crash_dump event-log-tags"