2015-01-27 08:30:13 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-14 15:39:06 +08:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Switch to the build directory
|
|
|
|
cd $(dirname "${BASH_SOURCE[0]}")
|
2015-03-26 05:09:02 +08:00
|
|
|
|
|
|
|
# The source directory path and operating system will get written to
|
|
|
|
# .soong.bootstrap by the bootstrap script.
|
|
|
|
|
2015-07-14 15:39:06 +08:00
|
|
|
BOOTSTRAP=".soong.bootstrap"
|
2015-04-11 06:45:15 +08:00
|
|
|
if [ ! -f "${BOOTSTRAP}" ]; then
|
2015-03-26 05:09:02 +08:00
|
|
|
echo "Error: soong script must be located in a directory created by bootstrap.bash"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-04-11 06:45:15 +08:00
|
|
|
source "${BOOTSTRAP}"
|
2015-01-27 08:30:13 +08:00
|
|
|
|
2015-07-14 15:39:06 +08:00
|
|
|
# Now switch to the source directory so that all the relative paths from
|
|
|
|
# $BOOTSTRAP are correct
|
|
|
|
cd ${SRCDIR_FROM_BUILDDIR}
|
2015-01-27 08:30:13 +08:00
|
|
|
|
2015-03-26 05:43:57 +08:00
|
|
|
# Ninja can't depend on environment variables, so do a manual comparison
|
|
|
|
# of the relevant environment variables from the last build using the
|
|
|
|
# soong_env tool and trigger a build manifest regeneration if necessary
|
2015-04-11 06:45:15 +08:00
|
|
|
ENVFILE="${BUILDDIR}/.soong.environment"
|
|
|
|
ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env"
|
|
|
|
if [ -f "${ENVFILE}" ]; then
|
|
|
|
if [ -x "${ENVTOOL}" ]; then
|
|
|
|
if ! "${ENVTOOL}" "${ENVFILE}"; then
|
2015-03-26 05:43:57 +08:00
|
|
|
echo "forcing build manifest regeneration"
|
2015-04-11 06:45:15 +08:00
|
|
|
rm -f "${ENVFILE}"
|
2015-03-26 05:43:57 +08:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Missing soong_env tool, forcing build manifest regeneration"
|
2015-04-11 06:45:15 +08:00
|
|
|
rm -f "${ENVFILE}"
|
2015-03-26 05:43:57 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-08-14 07:47:45 +08:00
|
|
|
BUILDDIR="${BUILDDIR}" NINJA="prebuilts/build-tools/${PREBUILTOS}/bin/ninja" build/blueprint/blueprint.bash "$@"
|