blob: 1c6e896b210cd5b384ddd615185a0cf7bf78f165 [file] [log] [blame]
Dan Willemsend79f1af2015-12-09 18:03:13 -08001#!/bin/bash
2
3# This script is intented to wrap the execution of ninja so that we
4# can do some checks before each ninja run.
5#
6# It can either be run with a standalone Blueprint checkout to generate
7# the minibp binary, or can be used by another script as part of a custom
8# Blueprint-based build system. When used by another script, the following
9# environment variables can be set to configure this script, which are
10# documented below:
11#
12# BUILDDIR
Dan Willemsen1e723212017-07-18 19:37:37 -070013# NINJA
Dan Willemsend79f1af2015-12-09 18:03:13 -080014# SKIP_NINJA
15#
16# When run in a standalone Blueprint checkout, bootstrap.bash will install
17# this script into the $BUILDDIR, where it may be executed.
18#
19# For embedding into a custom build system, the current directory when this
20# script executes should be the same directory that $BOOTSTRAP should be
21# called from.
22
23set -e
24
25# BUILDDIR should be set to the path to store build results. By default,
26# this is the directory containing this script, but can be set explicitly
27# if the custom build system only wants to install their own wrapper.
28[ -z "$BUILDDIR" ] && BUILDDIR=`dirname "${BASH_SOURCE[0]}"`
29
Dan Willemsen7d0dddd2016-08-13 12:42:11 -070030# NINJA should be set to the path of the ninja executable. By default, this
31# is just "ninja", and will be looked up in $PATH.
32[ -z "$NINJA" ] && NINJA=ninja
33
34
35if [ ! -f "${BUILDDIR}/.blueprint.bootstrap" ]; then
36 echo "Please run bootstrap.bash (.blueprint.bootstrap missing)" >&2
37 exit 1
38fi
39
Dan Willemsend79f1af2015-12-09 18:03:13 -080040# .blueprint.bootstrap provides saved values from the bootstrap.bash script:
41#
Dan Willemsen1e723212017-07-18 19:37:37 -070042# BLUEPRINT_BOOTSTRAP_VERSION
43# BLUEPRINTDIR
44# SRCDIR
45# GOROOT
Dan Willemsend79f1af2015-12-09 18:03:13 -080046#
Dan Willemsen7d0dddd2016-08-13 12:42:11 -070047source "${BUILDDIR}/.blueprint.bootstrap"
Dan Willemsend79f1af2015-12-09 18:03:13 -080048
Dan Willemsen1e723212017-07-18 19:37:37 -070049if [ -z "$BLUEPRINTDIR" ]; then
50 echo "Please run bootstrap.bash (.blueprint.bootstrap outdated)" >&2
51 exit 1
Dan Willemsend79f1af2015-12-09 18:03:13 -080052fi
53
Dan Willemsen1e723212017-07-18 19:37:37 -070054source "${BLUEPRINTDIR}/blueprint_impl.bash"