blob: 6684681739afd04983ec2cd4ba13a4a3a12a66e9 [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
Dan Willemsen9301d8d2015-12-10 12:38:23 -080023# Run the blueprint wrapper
24BUILDDIR="${BUILDDIR}" SKIP_NINJA=true build/blueprint/blueprint.bash
Colin Crosse441b9d2015-01-26 16:30:13 -080025
Colin Cross68f55102015-03-25 14:43:57 -070026# 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
Colin Cross24679672015-04-10 15:45:15 -070029ENVFILE="${BUILDDIR}/.soong.environment"
30ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env"
31if [ -f "${ENVFILE}" ]; then
32 if [ -x "${ENVTOOL}" ]; then
33 if ! "${ENVTOOL}" "${ENVFILE}"; then
Colin Cross68f55102015-03-25 14:43:57 -070034 echo "forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070035 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070036 fi
37 else
38 echo "Missing soong_env tool, forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070039 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070040 fi
41fi
42
Colin Cross3a31f162016-05-04 16:25:26 -070043"prebuilts/build-tools/${PREBUILTOS}/bin/ninja" -f "${BUILDDIR}/build.ninja" -w dupbuild=err "$@"