• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eux
2# Verifies mixed builds 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 ${MIXED_DROID_MODE+x} ]]; then
11  echo "MIXED_DROID_MODE not set. Using 'dev'."
12  MIXED_DROID_MODE="dev"
13fi
14if [[ -z ${TARGET_PRODUCT+x} ]]; then
15  echo "TARGET_PRODUCT not set. Have you run lunch?"
16  exit 1
17fi
18
19if [ "$MIXED_DROID_MODE" == "dev" ]; then
20  MIXED_BUILD_FLAG="--bazel-mode-dev"
21elif [ "$MIXED_DROID_MODE" == "prod" ]; then
22  MIXED_BUILD_FLAG="--bazel-mode"
23elif [ "$MIXED_DROID_MODE" == "staging" ]; then
24  MIXED_BUILD_FLAG="--bazel-mode-staging"
25else
26  echo "MIXED_DROID_MODE value \"$MIXED_DROID_MODE\" invalid. Must be either 'dev', 'prod', or 'staging'"
27  exit 1
28fi
29
30# Run a mixed build of "droid"
31# TODO(b/254572169): Remove DISABLE_ARTIFACT_PATH_REQUIREMENT before launching --bazel-mode.
32build/soong/soong_ui.bash --make-mode \
33  --mk-metrics \
34  DISABLE_ARTIFACT_PATH_REQUIREMENTS=true \
35  ${MIXED_BUILD_FLAG} \
36  BP2BUILD_VERBOSE=1 \
37  BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
38  BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
39  droid platform_tests \
40  dist DIST_DIR=$DIST_DIR
41
42# Verify there are artifacts under the out directory that originated from bazel.
43echo "Verifying OUT_DIR contains bazel-out..."
44if find out/ -type d -name bazel-out &>/dev/null; then
45  echo "bazel-out found."
46else
47  echo "bazel-out not found. This may indicate that mixed builds are silently not running."
48  exit 1
49fi
50