1#!/bin/bash -eu
2# Verifies Bazel "staging mode"  succeeds when building "droid".
3# This verification script is designed to be used for continuous integration
4# tests, though may also be used for manual developer verification.
5
6if [[ -z ${DIST_DIR+x} ]]; then
7  echo "DIST_DIR not set. Using out/dist. This should only be used for manual developer testing."
8  DIST_DIR="out/dist"
9fi
10if [[ -z ${TARGET_PRODUCT+x} ]]; then
11  echo "TARGET_PRODUCT not set. Have you run lunch?"
12  exit 1
13fi
14
15# Run a mixed build of "droid"
16build/soong/soong_ui.bash --make-mode \
17  --mk-metrics \
18  --bazel-mode-staging \
19  BP2BUILD_VERBOSE=1 \
20  BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
21  BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
22  droid platform_tests \
23  dist DIST_DIR=$DIST_DIR
24
25# Verify there are artifacts under the out directory that originated from bazel.
26echo "Verifying OUT_DIR contains bazel-out..."
27if find out/ -type d -name bazel-out &>/dev/null; then
28  echo "bazel-out found."
29else
30  echo "bazel-out not found. This may indicate that mixed builds are silently not running."
31  exit 1
32fi
33