blob: 8135e9f2d0c0b523b573821379da94a92de94eb0 [file] [log] [blame]
Paul Duffina805e0c2016-11-28 11:47:19 +00001#!/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 Duffince5771f2018-02-23 09:18:30 +000010if [ $# -ne 1 ]; then
Paul Duffina805e0c2016-11-28 11:47:19 +000011 echo "usage: $0 <version>"
12 echo " where <version> is the version number, e.g. 7.7.3"
13 exit 1
14fi
15
Paul Duffin747cc2a2017-02-16 11:11:10 +000016if [ -z "$ANDROID_BUILD_TOP" ]; then
17 echo "Missing environment variables. Did you run build/envsetup.sh and lunch?" 1>&2
18 exit 1
19fi
20
Paul Duffina805e0c2016-11-28 11:47:19 +000021VERSION=$1
22TAG=v$VERSION
23SOURCE="https://github.com/googlei18n/libphonenumber/"
24DIR=$ANDROID_BUILD_TOP/external/libphonenumber
25
26tmp=$(mktemp -d)
27trap "echo Removing temporary directory; rm -fr $tmp" EXIT
28
29echo "Fetching source into $tmp"
30(cd $tmp; git clone -q -b $TAG --depth 1 $SOURCE source)
31
32for i in $(ls $tmp/source/java)
33do
34 echo "Updating $i"
35 rm -fr $DIR/$i
36 cp -r $tmp/source/java/$i $DIR/$i
37 (cd $DIR; git add $i)
38done
39
40for i in README.version README.android
41do
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)
46done
Paul Duffin8b412272018-11-19 17:06:59 +000047
48${DIR}/srcgen/generate_android_src.sh
Paul Duffind99bfa42019-01-11 13:53:17 +000049git add repackaged