-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_libphonenumber_js.sh
31 lines (26 loc) · 1.35 KB
/
build_libphonenumber_js.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
28
29
30
31
#!/bin/bash
#Downloads the latest sources for libphonenumber and closure-library and builds a standalone JavaScript file for libphonenumber
#Does not include the as-you-type formatter
DOWNLOAD_DIR=$1
CWD=`pwd`
echo "Checking out libphonenumber..."
svn checkout http://libphonenumber.googlecode.com/svn/trunk/ $DOWNLOAD_DIR/libphonenumber
echo "Checking out closure-library..."
svn checkout http://closure-library.googlecode.com/svn/trunk/ $DOWNLOAD_DIR/closure-library
echo "Downloading closure-compiler..."
curl -f -L http://closure-compiler.googlecode.com/files/compiler-latest.zip > $DOWNLOAD_DIR/compiler-latest.zip
unzip -o -d $DOWNLOAD_DIR $DOWNLOAD_DIR/compiler-latest.zip compiler.jar
echo "Compiling libphonenumber..."
cd $DOWNLOAD_DIR
closure-library/closure/bin/build/closurebuilder.py \
--root=closure-library \
--namespace="i18n.phonenumbers.PhoneNumberUtil" \
--namespace="i18n.phonenumbers.AsYouTypeFormatter" \
--output_mode=compiled \
--compiler_jar=compiler.jar \
libphonenumber/javascript/i18n/phonenumbers/metadata.js \
libphonenumber/javascript/i18n/phonenumbers/phonemetadata.pb.js \
libphonenumber/javascript/i18n/phonenumbers/phonenumber.pb.js \
libphonenumber/javascript/i18n/phonenumbers/phonenumberutil.js \
libphonenumber/javascript/i18n/phonenumbers/asyoutypeformatter.js \
> $CWD/libphonenumber.js