tweaks to kythe indexing for Android Studio

-tool to generate vnames with googleplex-android corpus name
-uses root to map to the project name from manifest
-update vnames.json with that tool
-use tools/base/bazel/build_targets for targets to process
-add option to kythe build script to save entries to gcs
  this location will be used by code search to pick up data

Change-Id: I1627b221b7c4b146d1278d067abda8db329fec20
diff --git a/linux-x86_64/kythe/studio/build_studio_kythe.sh b/linux-x86_64/kythe/studio/build_studio_kythe.sh
index a328cf4..c9c5ff7 100755
--- a/linux-x86_64/kythe/studio/build_studio_kythe.sh
+++ b/linux-x86_64/kythe/studio/build_studio_kythe.sh
@@ -10,7 +10,7 @@
 # Get the output path for the kythe artifacts.
 OUT="$1"
 if [ -z "${OUT}" ]; then
-  echo Usage: $0 \<out_dir\>
+  echo Usage: $0 \<out_dir\> [gcs_bucket]
   echo  e.g. $0 $HOME/studio_kythe
   echo
   echo $0 must be launched from the root of the studio branch.
@@ -19,15 +19,7 @@
 OUT_ENTRIES="${OUT}/entries"
 mkdir -p "${OUT_ENTRIES}"
 
-#TODO: read from file
-TARGETS="//prebuilts/studio/... \
-  //prebuilts/tools/common/... \
-  //tools/adt/idea/... \
-  //tools/analytics-library/... \
-  //tools/base/... \
-  //tools/data-binding/... \
-  //tools/idea/... \
-  //tools/sherpa/..."
+TARGETS="$(cat tools/base/bazel/build_targets)"
 
 # Build all targets and run the kythe extractor via extra_actions.
 bazel build \
@@ -47,3 +39,9 @@
       "${KINDEX}" > "${ENTRIES}"
   fi
 done;
+
+GSBUCKET="$2"
+if [ -n "${GSBUCKET}" ]; then
+  TIMESTAMP=$(date +'%s')
+  gsutil -m cp "${OUT_ENTRIES}/*" "${GSBUCKET}/${TIMESTAMP}/"
+fi
\ No newline at end of file