Home | History | Annotate | Download | only in data
      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, pluralRanges, 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"/>  <!-- Android patch: Use dataModifiers.txt filtering. -->
    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="pluralRanges" depends="init,setup" description="builds pluralRanges.txt from pluralRanges.xml">
    263         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="pluralRanges.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="pluralRanges"/>
    270                 </args>
    271             </run>
    272         </cldr-build>
    273     </target>
    274     <target name="numberingSystems" depends="init,setup" description="builds numberingSystems.txt from numberingSystems.xml">
    275         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="numberingSystems.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="numberingSystems"/>
    282                 </args>
    283             </run>
    284         </cldr-build>
    285     </target>
    286     <target name="genderList" depends="init,setup" description="builds genderList.txt from genderList.xml">
    287         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="genderList.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="genderList"/>
    294                 </args>
    295             </run>
    296         </cldr-build>
    297     </target>
    298     <target name="dayPeriods" depends="init,setup" description="builds dayPeriods.txt from dayPeriods.xml">
    299         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" destFile="dayPeriods.txt" noArgs="true">
    300             <!-- launch the tool and generate the data after reading the config file -->
    301             <run>
    302                 <args>
    303                     <arg name="-s" value="${env.CLDR_DIR}/common/supplemental" />
    304                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
    305                     <arg name="-t" value="dayPeriods"/>
    306                 </args>
    307             </run>
    308         </cldr-build>
    309     </target>
    310     <target name="brkitr" depends="init,setup" description="builds break iterator files in ICU text format">
    311         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" srcFile=".*xml" destFile=".*txt">
    312             <run>
    313                 <args>
    314                     <arg name="--sourcedir"       value="${env.CLDR_DIR}/common/segments"/>
    315 					<arg name="--specialsdir"       value="${env.ICU4C_DIR}/source/data/xml/brkitr"/>
    316                     <arg name="--destdir"         value="${env.ICU4C_DIR}/source/data/brkitr"/>
    317                     <arg name="--type" value="brkitr" />
    318                     <arg name="--makefile" value="brkfiles.mk"/>
    319                 </args>
    320                 <!-- The entity include is not required for this target -->
    321                 <!-- http://ant.apache.org/faq.html#xml-entity-include
    322                 &icu-config;
    323                 -->
    324             </run>
    325         </cldr-build>
    326     </target>
    327 
    328     <target name="keyTypeData" depends="init,setup" description="builds keyTypeData.txt and timezoneTypes.txt from bcp47/*.xml">
    329         <cldr-build toolName="org.unicode.cldr.icu.NewLdml2IcuConverter" noArgs="true">
    330             <run>
    331                 <args>
    332                     <arg name="-s" value="${env.CLDR_DIR}/common/bcp47" />
    333                     <arg name="-d" value="${env.ICU4C_DIR}/source/data/misc"/>
    334                     <arg name="-t" value="keyTypeData"/>
    335                 </args>
    336             </run>
    337         </cldr-build>
    338     </target>
    339 
    340     <target name="translit" depends="init,setup" description="builds collation files in ICU text format">
    341         <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile=".*txt">
    342             <run>
    343                 <args>
    344                     <arg name="-m" value="((?!.*(Canadian|Ethiopic|ug-Latin).*).*)" />
    345                     <arg name="--sourcedir" value="${env.CLDR_DIR}/common/transforms" />
    346                     <arg name="--destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
    347                     <arg name="--commentSkip"/>
    348                     <arg name="--approvedOnly"/>
    349                 </args>
    350                 <!-- http://ant.apache.org/faq.html#xml-entity-include -->
    351 
    352             </run>
    353         </cldr-build>
    354     </target>
    355     <!-- we don't generate en.txt or el.txt - so don't change trnsfiles.mk for now. -->
    356 <!--   
    357      <target name="trnsfiles" depends="init, setup" description="builds trnsfiles.mk">
    358         <cldr-build toolName="org.unicode.cldr.icu.ConvertTransforms" srcFile=".*xml" destFile="trnsfiles.mk" noArgs="true">
    359             <run>
    360                 <args>   [ double hyphen not allowed in comments - transpose -" to fix below ]
    361                     <arg name=-"-sourcedir" value="${env.CLDR_DIR}/common/transforms" />
    362                     <arg name=-"-destdir"   value="${env.ICU4C_DIR}/source/data/translit"/>
    363                     <arg name=-"-commentSkip"/>
    364                     <arg name=-"-writeIndex"/>
    365                 </args>
    366             </run>
    367         </cldr-build>
    368     </target> -->
    369     <target name="clean" depends="init, setup" description="deletes all txt files and mk files from coll and locales directories">
    370         <delete>
    371             <fileset id="locales" dir="${env.ICU4C_DIR}/source/data/locales">
    372                 <include name="*.txt" />
    373             </fileset>
    374             <fileset id="resfiles" dir="${env.ICU4C_DIR}/source/data/locales">
    375                 <include name="resfiles.mk" />
    376             </fileset>
    377             <fileset id="locales_split" dir="${env.ICU4C_DIR}/source/data">
    378                <include name="curr/*.txt" /> 
    379                <include name="curr/resfiles.mk" /> 
    380                <include name="lang/*.txt" /> 
    381                <include name="lang/resfiles.mk" /> 
    382                <include name="region/*.txt" /> 
    383                <include name="region/resfiles.mk" /> 
    384                <include name="zone/*.txt" /> 
    385                <include name="zone/resfiles.mk" /> 
    386                <exclude name="zone/tzdbNames.txt" /> 
    387                <include name="unit/*.txt" /> 
    388                <include name="unit/resfiles.mk" /> 
    389 	    </fileset>
    390             <fileset id="collation" dir="${env.ICU4C_DIR}/source/data/coll">
    391                 <include name="*.txt" />
    392             </fileset>
    393             <fileset id="colfiles" dir="${env.ICU4C_DIR}/source/data/coll">
    394                 <include name="colfiles.mk" />
    395             </fileset>
    396             <fileset id="translit" dir="${env.ICU4C_DIR}/source/data/translit">
    397                 <include name="*_*.txt" />
    398                 <include name="root.txt" />
    399             </fileset>
    400             <fileset id="brkitr" dir="${env.ICU4C_DIR}/source/data/brkitr">
    401                 <include name="*.txt"/>
    402             </fileset>
    403             <fileset id="brkfiles" dir="${env.ICU4C_DIR}/source/data/brkitr">
    404                 <include name="brkfiles.mk" />
    405             </fileset>
    406             <fileset id="supplementalData" dir="${env.ICU4C_DIR}/source/data/misc">
    407                 <include name="supplementalData.txt" />
    408             </fileset>
    409             <fileset id="rbnf" dir="${env.ICU4C_DIR}/source/data/rbnf">
    410                 <include name="*.txt" />
    411             </fileset>
    412             <fileset id="rbnffiles" dir="${env.ICU4C_DIR}/source/data/rbnf">
    413                 <include name="rbnffiles.mk" />
    414             </fileset>
    415             <fileset id="metadata" dir="${env.ICU4C_DIR}/source/data/misc">
    416                 <include name="metadata.txt" />
    417             </fileset>
    418             <fileset id="metaZones" dir="${env.ICU4C_DIR}/source/data/misc">
    419                 <include name="metaZones.txt" />
    420             </fileset>
    421             <fileset id="windowsZones" dir="${env.ICU4C_DIR}/source/data/misc">
    422                 <include name="windowsZones.txt" />
    423             </fileset>
    424             <fileset id="likelySubtags" dir="${env.ICU4C_DIR}/source/data/misc">
    425                 <include name="likelySubtags.txt" />
    426             </fileset>
    427             <fileset id="plurals" dir="${env.ICU4C_DIR}/source/data/misc">
    428                 <include name="plurals.txt" />
    429             </fileset>
    430             <fileset id="pluralRanges" dir="${env.ICU4C_DIR}/source/data/misc">
    431                 <include name="pluralRanges.txt" />
    432             </fileset>
    433             <fileset id="numberingSystems" dir="${env.ICU4C_DIR}/source/data/misc">
    434                 <include name="numberingSystems.txt" />
    435             </fileset>
    436             <fileset id="keyTypeData" dir="${env.ICU4C_DIR}/source/data/misc">
    437                 <include name="keyTypeData.txt" />
    438                 <include name="timezoneTypes.txt" />
    439             </fileset>
    440             <fileset id="genderList" dir="${env.ICU4C_DIR}/source/data/misc">
    441                 <include name="genderList.txt" />
    442             </fileset>
    443             <fileset id="dayPeriods" dir="${env.ICU4C_DIR}/source/data/misc">
    444                 <include name="dayPeriods.txt" />
    445             </fileset>
    446         </delete>
    447     </target>
    448 </project>
    449