• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
10if [ $# -ne 1 ]; then
11    echo "usage: $0 <version>"
12    echo "  where <version> is the version number, e.g. 7.7.3"
13    exit 1
14fi
15
16if [ -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
21VERSION=$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
47
48${DIR}/srcgen/generate_android_src.sh
49git add repackaged
50