1#!/bin/bash 2set -eu 3 4################################################################################ 5# This script is intended to be a test to verify that the orchestrator still 6# works for others (assuming that they use a similar workflow.) 7# 8# NOT INTENDED to be used for general building and development, since it removes 9# out/ and does other semi-hardcoded things. 10################################################################################ 11 12# Typical usage: 13# 14# orchestrator/test_build.sh 15# This builds the default target 16# orchestrator/test_build.sh vendor/nothing 17# Build "vendor/nothing", rather than the default target. 18# 19# Environment variables that affect this script: 20# OUT_DIR: Output directory. We assume "out" if not set. 21# MCOMBO_DIR: Directory with (test) mcombo files. 22# MCOMBO_FILE: Mcombo file to use. Default: aosp_cf_arm64_phone.mcombo 23# 24# Any arguments passed to the script are passed to multitree_build. 25 26TOP="$(repo --show-toplevel || git rev-parse --show-toplevel || echo .)" 27if [[ ${TOP} != . ]]; then 28 echo "running build in ${TOP}" >&2 29 cd "${TOP}" 30fi 31 32: ${MCOMBO_DIR:=orchestrator/build/orchestrator/multitree_combos/} 33# Force a trailing / 34MCOMBO_DIR="${MCOMBO_DIR%%/}/" 35: ${MCOMBO_FILE:=aosp_cf_arm64_phone.mcombo} 36 37# In aosp/2328802, build/make/core/envsetup.mk must exist under the top of the 38# workspace. For now, make {WORKSPACE}/build a symlink to orchestrator/build. 39if [[ ! -d build/ ]]; then 40 ln -s orchestrator/build build 41fi 42 43( 44 set +u # envsetup has unset variable references. 45 . orchestrator/build/make/envsetup.sh 46 multitree_lunch "${MCOMBO_DIR}${MCOMBO_FILE}" userdebug 47 rm -rf "${OUT_DIR:-out}" 48 multitree_build "$@" 49) 50