1#!/bin/bash -eu 2 3# analyze_build is the main entry point for the platform build analysis toolkit. 4# 5# Main features: 6# 7# usage: analyze_build <one of the following options> 8# 9# timing: prints timing breakdown of the latest build 10# bp2build <module name>: prints if a module is converted by bp2build, or the reason why it is not converted. 11# build_files: compresses all generated build files into a tarball 12 13readonly TOP="$(realpath "$(dirname "$0")/../../..")" 14if [[ -z ${OUT_DIR+x} ]]; then 15 OUT_DIR="$TOP/out" 16fi 17 18if [ ! -f ${OUT_DIR}/soong/workspace/WORKSPACE ]; then 19 echo "bp2build workspace does not exist. Have you run a Bazel-enabled build since last clean?" 20 exit 1 21fi 22 23ANDROID_BUILD_TOP=$TOP "$TOP/build/bazel/bin/bazel" run --config=bp2build --verbose_failures //build/bazel/scripts:print_analysis_metrics -- "$@" 24