1 #!/bin/bash 2 # 3 # Copyright 2016 The Android Open Source Project. 4 # 5 # Retrieves the specified version of libphonenumber into the 6 # external/libphonenumber directory 7 # 8 # Does not create a GIT commit. 9 10 if [ $# -ne 1 ]; then 11 echo "usage: $0 <version>" 12 echo " where <version> is the version number, e.g. 7.7.3" 13 exit 1 14 fi 15 16 if [ -z "$ANDROID_BUILD_TOP" ]; then 17 echo "Missing environment variables. Did you run build/envsetup.sh and lunch?" 1>&2 18 exit 1 19 fi 20 21 VERSION=$1 22 TAG=v$VERSION 23 SOURCE="https://github.com/googlei18n/libphonenumber/" 24 DIR=$ANDROID_BUILD_TOP/external/libphonenumber 25 26 tmp=$(mktemp -d) 27 trap "echo Removing temporary directory; rm -fr $tmp" EXIT 28 29 echo "Fetching source into $tmp" 30 (cd $tmp; git clone -q -b $TAG --depth 1 $SOURCE source) 31 32 for i in $(ls $tmp/source/java) 33 do 34 echo "Updating $i" 35 rm -fr $DIR/$i 36 cp -r $tmp/source/java/$i $DIR/$i 37 (cd $DIR; git add $i) 38 done 39 40 for i in README.version README.android 41 do 42 echo "Updating $i" 43 cp $DIR/$i $tmp 44 sed "s|Version: .*$|Version: $VERSION|" < $tmp/$i > $DIR/$i 45 (cd $DIR; git add $i) 46 done 47 48 ${DIR}/srcgen/generate_android_src.sh 49 git add repackaged 50