Colin Cross | e441b9d | 2015-01-26 16:30:13 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 3 | set -e |
| 4 | |
| 5 | # Switch to the build directory |
| 6 | cd $(dirname "${BASH_SOURCE[0]}") |
Colin Cross | e441b9d | 2015-01-26 16:30:13 -0800 | [diff] [blame] | 7 | |
Dan Willemsen | e0879fc | 2017-08-04 15:06:27 -0700 | [diff] [blame] | 8 | if [ -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 |
| 14 | fi |
| 15 | |
Colin Cross | f7531f1 | 2015-03-25 14:09:02 -0700 | [diff] [blame] | 16 | # The source directory path and operating system will get written to |
| 17 | # .soong.bootstrap by the bootstrap script. |
| 18 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 19 | BOOTSTRAP=".soong.bootstrap" |
Colin Cross | 2467967 | 2015-04-10 15:45:15 -0700 | [diff] [blame] | 20 | if [ ! -f "${BOOTSTRAP}" ]; then |
Colin Cross | f7531f1 | 2015-03-25 14:09:02 -0700 | [diff] [blame] | 21 | echo "Error: soong script must be located in a directory created by bootstrap.bash" |
| 22 | exit 1 |
| 23 | fi |
| 24 | |
Colin Cross | 2467967 | 2015-04-10 15:45:15 -0700 | [diff] [blame] | 25 | source "${BOOTSTRAP}" |
Colin Cross | f7531f1 | 2015-03-25 14:09:02 -0700 | [diff] [blame] | 26 | |
Dan Willemsen | 87b17d1 | 2015-07-14 00:39:06 -0700 | [diff] [blame] | 27 | # Now switch to the source directory so that all the relative paths from |
| 28 | # $BOOTSTRAP are correct |
| 29 | cd ${SRCDIR_FROM_BUILDDIR} |
Colin Cross | e441b9d | 2015-01-26 16:30:13 -0800 | [diff] [blame] | 30 | |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 31 | # 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 Cross | 2467967 | 2015-04-10 15:45:15 -0700 | [diff] [blame] | 34 | ENVFILE="${BUILDDIR}/.soong.environment" |
| 35 | ENVTOOL="${BUILDDIR}/.bootstrap/bin/soong_env" |
| 36 | if [ -f "${ENVFILE}" ]; then |
| 37 | if [ -x "${ENVTOOL}" ]; then |
| 38 | if ! "${ENVTOOL}" "${ENVFILE}"; then |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 39 | echo "forcing build manifest regeneration" |
Colin Cross | 2467967 | 2015-04-10 15:45:15 -0700 | [diff] [blame] | 40 | rm -f "${ENVFILE}" |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 41 | fi |
| 42 | else |
| 43 | echo "Missing soong_env tool, forcing build manifest regeneration" |
Colin Cross | 2467967 | 2015-04-10 15:45:15 -0700 | [diff] [blame] | 44 | rm -f "${ENVFILE}" |
Colin Cross | 68f5510 | 2015-03-25 14:43:57 -0700 | [diff] [blame] | 45 | fi |
| 46 | fi |
| 47 | |
Dan Willemsen | 79d2f25 | 2016-08-13 16:47:45 -0700 | [diff] [blame] | 48 | BUILDDIR="${BUILDDIR}" NINJA="prebuilts/build-tools/${PREBUILTOS}/bin/ninja" build/blueprint/blueprint.bash "$@" |