forked from xamarin/AndroidSupportComponents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
27 lines (21 loc) · 943 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
COMMIT="f61d7eda6d3ce4112a79937c8cceb94ad5aa081c"
URL="https://raw.githubusercontent.com/xamarin/XamarinComponents/$COMMIT/Util/Bootstrapper/cake.sh"
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SCRIPT="$SCRIPT_DIR/cake.sh"
# Get the commit last used to grab these files so we can check if an update's needed
commitTxt=""
if [ -f "$SCRIPT.commit" ]; then commitTxt=$(cat "$SCRIPT.commit"); fi
# If the cached file's commit doesn't match our desired, or if it's 'master' go download the right version
if [[ "$commitTxt" != "$COMMIT" || "$commitTxt" == "master" ]]; then
echo "Downloading $SCRIPT..."
# Download the script
curl -Lsfo $SCRIPT $URL
if [ $? -ne 0 ]; then
echo "An error occured while downloading $SCRIPT."
exit 1
fi
# Write out the commit hash used to cache for future runs
echo $COMMIT > "$SCRIPT.commit"
fi
export BOOTSTRAPPER_COMMIT="$COMMIT"
sh $SCRIPT $@