blob: 7b4316dfa6f099602058b99a40489017d8f083f7 [file] [log] [blame]
#!/bin/bash -eu
# analyze_build is the main entry point for the platform build analysis toolkit.
#
# Main features:
#
# usage: analyze_build <one of the following options>
#
# timing: prints timing breakdown of the latest build
# bp2build <module name>: prints if a module is converted by bp2build, or the reason why it is not converted.
# build_files: compresses all generated build files into a tarball
readonly TOP="$(realpath "$(dirname "$0")/../../..")"
if [[ -z ${OUT_DIR+x} ]]; then
OUT_DIR="$TOP/out"
fi
if [ ! -f ${OUT_DIR}/soong/workspace/WORKSPACE ]; then
echo "bp2build workspace does not exist. Have you run a Bazel-enabled build since last clean?"
exit 1
fi
ANDROID_BUILD_TOP=$TOP "$TOP/build/bazel/bin/bazel" run --config=bp2build --verbose_failures //build/bazel/scripts:print_analysis_metrics -- "$@"