• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eux
2# Verifies that bp2build-generated BUILD files for bionic (and its dependencies)
3# result in successful Bazel builds.
4# This verification script is designed to be used for continuous integration
5# tests, though may also be used for manual developer verification.
6
7if [[ -z ${DIST_DIR+x} ]]; then
8  echo "DIST_DIR not set. Using out/dist. This should only be used for manual developer testing."
9  DIST_DIR="out/dist"
10fi
11
12# Generate BUILD files into out/soong/bp2build
13AOSP_ROOT="$(dirname $0)/../../.."
14GENERATE_BAZEL_FILES=true "${AOSP_ROOT}/build/soong/soong_ui.bash" --make-mode nothing --skip-soong-tests
15
16# Remove the ninja_build output marker file to communicate to buildbot that this is not a regular Ninja build, and its
17# output should not be parsed as such.
18rm -f out/ninja_build
19
20# We could create .bazelrc files and use them on buildbots with --bazelrc, but
21# it's simpler to use a list for now.
22BUILD_FLAGS_LIST=(
23  --color=no
24  --curses=no
25  --show_progress_rate_limit=5
26  --config=bp2build
27)
28BUILD_FLAGS="${BUILD_FLAGS_LIST[@]}"
29
30TEST_FLAGS_LIST=(
31  --keep_going
32  --test_output=errors
33)
34TEST_FLAGS="${TEST_FLAGS_LIST[@]}"
35
36# Build targets for various architectures.
37BUILD_TARGETS_LIST=(
38  //bionic/...
39  //system/...
40  //external/arm-optimized-routines/...
41  //external/scudo/...
42)
43BUILD_TARGETS="${BUILD_TARGETS_LIST[@]}"
44tools/bazel --max_idle_secs=5 build ${BUILD_FLAGS} --platforms //build/bazel/platforms:android_x86 -k ${BUILD_TARGETS}
45tools/bazel --max_idle_secs=5 build ${BUILD_FLAGS} --platforms //build/bazel/platforms:android_x86_64 -k ${BUILD_TARGETS}
46tools/bazel --max_idle_secs=5 build ${BUILD_FLAGS} --platforms //build/bazel/platforms:android_arm -k ${BUILD_TARGETS}
47tools/bazel --max_idle_secs=5 build ${BUILD_FLAGS} --platforms //build/bazel/platforms:android_arm64 -k ${BUILD_TARGETS}
48
49# Run tests.
50tools/bazel --max_idle_secs=5 test ${BUILD_FLAGS} ${TEST_FLAGS} //build/bazel/tests/...
51