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