blob: d832eb2619b621adcdd63a6a53368c3de6258802 [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
Dan Willemsene0879fc2017-08-04 15:06:27 -07008if [ -z "$NO_DEPRECATION_WARNING" ]; then
9 echo '== WARNING: bootstrap.bash & ./soong are deprecated ==' >&2
10 echo 'Use `m --skip-make` with a standalone OUT_DIR instead.' >&2
11 echo 'Without envsetup.sh, use:' >&2
12 echo ' build/soong/soong_ui.bash --make-mode --skip-make' >&2
13 echo '======================================================' >&2
14fi
15
Colin Crossf7531f12015-03-25 14:09:02 -070016# The source directory path and operating system will get written to
17# .soong.bootstrap by the bootstrap script.
18
Dan Willemsen87b17d12015-07-14 00:39:06 -070019BOOTSTRAP=".soong.bootstrap"
Colin Cross24679672015-04-10 15:45:15 -070020if [ ! -f "${BOOTSTRAP}" ]; then
Colin Crossf7531f12015-03-25 14:09:02 -070021 echo "Error: soong script must be located in a directory created by bootstrap.bash"
22 exit 1
23fi
24
Colin Cross24679672015-04-10 15:45:15 -070025source "${BOOTSTRAP}"
Colin Crossf7531f12015-03-25 14:09:02 -070026
Dan Willemsen87b17d12015-07-14 00:39:06 -070027# Now switch to the source directory so that all the relative paths from
28# $BOOTSTRAP are correct
29cd ${SRCDIR_FROM_BUILDDIR}
Colin Crosse441b9d2015-01-26 16:30:13 -080030
Colin Cross68f55102015-03-25 14:43:57 -070031# Ninja can't depend on environment variables, so do a manual comparison
32# of the relevant environment variables from the last build using the
33# soong_env tool and trigger a build manifest regeneration if necessary
Colin Cross24679672015-04-10 15:45:15 -070034ENVFILE="${BUILDDIR}/.soong.environment"
35ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env"
36if [ -f "${ENVFILE}" ]; then
37 if [ -x "${ENVTOOL}" ]; then
38 if ! "${ENVTOOL}" "${ENVFILE}"; then
Colin Cross68f55102015-03-25 14:43:57 -070039 echo "forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070040 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070041 fi
42 else
43 echo "Missing soong_env tool, forcing build manifest regeneration"
Colin Cross24679672015-04-10 15:45:15 -070044 rm -f "${ENVFILE}"
Colin Cross68f55102015-03-25 14:43:57 -070045 fi
46fi
47
Dan Willemsen79d2f252016-08-13 16:47:45 -070048BUILDDIR="${BUILDDIR}" NINJA="prebuilts/build-tools/${PREBUILTOS}/bin/ninja" build/blueprint/blueprint.bash "$@"