Add product and mode vars to mixed_droid

This will allow us to easily leverage mixed_droid to test `m droid` with
alternative target products, or in prod mode. This is especially useful
as we add additional CI for products other than aosp_arm64.

Bug: 231322898
Test: MIXED_DROID_MODE=prod build/bazel/ci/mixed_droid.sh
Test: mixed_droid.sh  (no vars)
Test: MIXED_DROID_MODE=badflag build/bazel/ci/mixed_droid.sh
Test: mixed_libc.sh with and without lunch
Change-Id: I22d16567e0fbf6f04ba9dd85c59a58d48079419a
diff --git a/ci/mixed_droid.sh b/ci/mixed_droid.sh
index 8c34548..7bf53d8 100755
--- a/ci/mixed_droid.sh
+++ b/ci/mixed_droid.sh
@@ -7,16 +7,31 @@
   echo "DIST_DIR not set. Using out/dist. This should only be used for manual developer testing."
   DIST_DIR="out/dist"
 fi
+if [[ -z ${MIXED_DROID_MODE+x} ]]; then
+  echo "MIXED_DROID_MODE not set. Using 'dev'."
+  MIXED_DROID_MODE="dev"
+fi
+if [[ -z ${TARGET_PRODUCT+x} ]]; then
+  echo "TARGET_PRODUCT not set. Have you run lunch?"
+  exit 1
+fi
+
+if [ "$MIXED_DROID_MODE" == "dev" ]; then
+  MIXED_BUILD_FLAG="--bazel-mode-dev"
+elif [ "$MIXED_DROID_MODE" == "prod" ]; then
+  MIXED_BUILD_FLAG="--bazel-mode"
+else
+  echo "MIXED_DROID_MODE value \"$MIXED_DROID_MODE\" invalid. Must be either 'dev' or 'prod'"
+  exit 1
+fi
 
 # Run a mixed build of "droid"
 build/soong/soong_ui.bash --make-mode \
   --mk-metrics \
-  --bazel-mode-dev \
+  ${MIXED_BUILD_FLAG} \
   BP2BUILD_VERBOSE=1 \
   BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
   BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
-  TARGET_PRODUCT=aosp_arm64 \
-  TARGET_BUILD_VARIANT=userdebug \
   droid platform_tests \
   dist DIST_DIR=$DIST_DIR
 
diff --git a/ci/mixed_libc.sh b/ci/mixed_libc.sh
index 8616656..df136a6 100755
--- a/ci/mixed_libc.sh
+++ b/ci/mixed_libc.sh
@@ -7,6 +7,10 @@
   echo "DIST_DIR not set. Using out/dist. This should only be used for manual developer testing."
   DIST_DIR="out/dist"
 fi
+if [[ -z ${TARGET_PRODUCT+x} ]]; then
+  echo "TARGET_PRODUCT not set. Have you run lunch?"
+  exit 1
+fi
 
 TARGETS=(
   libbacktrace
@@ -25,8 +29,6 @@
   BP2BUILD_VERBOSE=1 \
   BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
   BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
-  TARGET_PRODUCT=aosp_arm64 \
-  TARGET_BUILD_VARIANT=userdebug \
   "${TARGETS[@]}" \
   dist DIST_DIR=$DIST_DIR