Update objc-build-scripts

This commit is contained in:
Justin Spahr-Summers
2013-11-11 11:21:34 -08:00
parent 75aff11a61
commit c5a6a223bc
5 changed files with 271 additions and 82 deletions

View File

@@ -1,11 +1,73 @@
#!/bin/bash
SCRIPT_DIR=$(dirname "$0")
cd "$SCRIPT_DIR/.."
export SCRIPT_DIR=$(dirname "$0")
set -o errexit
##
## Configuration Variables
##
echo "*** Updating submodules..."
git submodule sync --quiet
git submodule update --init
git submodule foreach --recursive --quiet "git submodule sync --quiet && git submodule update --init"
config ()
{
# A whitespace-separated list of executables that must be present and locatable.
: ${REQUIRED_TOOLS="xctool"}
export REQUIRED_TOOLS
}
##
## Bootstrap Process
##
main ()
{
config
if [ -n "$REQUIRED_TOOLS" ]
then
echo "*** Checking dependencies..."
check_deps
fi
local submodules=$(git submodule status 2>/dev/null)
if [ -n "$submodules" ]
then
echo "*** Updating submodules..."
update_submodules
fi
}
check_deps ()
{
for tool in $REQUIRED_TOOLS
do
which -s "$tool"
if [ "$?" -ne "0" ]
then
echo "*** Error: $tool not found. Please install it and bootstrap again."
exit 1
fi
done
}
bootstrap_submodule ()
{
local bootstrap="script/bootstrap"
if [ -e "$bootstrap" ]
then
echo "*** Bootstrapping $name..."
"$bootstrap" >/dev/null
else
update_submodules
fi
}
update_submodules ()
{
git submodule sync --quiet && git submodule update --init && git submodule foreach --quiet bootstrap_submodule
}
export -f bootstrap_submodule
export -f update_submodules
main