1#!/bin/bash 2# 3# Copyright (C) 2022 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# 18# Gather and print top-line performance metrics for the android build 19# 20readonly TOP="$(realpath "$(dirname "$0")/../../../..")" 21 22usage() { 23 cat <<EOF 24usage: $0 [-l LOG_DIR] [BUILD_TYPES] 25 -l LOG_DIR should be outside of source tree, including not in out/, 26 because the whole tree will be cleaned during testing. 27example: 28 $0 soong prod 29EOF 30 exit 1 31} 32 33declare -a build_types 34while getopts "l:" opt; do 35 case "$opt" in 36 l) log_dir=$OPTARG ;; 37 ?) usage ;; 38 esac 39done 40shift $((OPTIND - 1)) 41readonly -a build_types=("$@") 42 43log_dir=${log_dir:-"$TOP/../timing-$(date +%b%d-%H%M)"} 44 45function build() { 46 date 47 set -x 48 if ! "$TOP/build/bazel/scripts/incremental_build/incremental_build.sh" \ 49 --ignore-repo-diff --log-dir "$log_dir" \ 50 ${build_types:+--build-types "${build_types[@]}"} \ 51 "$@"; then 52 echo "See logs for errors" 53 exit 1 54 fi 55 set +x 56} 57build --cujs clean 'create bionic/unreferenced.txt' 'modify Android.bp' -- droid 58build --cujs 'modify bionic/.*/stdio.cpp' --append-csv libc 59build --cujs 'modify .*/adb/daemon/main.cpp' --append-csv adbd 60build --cujs 'modify frameworks/.*/View.java' --append-csv framework 61 62