1#!/bin/bash 2 3set -e 4 5# Switch to the build directory 6cd $(dirname "${BASH_SOURCE[0]}") 7 8# The source directory path and operating system will get written to 9# .soong.bootstrap by the bootstrap script. 10 11BOOTSTRAP=".soong.bootstrap" 12if [ ! -f "${BOOTSTRAP}" ]; then 13 echo "Error: soong script must be located in a directory created by bootstrap.bash" 14 exit 1 15fi 16 17source "${BOOTSTRAP}" 18 19# Now switch to the source directory so that all the relative paths from 20# $BOOTSTRAP are correct 21cd ${SRCDIR_FROM_BUILDDIR} 22 23# Ninja can't depend on environment variables, so do a manual comparison 24# of the relevant environment variables from the last build using the 25# soong_env tool and trigger a build manifest regeneration if necessary 26ENVFILE="${BUILDDIR}/.soong.environment" 27ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env" 28if [ -f "${ENVFILE}" ]; then 29 if [ -x "${ENVTOOL}" ]; then 30 if ! "${ENVTOOL}" "${ENVFILE}"; then 31 echo "forcing build manifest regeneration" 32 rm -f "${ENVFILE}" 33 fi 34 else 35 echo "Missing soong_env tool, forcing build manifest regeneration" 36 rm -f "${ENVFILE}" 37 fi 38fi 39 40BUILDDIR="${BUILDDIR}" NINJA="prebuilts/build-tools/${PREBUILTOS}/bin/ninja" build/blueprint/blueprint.bash "$@" 41