2015-01-27 01:30:13 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
set -e
|
|
|
|
|
2017-08-05 00:06:27 +02:00
|
|
|
if [ -z "$NO_DEPRECATION_WARNING" ]; then
|
|
|
|
echo '== WARNING: bootstrap.bash & ./soong are deprecated ==' >&2
|
|
|
|
echo 'Use `m --skip-make` with a standalone OUT_DIR instead.' >&2
|
|
|
|
echo 'Without envsetup.sh, use:' >&2
|
|
|
|
echo ' build/soong/soong_ui.bash --make-mode --skip-make' >&2
|
|
|
|
echo '======================================================' >&2
|
|
|
|
fi
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
ORIG_SRCDIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
if [[ "$ORIG_SRCDIR" != "." ]]; then
|
|
|
|
if [[ ! -z "$BUILDDIR" ]]; then
|
|
|
|
echo "error: To use BUILDDIR, run from the source directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-04-28 01:10:38 +02:00
|
|
|
export BUILDDIR=$("${ORIG_SRCDIR}/build/soong/scripts/reverse_path.py" "$ORIG_SRCDIR")
|
2015-07-14 09:39:06 +02:00
|
|
|
cd $ORIG_SRCDIR
|
|
|
|
fi
|
|
|
|
if [[ -z "$BUILDDIR" ]]; then
|
|
|
|
echo "error: Run ${BASH_SOURCE[0]} from the build output directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
export SRCDIR="."
|
|
|
|
export BOOTSTRAP="${SRCDIR}/bootstrap.bash"
|
2017-07-19 04:39:34 +02:00
|
|
|
export BLUEPRINTDIR="${SRCDIR}/build/blueprint"
|
2015-07-14 09:39:06 +02:00
|
|
|
|
2015-06-11 01:59:11 +02:00
|
|
|
export TOPNAME="Android.bp"
|
2015-06-24 04:46:20 +02:00
|
|
|
export RUN_TESTS="-t"
|
2015-01-27 01:30:13 +01:00
|
|
|
|
|
|
|
case $(uname) in
|
|
|
|
Linux)
|
|
|
|
export PREBUILTOS="linux-x86"
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
export PREBUILTOS="darwin-x86"
|
|
|
|
;;
|
|
|
|
*) echo "unknown OS:" $(uname) && exit 1;;
|
|
|
|
esac
|
2017-07-19 04:39:34 +02:00
|
|
|
export GOROOT="${SRCDIR}/prebuilts/go/$PREBUILTOS"
|
2015-01-27 01:30:13 +01:00
|
|
|
|
|
|
|
if [[ $# -eq 0 ]]; then
|
2015-07-14 09:39:06 +02:00
|
|
|
mkdir -p $BUILDDIR
|
|
|
|
|
|
|
|
if [[ $(find $BUILDDIR -maxdepth 1 -name Android.bp) ]]; then
|
|
|
|
echo "FAILED: The build directory must not be a source directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-04-28 01:10:38 +02:00
|
|
|
export SRCDIR_FROM_BUILDDIR=$(build/soong/scripts/reverse_path.py "$BUILDDIR")
|
2015-07-14 09:39:06 +02:00
|
|
|
|
|
|
|
sed -e "s|@@BuildDir@@|${BUILDDIR}|" \
|
|
|
|
-e "s|@@SrcDirFromBuildDir@@|${SRCDIR_FROM_BUILDDIR}|" \
|
2015-01-27 01:30:13 +01:00
|
|
|
-e "s|@@PrebuiltOS@@|${PREBUILTOS}|" \
|
2015-07-14 09:39:06 +02:00
|
|
|
"$SRCDIR/build/soong/soong.bootstrap.in" > $BUILDDIR/.soong.bootstrap
|
|
|
|
ln -sf "${SRCDIR_FROM_BUILDDIR}/build/soong/soong.bash" $BUILDDIR/soong
|
2015-01-27 01:30:13 +01:00
|
|
|
fi
|
|
|
|
|
2015-07-14 09:39:06 +02:00
|
|
|
"$SRCDIR/build/blueprint/bootstrap.bash" "$@"
|