• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eux
2# Verifies mixed builds succeeds when building "libc".
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
15TARGETS=(
16  CaptivePortalLogin
17  com.android.neuralnetworks
18  framework-minus-apex
19  libsimpleperf
20
21
22  # TODO(b/266459895): uncomment these after re-enabling libunwindstack
23  # com.android.media
24  # com.android.media.swcodec
25  # com.android.runtime
26)
27
28# Run a mixed build of "libc"
29# TODO(b/254572169): Remove DISABLE_ARTIFACT_PATH_REQUIREMENT before launching --bazel-mode.
30build/soong/soong_ui.bash --make-mode \
31  --mk-metrics \
32  --bazel-mode-dev \
33  DISABLE_ARTIFACT_PATH_REQUIREMENTS=true \
34  BP2BUILD_VERBOSE=1 \
35  BAZEL_STARTUP_ARGS="--max_idle_secs=5" \
36  BAZEL_BUILD_ARGS="--color=no --curses=no --show_progress_rate_limit=5" \
37  "${TARGETS[@]}" \
38  dist DIST_DIR=$DIST_DIR
39
40echo "Verifying libc.so..."
41LIBC_OUTPUT_FILE="$(find out/ -regex '.*/bazel-out/[^/]*android_arm64.*-opt.*/bin/bionic/libc/libc.so' || echo '')"
42LIBC_STUB_OUTPUT_FILE="$(find out/ -regex '.*/bazel-out/[^/]*android_arm64.*-opt.*/bin/bionic/libc/liblibc_stub_libs-current_so.so' || echo '')"
43
44if [ -z "$LIBC_OUTPUT_FILE" -a -z "$LIBC_STUB_OUTPUT_FILE" ]; then
45  echo "Could not find libc.so or its stub lib at expected path."
46  exit 1
47fi
48
49if [ -L "$LIBC_OUTPUT_FILE" ]; then
50  # It's problematic to have libc.so be a symlink, as it means that installed
51  # libc.so in an Android system image will be a symlink to a location outside
52  # of that system image.
53  echo "$LIBC_OUTPUT_FILE is expected as a file not a symlink"
54  exit 1
55fi
56
57echo "libc.so verified."
58