Imported Upstream version 58.1
[platform/upstream/icu.git] / source / data / build.xml
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="--makefile" value="resfiles.mk"/>
112                 </args>
113                 <remapper>
114                   <remap sourcePath="/Keys" targetDir="lang" />
115                   <remap sourcePath="/Languages" targetDir="lang" />
116                   <remap sourcePath="/Languages%long" targetDir="lang" />
117                   <remap sourcePath="/Languages%short" targetDir="lang" />
118                   <remap sourcePath="/Languages%secondary" targetDir="lang" />
119                   <remap sourcePath="/Languages%variant" targetDir="lang" />
120                   <remap sourcePath="/Scripts" targetDir="lang" />
121                   <remap sourcePath="/Scripts%secondary" targetDir="lang" />
122                   <remap sourcePath="/Scripts%short" targetDir="lang" />
123                   <remap sourcePath="/Scripts%stand-alone" targetDir="lang" />
124                   <remap sourcePath="/Scripts%variant" targetDir="lang" />
125                   <remap sourcePath="/Types" targetDir="lang" />
126                   <remap sourcePath="/Types%short" targetDir="lang" />
127                   <remap sourcePath="/Variants" targetDir="lang" />
128                   <remap sourcePath="/Variants%secondary" targetDir="lang" />
129                   <remap sourcePath="/characterLabelPattern" targetDir="lang" />
130                   <remap sourcePath="/codePatterns" targetDir="lang" />
131                   <remap sourcePath="/localeDisplayPattern" targetDir="lang" />
132                   <remap sourcePath="/Countries" targetDir="region" />
133                   <remap sourcePath="/Countries%variant" targetDir="region" />
134                   <remap sourcePath="/Countries%short" targetDir="region" />
135                   <remap sourcePath="/Currencies" targetDir="curr" />
136                   <remap sourcePath="/Currencies%narrow" targetDir="curr" />
137                   <remap sourcePath="/Currencies%variant" targetDir="curr" />
138                   <remap sourcePath="/CurrencyPlurals" targetDir="curr" />
139                   <remap sourcePath="/CurrencyUnitPatterns" targetDir="curr" />
140                   <remap sourcePath="/currencySpacing" targetDir="curr" />
141                   <remap sourcePath="/zoneStrings" targetDir="zone" />
142                   <remap sourcePath="/durationUnits" targetDir="unit" />
143                   <remap sourcePath="/units" targetDir="unit" />
144                   <remap sourcePath="/unitsShort" targetDir="unit" />
145                   <remap sourcePath="/unitsNarrow" targetDir="unit" />
146                 </remapper>
147                 <!-- http://ant.apache.org/faq.html#xml-entity-include -->
148                 &icu-config;
149                         &icu-locale-deprecates;
150             </run>
151         </cldr-build>
152     </target>
153     <target name="collation" depends="init,setup" description="builds collation files in ICU text format">
154         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
155             <run>
156                 <args>
157                     <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/collation" />
158                     <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/coll"/>
159                     <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/collation"/>
160                     <arg name="--type"            value="collation"/>
161                     <arg name="--makefile" value="colfiles.mk"/>
162                 </args>
163                 <!-- http://ant.apache.org/faq.html#xml-entity-include -->
164                 &icu-config;
165                 &icu-coll-deprecates;
166             </run>
167         </cldr-build>
168     </target>
169     <target name="rbnf" depends="init,setup" description="builds rbnf files in ICU text format">
170         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
171             <run>
172                 <args>
173                     <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/rbnf" />
174                     <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/rbnf"/>
175                     <arg name="--specialsdir"     value="${env.ICU4C_DIR}/source/data/xml/rbnf"/>
176                     <arg name="--type" value="rbnf" />
177                     <arg name="--makefile" value="rbnffiles.mk"/>
178                 </args>
179                 <!-- http://ant.apache.org/faq.html#xml-entity-include -->
180                 &icu-config;
181                 &icu-rbnf-deprecates;
182             </run>
183         </cldr-build>
184     </target>
185     <target name="supplementalData" depends="init,setup" description="builds supplementalData.txt from supplementalData.xml">
186         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="supplementalData.txt" noArgs="true">
187             <!-- launch the tool and generate the data after reading the config file -->
188             <run>
189                 <args>
190                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
191                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
192                     <arg name="-t" value="supplementalData"/>
193                 </args>
194                 <remapper>
195                   <remap sourcePath="/CurrencyMap" targetDir="curr" />
196                   <remap sourcePath="/CurrencyMeta" targetDir="curr" />
197                 </remapper>
198             </run>
199         </cldr-build>
200     </target>
201     <target name="metadata" depends="init,setup" description="builds metadata.txt from supplementalMetadata.xml">
202         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="metadata.txt" noArgs="true">
203             <!-- launch the tool and generate the data after reading the config file -->
204             <run>
205                 <args>
206                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
207                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
208                     <arg name="-t" value="metadata"/>
209                 </args>
210             </run>
211         </cldr-build>
212     </target>
213     <target name="metaZones" depends="init,setup" description="builds metaZones.txt from metaZones.xml">
214         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="metaZones.txt" noArgs="true">
215             <!-- launch the tool and generate the data after reading the config file -->
216             <run>
217                 <args>
218                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
219                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
220                     <arg name="-t" value="metaZones"/>
221                 </args>
222             </run>
223         </cldr-build>
224     </target>
225     <target name="windowsZones" depends="init,setup" description="builds windowsZones.txt from windowsZones.xml">
226         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="windowsZones.txt" noArgs="true">
227             <!-- launch the tool and generate the data after reading the config file -->
228             <run>
229                 <args>
230                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
231                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
232                     <arg name="-t" value="windowsZones"/>
233                 </args>
234             </run>
235         </cldr-build>
236     </target>
237     <target name="likelySubtags" depends="init,setup" description="builds likelySubtags.txt from likelySubtags.xml">
238         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="likelySubtags.txt" noArgs="true">
239             <!-- launch the tool and generate the data after reading the config file -->
240             <run>
241                 <args>
242                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
243                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
244                     <arg name="-t" value="likelySubtags"/>
245                 </args>
246             </run>
247         </cldr-build>
248     </target>
249     <target name="plurals" depends="init,setup" description="builds plurals.txt from plurals.xml">
250         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="plurals.txt" noArgs="true">
251             <!-- launch the tool and generate the data after reading the config file -->
252             <run>
253                 <args>
254                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
255                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
256                     <arg name="-t" value="plurals"/>
257                 </args>
258             </run>
259         </cldr-build>
260     </target>
261     <target name="numberingSystems" depends="init,setup" description="builds numberingSystems.txt from numberingSystems.xml">
262         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="numberingSystems.txt" noArgs="true">
263             <!-- launch the tool and generate the data after reading the config file -->
264             <run>
265                 <args>
266                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
267                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
268                     <arg name="-t" value="numberingSystems"/>
269                 </args>
270             </run>
271         </cldr-build>
272     </target>
273     <target name="genderList" depends="init,setup" description="builds genderList.txt from genderList.xml">
274         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="genderList.txt" noArgs="true">
275             <!-- launch the tool and generate the data after reading the config file -->
276             <run>
277                 <args>
278                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
279                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
280                     <arg name="-t" value="genderList"/>
281                 </args>
282             </run>
283         </cldr-build>
284     </target>
285     <target name="dayPeriods" depends="init,setup" description="builds dayPeriods.txt from dayPeriods.xml">
286         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="dayPeriods.txt" noArgs="true">
287             <!-- launch the tool and generate the data after reading the config file -->
288             <run>
289                 <args>
290                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
291                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
292                     <arg name="-t" value="dayPeriods"/>
293                 </args>
294             </run>
295         </cldr-build>
296     </target>
297     <target name="brkitr" depends="init,setup" description="builds break iterator files in ICU text format">
298         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
299             <run>
300                 <args>
301                     <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/segments"/>
302                                         <arg name="--specialsdir"       value="${env.ICU4C_DIR}/source/data/xml/brkitr"/>
303                     <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/brkitr"/>
304                     <arg name="--type" value="brkitr" />
305                     <arg name="--makefile" value="brkfiles.mk"/>
306                 </args>
307                 <!-- The entity include is not required for this target -->
308                 <!-- http://ant.apache.org/faq.html#xml-entity-include
309                 &icu-config;
310                 -->
311             </run>
312         </cldr-build>
313     </target>
314
315     <target name="keyTypeData" depends="init,setup" description="builds keyTypeData.txt and timezoneTypes.txt from bcp47/*.xml">
316         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" noArgs="true">
317             <run>
318                 <args>
319                     <arg name="-s" value="${env.CLDR_DIR}/common/bcp47" />
320                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
321                     <arg name="-t" value="keyTypeData"/>
322                 </args>
323             </run>
324         </cldr-build>
325     </target>
326
327     <target name="translit" depends="init,setup" description="builds collation files in ICU text format">
328         <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile=".*txt">
329             <run>
330                 <args>
331                     <arg name="-m" value="((?!.*(Canadian|Ethiopic|ug-Latin).*).*)" />
332                     <arg name="--sourcedir" value="${env.CLDR_DIR}/common/transforms" />
333                     <arg name="--destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
334                     <arg name="--commentSkip"/>
335                 </args>
336                 <!-- http://ant.apache.org/faq.html#xml-entity-include -->
337
338             </run>
339         </cldr-build>
340     </target>
341     <!-- we don't generate en.txt or el.txt - so don't change trnsfiles.mk for now. -->
342 <!--   
343      <target name="trnsfiles" depends="init, setup" description="builds trnsfiles.mk">
344         <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile="trnsfiles.mk" noArgs="true">
345             <run>
346                 <args>   [ double hyphen not allowed in comments - transpose -" to fix below ]
347                     <arg name=-"-sourcedir" value="${env.CLDR_DIR}/common/transforms" />
348                     <arg name=-"-destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
349                     <arg name=-"-commentSkip"/>
350                     <arg name=-"-writeIndex"/>
351                 </args>
352             </run>
353         </cldr-build>
354     </target> -->
355     <target name="clean" depends="init, setup" description="deletes all txt files and mk files from coll and locales directories">
356         <delete>
357             <fileset id="locales" dir="${env.ICU4C_DIR}/source/data/locales">
358                 <include name="*.txt" />
359             </fileset>
360             <fileset id="resfiles" dir="${env.ICU4C_DIR}/source/data/locales">
361                 <include name="resfiles.mk" />
362             </fileset>
363             <fileset id="locales_split" dir="${env.ICU4C_DIR}/source/data">
364                <include name="curr/*.txt" /> 
365                <include name="curr/resfiles.mk" /> 
366                <include name="lang/*.txt" /> 
367                <include name="lang/resfiles.mk" /> 
368                <include name="region/*.txt" /> 
369                <include name="region/resfiles.mk" /> 
370                <include name="zone/*.txt" /> 
371                <include name="zone/resfiles.mk" /> 
372                <exclude name="zone/tzdbNames.txt" /> 
373                <include name="unit/*.txt" /> 
374                <include name="unit/resfiles.mk" /> 
375             </fileset>
376             <fileset id="collation" dir="${env.ICU4C_DIR}/source/data/coll">
377                 <include name="*.txt" />
378             </fileset>
379             <fileset id="colfiles" dir="${env.ICU4C_DIR}/source/data/coll">
380                 <include name="colfiles.mk" />
381             </fileset>
382             <fileset id="translit" dir="${env.ICU4C_DIR}/source/data/translit">
383                 <include name="*_*.txt" />
384                 <include name="root.txt" />
385             </fileset>
386             <fileset id="brkitr" dir="${env.ICU4C_DIR}/source/data/brkitr">
387                 <include name="*.txt"/>
388             </fileset>
389             <fileset id="brkfiles" dir="${env.ICU4C_DIR}/source/data/brkitr">
390                 <include name="brkfiles.mk" />
391             </fileset>
392             <fileset id="supplementalData" dir="${env.ICU4C_DIR}/source/data/misc">
393                 <include name="supplementalData.txt" />
394             </fileset>
395             <fileset id="rbnf" dir="${env.ICU4C_DIR}/source/data/rbnf">
396                 <include name="*.txt" />
397             </fileset>
398             <fileset id="rbnffiles" dir="${env.ICU4C_DIR}/source/data/rbnf">
399                 <include name="rbnffiles.mk" />
400             </fileset>
401             <fileset id="metadata" dir="${env.ICU4C_DIR}/source/data/misc">
402                 <include name="metadata.txt" />
403             </fileset>
404             <fileset id="metaZones" dir="${env.ICU4C_DIR}/source/data/misc">
405                 <include name="metaZones.txt" />
406             </fileset>
407             <fileset id="windowsZones" dir="${env.ICU4C_DIR}/source/data/misc">
408                 <include name="windowsZones.txt" />
409             </fileset>
410             <fileset id="likelySubtags" dir="${env.ICU4C_DIR}/source/data/misc">
411                 <include name="likelySubtags.txt" />
412             </fileset>
413             <fileset id="plurals" dir="${env.ICU4C_DIR}/source/data/misc">
414                 <include name="plurals.txt" />
415             </fileset>
416             <fileset id="numberingSystems" dir="${env.ICU4C_DIR}/source/data/misc">
417                 <include name="numberingSystems.txt" />
418             </fileset>
419             <fileset id="keyTypeData" dir="${env.ICU4C_DIR}/source/data/misc">
420                 <include name="keyTypeData.txt" />
421                 <include name="timezoneTypes.txt" />
422             </fileset>
423             <fileset id="genderList" dir="${env.ICU4C_DIR}/source/data/misc">
424                 <include name="genderList.txt" />
425             </fileset>
426             <fileset id="dayPeriods" dir="${env.ICU4C_DIR}/source/data/misc">
427                 <include name="dayPeriods.txt" />
428             </fileset>
429         </delete>
430     </target>
431 </project>