build.xml revision c73f511526464f8e56c242df80552e9b0d94ae3d
1<!DOCTYPE project [
2    <!ENTITY icu-config SYSTEM "/icu-config.xml">
3    <!ENTITY icu-locale-deprecates SYSTEM "/icu-locale-deprecates.xml">
4    <!ENTITY icu-coll-deprecates SYSTEM "/icu-coll-deprecates.xml">
5]>
6<!--
7/*
8*******************************************************************************
9* Copyright (C) 2005-2014, International Business Machines Corporation and    *
10* others. All Rights Reserved.                                                *
11*******************************************************************************
12*/
13-->
14<project name="icu-build" default="all" basedir=".">
15    <target name="init">
16        <tstamp/>
17
18        <!-- Load environment variables -->
19        <property environment="env"/>
20
21    	<!-- Ant won't set properties that have already been set, so environment variables that have been set before won't be clobbered. -->
22    	<property name="env.ICU4C_DIR" location="../.."/>
23
24    	<condition property="is.cldr.dir.set" >
25            <isset property="env.CLDR_DIR" />
26        </condition >
27        <fail unless="is.cldr.dir.set" message="Please set the CLDR_DIR environment variable to the top level ICU source dir (containing 'common')."/>
28
29        <available property="cldrtools.dir" value="${env.CLDR_DIR}/cldr-tools" file="${env.CLDR_DIR}/cldr-tools" type="dir"/>
30        <available property="cldrtools.dir" value="${env.CLDR_DIR}/tools/java" file="${env.CLDR_DIR}/tools/java" type="dir"/>
31        <fail unless="cldrtools.dir" message="Please make sure that the CLDR tools directory is checked out into CLDR_DIR"/>
32
33        <available property="env.CLDR_CLASSES" value="${cldrtools.dir}/classes" file="${cldrtools.dir}/classes" type="dir"/>
34        <available property="cldrtools.jar" value="${cldrtools.dir}/cldr.jar" file="${cldrtools.dir}/cldr.jar" type="file"/>
35        <condition property="is.cldr.classes.set">
36            <or>
37                <isset property="env.CLDR_CLASSES" />
38                <isset property="cldrtools.jar" />
39            </or>
40        </condition>
41        <fail unless="is.cldr.classes.set" message="CLDR classes not found in ${cldrtools.dir}. Please either set the CLDR_CLASSES environment variable or build cldr.jar."/>
42
43    	<echo message="java home: ${java.home}"/>
44        <echo message="java version: ${java.version}"/>
45        <echo message="ant java version: ${ant.java.version}"/>
46        <echo message="${ant.version}"/>
47    </target>
48    <target name="setup">
49        <taskdef name="cldr-build" classname="org.unicode.cldr.ant.CLDRBuild">
50            <classpath>
51                <pathelement path="${java.class.path}/"/>
52                <pathelement path="${env.CLDR_CLASSES}"/>
53                <pathelement location="${cldrtools.jar}"/>
54                <fileset dir="${cldrtools.dir}/libs" includes="*.jar"/>
55            </classpath>
56        </taskdef>
57    </target>
58    <!-- target for generating ICU data -->
59    <!-- Google Patch:  exclude metaZones, windowsZones from "all" -->
60    <target name="all" depends="locales, collation, rbnf, supplementalData, metadata, likelySubtags, plurals, numberingSystems, translit, brkitr, keyTypeData, genderList, postalCodeData, dayPeriods" />
61    <!-- parallel target -->
62    <target name="pall" depends="init">
63        <parallel threadsPerProcessor ="1">
64          <sequential>
65            <ant target='locales' />
66          </sequential>
67          <sequential>
68            <ant target='collation'>
69            </ant>
70          </sequential>
71          <sequential>
72            <ant target='rbnf'>
73            </ant>
74          </sequential>
75          <ant target='supplementalData'>
76          </ant>
77          <sequential>
78            <ant target='brkitr'>
79            </ant>
80          </sequential>
81          <sequential>
82            <ant target='translit'>
83            </ant>
84            <!--<ant target='trnsfiles'></ant> Not ANT-built - see
85            note below. -->
86          </sequential>
87          <sequential>
88          	<ant target='keyTypeData'/>
89          </sequential>
90          <sequential>
91          	<ant target='genderList'/>
92          </sequential>
93          <sequential>
94          	<ant target='postalCodeData'/>
95          </sequential>
96          <sequential>
97          	<ant target='dayPeriods'/>
98          </sequential>
99        </parallel>
100     </target>
101
102    <target name="locales" depends="init,setup" description="builds locale files in ICU text format">
103        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
104            <!-- launch the tool and generate the data after reading the config file -->
105            <run>
106                <args>
107                    <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/main" />
108                    <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/locales"/>
109                    <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/main"/>
110                    <arg name="--supplementaldir" value="${env.CLDR_DIR}/common/supplemental" />
111                    <arg name="--type" value="locales"/>
112                    <arg name="--filter"/>     <!-- Google Patch: select short names for HK, MO. (SAR China.) -->
113                    <arg name="--makefile" value="resfiles.mk"/>
114                </args>
115		<remapper>
116		  <remap sourcePath="/Keys" targetDir="lang" />
117		  <remap sourcePath="/Languages" targetDir="lang" />
118		  <remap sourcePath="/LanguagesShort" targetDir="lang" />
119		  <remap sourcePath="/Scripts" targetDir="lang" />
120		  <remap sourcePath="/Scripts%stand-alone" targetDir="lang" />
121		  <remap sourcePath="/Types" targetDir="lang" />
122		  <remap sourcePath="/Variants" targetDir="lang" />
123		  <remap sourcePath="/codePatterns" targetDir="lang" />
124		  <remap sourcePath="/localeDisplayPattern" targetDir="lang" />
125		  <remap sourcePath="/Countries" targetDir="region" />
126		  <remap sourcePath="/CountriesShort" targetDir="region" />
127		  <remap sourcePath="/Currencies" targetDir="curr" />
128		  <remap sourcePath="/CurrencyPlurals" targetDir="curr" />
129		  <remap sourcePath="/CurrencyUnitPatterns" targetDir="curr" />
130		  <remap sourcePath="/currencySpacing" targetDir="curr" />
131		  <remap sourcePath="/zoneStrings" targetDir="zone" />
132		</remapper>
133                <!-- http://ant.apache.org/faq.html#xml-entity-include -->
134                &icu-config;
135        		&icu-locale-deprecates;
136            </run>
137        </cldr-build>
138    </target>
139    <target name="collation" depends="init,setup" description="builds collation files in ICU text format">
140        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
141            <run>
142                <args>
143                    <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/collation" />
144                    <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/coll"/>
145                    <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/collation"/>
146                    <arg name="--type"            value="collation"/>
147                    <arg name="--makefile" value="colfiles.mk"/>
148                </args>
149                <!-- http://ant.apache.org/faq.html#xml-entity-include -->
150                &icu-config;
151                &icu-coll-deprecates;
152            </run>
153        </cldr-build>
154    </target>
155    <target name="rbnf" depends="init,setup" description="builds rbnf files in ICU text format">
156        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
157            <run>
158                <args>
159                    <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/rbnf" />
160                    <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/rbnf"/>
161                    <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/rbnf"/>
162                    <arg name="--type" value="rbnf" />
163                    <arg name="--makefile" value="rbnffiles.mk"/>
164                </args>
165                <!-- http://ant.apache.org/faq.html#xml-entity-include -->
166                &icu-config;
167            </run>
168        </cldr-build>
169    </target>
170    <target name="supplementalData" depends="init,setup" description="builds supplementalData.txt from supplementalData.xml">
171        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="supplementalData.txt" noArgs="true">
172            <!-- launch the tool and generate the data after reading the config file -->
173            <run>
174                <args>
175                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
176                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
177                    <arg name="-t" value="supplementalData"/>
178                </args>
179		<remapper>
180		  <remap sourcePath="/CurrencyMap" targetDir="curr" />
181		  <remap sourcePath="/CurrencyMeta" targetDir="curr" />
182		</remapper>
183            </run>
184        </cldr-build>
185    </target>
186    <target name="metadata" depends="init,setup" description="builds metadata.txt from supplementalMetadata.xml">
187        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="metadata.txt" noArgs="true">
188            <!-- launch the tool and generate the data after reading the config file -->
189            <run>
190                <args>
191                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
192                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
193                    <arg name="-t" value="metadata"/>
194                </args>
195            </run>
196        </cldr-build>
197    </target>
198    <!-- Google patch: removed metaZones and windowsZones targets. -->
199    <target name="likelySubtags" depends="init,setup" description="builds likelySubtags.txt from likelySubtags.xml">
200        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="likelySubtags.txt" noArgs="true">
201            <!-- launch the tool and generate the data after reading the config file -->
202            <run>
203                <args>
204                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
205                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
206                    <arg name="-t" value="likelySubtags"/>
207                </args>
208            </run>
209        </cldr-build>
210    </target>
211    <target name="plurals" depends="init,setup" description="builds plurals.txt from plurals.xml">
212        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="plurals.txt" noArgs="true">
213            <!-- launch the tool and generate the data after reading the config file -->
214            <run>
215                <args>
216                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
217                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
218                    <arg name="-t" value="plurals"/>
219                </args>
220            </run>
221        </cldr-build>
222    </target>
223    <target name="numberingSystems" depends="init,setup" description="builds numberingSystems.txt from numberingSystems.xml">
224        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="numberingSystems.txt" noArgs="true">
225            <!-- launch the tool and generate the data after reading the config file -->
226            <run>
227                <args>
228                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
229                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
230                    <arg name="-t" value="numberingSystems"/>
231                </args>
232            </run>
233        </cldr-build>
234    </target>
235    <target name="genderList" depends="init,setup" description="builds genderList.txt from genderList.xml">
236        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="genderList.txt" noArgs="true">
237            <!-- launch the tool and generate the data after reading the config file -->
238            <run>
239                <args>
240                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
241                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
242                    <arg name="-t" value="genderList"/>
243                </args>
244            </run>
245        </cldr-build>
246    </target>
247    <target name="postalCodeData" depends="init,setup" description="builds postalCodeData.txt from postalCodeData.xml">
248        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="postalCodeData.txt" noArgs="true">
249            <!-- launch the tool and generate the data after reading the config file -->
250            <run>
251                <args>
252                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
253                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
254                    <arg name="-t" value="postalCodeData"/>
255                </args>
256            </run>
257        </cldr-build>
258    </target>
259    <target name="dayPeriods" depends="init,setup" description="builds dayPeriods.txt from dayPeriods.xml">
260        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="dayPeriods.txt" noArgs="true">
261            <!-- launch the tool and generate the data after reading the config file -->
262            <run>
263                <args>
264                    <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
265                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
266                    <arg name="-t" value="dayPeriods"/>
267                </args>
268            </run>
269        </cldr-build>
270    </target>
271    <target name="brkitr" depends="init,setup" description="builds break iterator files in ICU text format">
272        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
273            <run>
274                <args>
275                    <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/segments"/>
276					<arg name="--specialsdir"       value="${env.ICU4C_DIR}/source/data/xml/brkitr"/>
277                    <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/brkitr"/>
278                    <arg name="--type" value="brkitr" />
279                    <arg name="--makefile" value="brkfiles.mk"/>
280                </args>
281                <!-- The entity include is not required for this target -->
282                <!-- http://ant.apache.org/faq.html#xml-entity-include
283                &icu-config;
284                -->
285            </run>
286        </cldr-build>
287    </target>
288
289    <target name="keyTypeData" depends="init,setup" description="builds keyTypeData.txt and timezoneTypes.txt from bcp47/*.xml">
290        <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" noArgs="true">
291            <run>
292                <args>
293                    <arg name="-s" value="${env.CLDR_DIR}/common/bcp47" />
294                    <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
295                    <arg name="-t" value="keyTypeData"/>
296                </args>
297            </run>
298        </cldr-build>
299    </target>
300
301    <target name="translit" depends="init,setup" description="builds collation files in ICU text format">
302        <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile=".*txt">
303            <run>
304                <args>
305                    <arg name="-m" value="((?!.*(Canadian|Ethiopic|ug-Latin).*).*)" />
306                    <arg name="--sourcedir" value="${env.CLDR_DIR}/common/transforms" />
307                    <arg name="--destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
308                    <arg name="--commentSkip"/>
309                </args>
310                <!-- http://ant.apache.org/faq.html#xml-entity-include -->
311
312            </run>
313        </cldr-build>
314    </target>
315    <!-- we don't generate en.txt or el.txt - so don't change trnsfiles.mk for now. -->
316<!--   
317     <target name="trnsfiles" depends="init, setup" description="builds trnsfiles.mk">
318        <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile="trnsfiles.mk" noArgs="true">
319            <run>
320                <args>   [ double hyphen not allowed in comments - transpose -" to fix below ]
321                    <arg name=-"-sourcedir" value="${env.CLDR_DIR}/common/transforms" />
322                    <arg name=-"-destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
323                    <arg name=-"-commentSkip"/>
324                    <arg name=-"-writeIndex"/>
325                </args>
326            </run>
327        </cldr-build>
328    </target> -->
329    <target name="clean" depends="init, setup" description="deletes all txt files and mk files from coll and locales directories">
330        <delete>
331            <fileset id="locales" dir="${env.ICU4C_DIR}/source/data/locales">
332                <include name="*.txt" />
333            </fileset>
334            <fileset id="resfiles" dir="${env.ICU4C_DIR}/source/data/locales">
335                <include name="resfiles.mk" />
336            </fileset>
337            <fileset id="locales_split" dir="${env.ICU4C_DIR}/source/data">
338               <include name="curr/*.txt" /> 
339               <include name="curr/resfiles.mk" /> 
340               <include name="lang/*.txt" /> 
341               <include name="lang/resfiles.mk" /> 
342               <include name="region/*.txt" /> 
343               <include name="region/resfiles.mk" /> 
344               <include name="zone/*.txt" /> 
345               <include name="zone/resfiles.mk" /> 
346	    </fileset>
347            <fileset id="collation" dir="${env.ICU4C_DIR}/source/data/coll">
348                <include name="*.txt" />
349            </fileset>
350            <fileset id="colfiles" dir="${env.ICU4C_DIR}/source/data/coll">
351                <include name="colfiles.mk" />
352            </fileset>
353            <fileset id="translit" dir="${env.ICU4C_DIR}/source/data/translit">
354                <include name="*_*.txt" />
355                <include name="root.txt" />
356            </fileset>
357            <fileset id="brkitr" dir="${env.ICU4C_DIR}/source/data/brkitr">
358                <!-- brkitr directory contains bunch of txt files that are not produced by LDML2ICUConverter.
359                     So can't clean up everything. This needs to be updated when new files are added to xml/brkitr directory -->
360                <include name="root.txt" />
361                <include name="el.txt" />
362                <include name="en.txt" />
363                <include name="en_US.txt" />
364                <include name="en_US_POSIX.txt" />
365                <include name="fi.txt" />
366                <include name="ja.txt" />
367            </fileset>
368            <fileset id="brkfiles" dir="${env.ICU4C_DIR}/source/data/brkitr">
369                <include name="brkfiles.mk" />
370            </fileset>
371            <fileset id="supplementalData" dir="${env.ICU4C_DIR}/source/data/misc">
372                <include name="supplementalData.txt" />
373            </fileset>
374            <fileset id="rbnf" dir="${env.ICU4C_DIR}/source/data/rbnf">
375                <include name="*.txt" />
376            </fileset>
377            <fileset id="rbnffiles" dir="${env.ICU4C_DIR}/source/data/rbnf">
378                <include name="rbnffiles.mk" />
379            </fileset>
380            <fileset id="metadata" dir="${env.ICU4C_DIR}/source/data/misc">
381                <include name="metadata.txt" />
382            </fileset>
383            <fileset id="likelySubtags" dir="${env.ICU4C_DIR}/source/data/misc">
384                <include name="likelySubtags.txt" />
385            </fileset>
386            <fileset id="plurals" dir="${env.ICU4C_DIR}/source/data/misc">
387                <include name="plurals.txt" />
388            </fileset>
389            <fileset id="numberingSystems" dir="${env.ICU4C_DIR}/source/data/misc">
390                <include name="numberingSystems.txt" />
391            </fileset>
392            <fileset id="keyTypeData" dir="${env.ICU4C_DIR}/source/data/misc">
393                <include name="keyTypeData.txt" />
394                <include name="timezoneTypes.txt" />
395            </fileset>
396            <fileset id="genderList" dir="${env.ICU4C_DIR}/source/data/misc">
397                <include name="genderList.txt" />
398            </fileset>
399            <fileset id="postalCodeData" dir="${env.ICU4C_DIR}/source/data/misc">
400                <include name="postalCodeData.txt" />
401            </fileset>
402            <fileset id="dayPeriods" dir="${env.ICU4C_DIR}/source/data/misc">
403                <include name="dayPeriods.txt" />
404            </fileset>
405        </delete>
406    </target>
407</project>
408