-
Notifications
You must be signed in to change notification settings - Fork 40
/
build.xml
166 lines (154 loc) · 7.51 KB
/
build.xml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?xml version="1.0" ?>
<project name="libphonenumber-javascript" default="compile">
<property name="closure-compiler.dir"
value="${basedir}/vendor/closure-compiler" />
<property name="closure-compiler.jar"
value="${closure-compiler.dir}/target/closure-compiler-1.0-SNAPSHOT.jar" />
<property name="closure-library.dir"
value="${basedir}/vendor/closure-library" />
<property name="closure-linter.dir"
value="${basedir}/vendor/closure-linter" />
<property name="python-gflags.dir"
value="${basedir}/vendor/python-gflags" />
<property name="libphonenumber.dir"
value="${basedir}/vendor/libphonenumber" />
<property file="${basedir}/tmp/regioncodes.properties" />
<taskdef resource="net/sf/antcontrib/antlib.xml"></taskdef>
<macrodef name="closure-compile">
<attribute name="inputfile" />
<attribute name="outputfile" />
<attribute name="compilationlevel" default="ADVANCED_OPTIMIZATIONS" />
<attribute name="outputmode" default="compiled" />
<attribute name="outputwrapper" default="(function(){%output%})();" />
<element name="extraflags" optional="yes" />
<sequential>
<exec executable="python" failonerror="true" logError="true">
<arg value="${closure-library.dir}/closure/bin/calcdeps.py" />
<arg line='-i "@{inputfile}"' />
<arg line='--output_file "@{outputfile}"' />
<arg line='-p "${closure-library.dir}"' />
<arg line="-o @{outputmode}" />
<arg line='-c "${closure-compiler.jar}"' />
<arg line='-f "--output_wrapper=@{outputwrapper}"' />
<arg line='-f "--compilation_level=@{compilationlevel}"' />
<arg line='-f "--warning_level=VERBOSE"' />
<arg line='-f "--jscomp_error=accessControls"' />
<arg line='-f "--jscomp_error=ambiguousFunctionDecl"' />
<arg line='-f "--jscomp_error=checkDebuggerStatement"' />
<arg line='-f "--jscomp_error=checkRegExp"' />
<arg line='-f "--jscomp_error=checkTypes"' />
<arg line='-f "--jscomp_error=checkVars"' />
<arg line='-f "--jscomp_error=const"' />
<arg line='-f "--jscomp_error=constantProperty"' />
<arg line='-f "--jscomp_error=deprecated"' />
<arg line='-f "--jscomp_error=duplicate"' />
<arg line='-f "--jscomp_error=duplicateMessage"' />
<arg line='-f "--jscomp_error=es5Strict"' />
<arg line='-f "--jscomp_error=externsValidation"' />
<arg line='-f "--jscomp_error=fileoverviewTags"' />
<arg line='-f "--jscomp_error=globalThis"' />
<arg line='-f "--jscomp_error=internetExplorerChecks"' />
<arg line='-f "--jscomp_error=invalidCasts"' />
<arg line='-f "--jscomp_error=misplacedTypeAnnotation"' />
<arg line='-f "--jscomp_error=missingProperties"' />
<arg line='-f "--jscomp_error=nonStandardJsDocs"' />
<arg line='-f "--jscomp_error=strictModuleDepCheck"' />
<arg line='-f "--jscomp_error=suspiciousCode"' />
<arg line='-f "--jscomp_error=typeInvalidation"' />
<arg line='-f "--jscomp_error=undefinedNames"' />
<arg line='-f "--jscomp_error=undefinedVars"' />
<arg line='-f "--jscomp_error=unknownDefines"' />
<arg line='-f "--jscomp_error=uselessCode"' />
<arg line='-f "--jscomp_error=visibility"' />
<extraflags />
</exec>
</sequential>
</macrodef>
<macrodef name="gjslint">
<attribute name="inputfile" />
<sequential>
<exec executable="python" failonerror="false" logError="true">
<env key="PYTHONPATH"
value="${closure-linter.dir}:${python-gflags.dir}"/>
<arg value="${closure-linter.dir}/closure_linter/gjslint.py" />
<arg line='--strict' />
<arg line='"@{inputfile}"' />
</exec>
</sequential>
</macrodef>
<condition property="os.iswindows">
<os family="windows" />
</condition>
<condition property="os.isunix">
<os family="unix" />
</condition>
<target name="nul" if="os.iswindows">
<property name="null.device" value="NUL" />
</target>
<target name="devnull" if="os.isunix">
<property name="null.device" value="/dev/null" />
</target>
<target name="setnulldevice" depends="nul,devnull" />
<target name="clean" description="deletes all generated files">
<delete dir="dist" />
<delete dir="tmp" />
<mkdir dir="dist"/>
<mkdir dir="tmp"/>
</target>
<target name="prepare-country-metadata" >
<exec executable="${basedir}/metadata.js" failonerror="true">
<arg value="${libphonenumber.dir}/javascript/i18n/phonenumbers/metadatalite.js" />
<arg value="${basedir}/tmp/" />
</exec>
</target>
<target name="compile-libphonenumber"
description="generates libphonenumber.js">
<closure-compile inputfile="libphonenumber.js"
outputfile="dist/libphonenumber.js">
<extraflags>
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadatafortesting.js"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadatalite.js"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/regioncodefortesting.js"' />
</extraflags>
</closure-compile>
</target>
<target name="compile-country-libphonenumber"
description="generates country libphonenumber.js">
<closure-compile inputfile="libphonenumber.js"
outputfile="dist/libphonenumber_${regioncode}.js">
<extraflags>
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers/phonenumberutil.js"' />
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers/phonemetadata.pb.js"' />
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers/phonenumber.pb.js"' />
<arg line='-p "tmp/metadata_${regioncode}.js"' />
</extraflags>
</closure-compile>
</target>
<target name="compile-tests" depends="setnulldevice">
<closure-compile inputfile="${libphonenumber.dir}/javascript/i18n/phonenumbers/asyoutypeformatter_test.js"
outputfile="${null.device}">
<extraflags>
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadata.js"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadatalite.js"' />
</extraflags>
</closure-compile>
<closure-compile inputfile="${libphonenumber.dir}/javascript/i18n/phonenumbers/phonenumberutil_test.js"
outputfile="${null.device}">
<extraflags>
<arg line='-p "${libphonenumber.dir}/javascript/i18n/phonenumbers"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadata.js"' />
<arg line='-e "${libphonenumber.dir}/javascript/i18n/phonenumbers/metadatalite.js"' />
</extraflags>
</closure-compile>
</target>
<target name="compile" depends="clean,prepare-country-metadata,compile-libphonenumber">
<foreach parallel="true" target="compile-country-libphonenumber" param="regioncode" list="${regioncodes}"/>
</target>
<target name="lint" description="lints all javascript files">
<gjslint inputfile="${libphonenumber.dir}/javascript/i18n/phonenumbers/asyoutypeformatter*.js" />
<gjslint inputfile="${libphonenumber.dir}/javascript/i18n/phonenumbers/demo.js" />
<gjslint inputfile="${libphonenumber.dir}/javascript/i18n/phonenumbers/phonenumberutil*.js" />
</target>
</project>