Paul Duffin | a805e0c | 2016-11-28 11:47:19 +0000 | [diff] [blame] | 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 | |
Paul Duffin | ce5771f | 2018-02-23 09:18:30 +0000 | [diff] [blame] | 10 | if [ $# -ne 1 ]; then |
Paul Duffin | a805e0c | 2016-11-28 11:47:19 +0000 | [diff] [blame] | 11 | echo "usage: $0 <version>" |
| 12 | echo " where <version> is the version number, e.g. 7.7.3" |
| 13 | exit 1 |
| 14 | fi |
| 15 | |
Paul Duffin | 747cc2a | 2017-02-16 11:11:10 +0000 | [diff] [blame] | 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 | |
Paul Duffin | a805e0c | 2016-11-28 11:47:19 +0000 | [diff] [blame] | 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 |
Paul Duffin | 8b41227 | 2018-11-19 17:06:59 +0000 | [diff] [blame] | 47 | |
| 48 | ${DIR}/srcgen/generate_android_src.sh |
Paul Duffin | d99bfa4 | 2019-01-11 13:53:17 +0000 | [diff] [blame] | 49 | git add repackaged |