blob: 1dbf4e4e0d84ebe971c986538b445d90ba702923 [file] [log] [blame]
Colin Crosse441b9d2015-01-26 16:30:13 -08001#!/bin/bash
2
Dan Willemsen87b17d12015-07-14 00:39:06 -07003set -e
4
5# Switch to the build directory
6cd $(dirname "${BASH_SOURCE[0]}")
Colin Crosse441b9d2015-01-26 16:30:13 -08007
Colin Crossf7531f12015-03-25 14:09:02 -07008# The source directory path and operating system will get written to
9# .soong.bootstrap by the bootstrap script.
10
Dan Willemsen87b17d12015-07-14 00:39:06 -070011BOOTSTRAP=".soong.bootstrap"
Colin Cross24679672015-04-10 15:45:15 -070012if [ ! -f "${BOOTSTRAP}" ]; then
Colin Crossf7531f12015-03-25 14:09:02 -070013 echo "Error: soong script must be located in a directory created by bootstrap.bash"
14 exit 1
15fi
16
Colin Cross24679672015-04-10 15:45:15 -070017source "${BOOTSTRAP}"
Colin Crossf7531f12015-03-25 14:09:02 -070018
Dan Willemsen87b17d12015-07-14 00:39:06 -070019# Now switch to the source directory so that all the relative paths from
20# $BOOTSTRAP are correct
21cd ${SRCDIR_FROM_BUILDDIR}
Colin Crosse441b9d2015-01-26 16:30:13 -080022
Colin Cross68f55102015-03-25 14:43:57 -070023# 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
Colin Cross24679672015-04-10 15:45:15 -070026ENVFILE="${BUILDDIR}/.soong.environment"
27ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env"
28if [ -f "${ENVFILE}" ]; then
29 if [ -x "${ENVTOOL}" ]; then
30 if ! "${ENVTOOL}" "${ENVFILE}"; then
Colin Cross68f55102015-03-25 14:43:57 -070031 echo "forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070032 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070033 fi
34 else
35 echo "Missing soong_env tool, forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070036 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070037 fi
38fi
39
Dan Willemsen79d2f252016-08-13 16:47:45 -070040BUILDDIR="${BUILDDIR}" NINJA="prebuilts/build-tools/${PREBUILTOS}/bin/ninja" build/blueprint/blueprint.bash "$@"