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