2015-01-27 01:30:13 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Switch to the build directory
|
|
|
|
cd $(dirname "${BASH_SOURCE[0]}")
|
2015-03-25 22:09:02 +01:00
|
|
|
|
|
|
|
# The source directory path and operating system will get written to
|
|
|
|
# .soong.bootstrap by the bootstrap script.
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
BOOTSTRAP=".soong.bootstrap"
|
2015-04-11 00:45:15 +02:00
|
|
|
if [ ! -f "${BOOTSTRAP}" ]; then
|
2015-03-25 22:09:02 +01:00
|
|
|
echo "Error: soong script must be located in a directory created by bootstrap.bash"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2015-04-11 00:45:15 +02:00
|
|
|
source "${BOOTSTRAP}"
|
2015-01-27 01:30:13 +01:00
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
# Now switch to the source directory so that all the relative paths from
|
|
|
|
# $BOOTSTRAP are correct
|
|
|
|
cd ${SRCDIR_FROM_BUILDDIR}
|
2015-01-27 01:30:13 +01:00
|
|
|
|
2015-12-10 21:38:23 +01:00
|
|
|
# Run the blueprint wrapper
|
|
|
|
BUILDDIR="${BUILDDIR}" SKIP_NINJA=true build/blueprint/blueprint.bash
|
2015-01-27 01:30:13 +01:00
|
|
|
|
2015-03-25 22:43:57 +01: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 00:45:15 +02: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-25 22:43:57 +01:00
|
|
|
echo "forcing build manifest regeneration"
|
2015-04-11 00:45:15 +02:00
|
|
|
rm -f "${ENVFILE}"
|
2015-03-25 22:43:57 +01:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Missing soong_env tool, forcing build manifest regeneration"
|
2015-04-11 00:45:15 +02:00
|
|
|
rm -f "${ENVFILE}"
|
2015-03-25 22:43:57 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-05-05 01:25:26 +02:00
|
|
|
"prebuilts/build-tools/${PREBUILTOS}/bin/ninja" -f "${BUILDDIR}/build.ninja" -w dupbuild=err "$@"
|