12e5b6d6dSopenharmony_ci<!-- © 2019 and later: Unicode, Inc. and others.
22e5b6d6dSopenharmony_ci     License & terms of use: http://www.unicode.org/copyright.html -->
32e5b6d6dSopenharmony_ci
42e5b6d6dSopenharmony_ci<!--================================================================================
52e5b6d6dSopenharmony_ci    Setup:
62e5b6d6dSopenharmony_ci    Follow the installation instructions in README.txt in this directory.
72e5b6d6dSopenharmony_ci
82e5b6d6dSopenharmony_ci    To build ICU data files:
92e5b6d6dSopenharmony_ci    1: Determine the CLDR base directory and set the CLDR_DIR environment variable.
102e5b6d6dSopenharmony_ci    2: Determine the flags required (see the list of properties below).
112e5b6d6dSopenharmony_ci    3: Run: ant -f build-icu-data.xml -D<flag-name>=<flag-value>...
122e5b6d6dSopenharmony_ci    ================================================================================-->
132e5b6d6dSopenharmony_ci<!-- TODO: Add things like copying of a template directory and deleting previous files
142e5b6d6dSopenharmony_ci     (perhaps always generate into a temporary directory and copy back to avoid having
152e5b6d6dSopenharmony_ci      inconsistent state when the conversion is cancelled). -->
162e5b6d6dSopenharmony_ci<project name="Convert" default="all" basedir="." xmlns:if="ant:if" xmlns:unless="ant:unless">
172e5b6d6dSopenharmony_ci
182e5b6d6dSopenharmony_ci    <target name="all" depends="init-args, prepare-jar, clean, convert"/>
192e5b6d6dSopenharmony_ci
202e5b6d6dSopenharmony_ci    <!-- Initialize the properties which were not already set on the command line. -->
212e5b6d6dSopenharmony_ci    <target name="init-args">
222e5b6d6dSopenharmony_ci        <property environment="env"/>
232e5b6d6dSopenharmony_ci        <!-- Inherit properties from environment variable unless specified. As usual
242e5b6d6dSopenharmony_ci             with Ant, this is messier than it should be. All we are saying here is:
252e5b6d6dSopenharmony_ci             "Use the property if explicitly set, otherwise use the environment variable."
262e5b6d6dSopenharmony_ci             We cannot just set the property to the environment variable, since expansion
272e5b6d6dSopenharmony_ci             fails for non existent properties, and you are left with a literal value of
282e5b6d6dSopenharmony_ci             "${env.CLDR_DATA_DIR}". -->
292e5b6d6dSopenharmony_ci        <condition property="cldrDataDir" value="${env.CLDR_DATA_DIR}">
302e5b6d6dSopenharmony_ci            <isset property="env.CLDR_DATA_DIR"/>
312e5b6d6dSopenharmony_ci        </condition>
322e5b6d6dSopenharmony_ci        <fail unless="cldrDataDir"
332e5b6d6dSopenharmony_ci              message="Set the CLDR_DATA_DIR environment variable (or cldrDataDir property) to the CLDR data directory (typically ending in '/production')"/>
342e5b6d6dSopenharmony_ci
352e5b6d6dSopenharmony_ci        <!-- Ant does not inherit this from the user's environment (and it can matter).
362e5b6d6dSopenharmony_ci             This is only needed because we have to "exec" a new Ant task below. -->
372e5b6d6dSopenharmony_ci        <condition property="javaHome" value="${env.JAVA_HOME}">
382e5b6d6dSopenharmony_ci            <isset property="env.JAVA_HOME"/>
392e5b6d6dSopenharmony_ci        </condition>
402e5b6d6dSopenharmony_ci
412e5b6d6dSopenharmony_ci        <!-- The output directory into which to write the converted ICU data. By default
422e5b6d6dSopenharmony_ci             this will overwrite (without deletion) the ICU data files in this ICU release,
432e5b6d6dSopenharmony_ci             so it is recommended that for testing, it be set to another value.  -->
442e5b6d6dSopenharmony_ci        <property name="outDir" value="${basedir}/../../../icu4c/source/data/"/>
452e5b6d6dSopenharmony_ci
462e5b6d6dSopenharmony_ci        <!-- The output directory into which to write generated C/C++ code.  By default
472e5b6d6dSopenharmony_ci             this will overwrite (without deletion) the generated C/C++ files in this
482e5b6d6dSopenharmony_ci             ICU release, so it is recommended that for testing, it be set to another value. -->
492e5b6d6dSopenharmony_ci        <property name="genCCodeDir" value="${basedir}/../../../icu4c/source/"/>
502e5b6d6dSopenharmony_ci
512e5b6d6dSopenharmony_ci        <!-- The output directory into which to write generated Java code.  By default
522e5b6d6dSopenharmony_ci             this will overwrite (without deletion) the generated Java files in this
532e5b6d6dSopenharmony_ci             ICU release, so it is recommended that for testing, it be set to another value. -->
542e5b6d6dSopenharmony_ci        <property name="genJavaCodeDir" value="${basedir}/../../../icu4j/main/classes/core"/>
552e5b6d6dSopenharmony_ci        
562e5b6d6dSopenharmony_ci        <!-- Set this to true to prevent build-icu-data.xml from generating the generated
572e5b6d6dSopenharmony_ci             ICU source files -->
582e5b6d6dSopenharmony_ci        <property name="dontGenCode" value="false" />
592e5b6d6dSopenharmony_ci
602e5b6d6dSopenharmony_ci        <!-- The directory in which the additional ICU XML data is stored. -->
612e5b6d6dSopenharmony_ci        <property name="specialsDir" value="${basedir}/../../../icu4c/source/data/xml"/>
622e5b6d6dSopenharmony_ci
632e5b6d6dSopenharmony_ci        <!-- Default value for ICU version (icuver.txt). Update this for each release. -->
642e5b6d6dSopenharmony_ci        <property name="icuVersion" value="72.1.0.0"/>
652e5b6d6dSopenharmony_ci
662e5b6d6dSopenharmony_ci        <!-- Default value for ICU data version (icuver.txt). Update this for each release. -->
672e5b6d6dSopenharmony_ci        <property name="icuDataVersion" value="72.1.0.0"/>
682e5b6d6dSopenharmony_ci
692e5b6d6dSopenharmony_ci        <!-- An override for the CLDR version string (icuver.txt and others). This will be
702e5b6d6dSopenharmony_ci             extracted from the CLDR library used for building the data if not set here. -->
712e5b6d6dSopenharmony_ci        <property name="cldrVersion" value=""/>
722e5b6d6dSopenharmony_ci
732e5b6d6dSopenharmony_ci        <!-- The minimum draft status for CLDR data to be used in the conversion. See
742e5b6d6dSopenharmony_ci             CldrDraftStatus for more details. -->
752e5b6d6dSopenharmony_ci        <property name="minDraftStatus" value="contributed"/>
762e5b6d6dSopenharmony_ci
772e5b6d6dSopenharmony_ci        <!-- A regular expression to match the locale IDs to be generated (useful for
782e5b6d6dSopenharmony_ci             debugging specific regions). This is applied after locale ID specifications
792e5b6d6dSopenharmony_ci             have been expanded into full locale IDs, so the value "en" will NOT match
802e5b6d6dSopenharmony_ci             "en_GB" or "en_001" etc. -->
812e5b6d6dSopenharmony_ci        <property name="localeIdFilter" value=""/>
822e5b6d6dSopenharmony_ci
832e5b6d6dSopenharmony_ci        <!-- Whether to synthetically generate "pseudo locale" data ("en_XA" and "ar_XB"). -->
842e5b6d6dSopenharmony_ci        <property name="includePseudoLocales" value="false"/>
852e5b6d6dSopenharmony_ci
862e5b6d6dSopenharmony_ci        <!-- Whether to emit a debug report containing some possibly useful information after
872e5b6d6dSopenharmony_ci             the conversion has finished. -->
882e5b6d6dSopenharmony_ci        <!-- TODO: Currently this isn't hugely useful, so find out what people want. -->
892e5b6d6dSopenharmony_ci        <property name="emitReport" value="false"/>
902e5b6d6dSopenharmony_ci
912e5b6d6dSopenharmony_ci        <!-- List of output "types" to be generated (e.g. "rbnf,plurals,locales"); an empty
922e5b6d6dSopenharmony_ci             list means "build everything".
932e5b6d6dSopenharmony_ci
942e5b6d6dSopenharmony_ci             Note that the grouping of types is based on the legacy converter behaviour and
952e5b6d6dSopenharmony_ci             is not always directly associated with an output directory (e.g. "locales"
962e5b6d6dSopenharmony_ci             produces locale data for curr/, lang/, main/, region/, unit/, zone/ but NOT
972e5b6d6dSopenharmony_ci             coll/, brkitr/ or rbnf/).
982e5b6d6dSopenharmony_ci
992e5b6d6dSopenharmony_ci             Pass in the value "HELP" (or any invalid value) to see the full list of types. -->
1002e5b6d6dSopenharmony_ci        <!-- TODO: Find out what common use cases are and use them. -->
1012e5b6d6dSopenharmony_ci        <property name="outputTypes" value=""/>
1022e5b6d6dSopenharmony_ci
1032e5b6d6dSopenharmony_ci        <!-- Override to force the 'clean' task to delete files it cannot determine to be
1042e5b6d6dSopenharmony_ci             auto-generated by this tool. This is useful if the file header changes since
1052e5b6d6dSopenharmony_ci             the heading is what's used to recognize auto-generated files. -->
1062e5b6d6dSopenharmony_ci        <property name="forceDelete" value="false"/>
1072e5b6d6dSopenharmony_ci    </target>
1082e5b6d6dSopenharmony_ci
1092e5b6d6dSopenharmony_ci    <!-- Build a standalone JAR which is called by Ant (and which avoids needing to mess
1102e5b6d6dSopenharmony_ci         about making Ant know the Maven class-path). -->
1112e5b6d6dSopenharmony_ci    <target name="prepare-jar" depends="init-args">
1122e5b6d6dSopenharmony_ci        <exec executable="mvn" searchpath="true" failonerror="true">
1132e5b6d6dSopenharmony_ci            <arg value="compile"/>
1142e5b6d6dSopenharmony_ci        </exec>
1152e5b6d6dSopenharmony_ci    </target>
1162e5b6d6dSopenharmony_ci
1172e5b6d6dSopenharmony_ci    <!-- Somewhat hacky wrapper target which invokes the real conversion task.
1182e5b6d6dSopenharmony_ci         This is done so we can set the environment variable of the new process and
1192e5b6d6dSopenharmony_ci         effectively overwrite the CLDR_DIR value. If ever the CLDR library doesn't
1202e5b6d6dSopenharmony_ci         need to use CLDR_DIR at runtime to find the production data, this can all be
1212e5b6d6dSopenharmony_ci         removed. -->
1222e5b6d6dSopenharmony_ci    <target name="convert" depends="init-args, prepare-jar">
1232e5b6d6dSopenharmony_ci        <exec executable="ant" searchpath="true" failonerror="true">
1242e5b6d6dSopenharmony_ci            <!-- The CLDR library wants CLDR_DIR set, to the data directory. -->
1252e5b6d6dSopenharmony_ci            <env key="CLDR_DIR" value="${cldrDataDir}" />
1262e5b6d6dSopenharmony_ci            <!-- Force inherit JAVA_HOME (this can be important). -->
1272e5b6d6dSopenharmony_ci            <env key="JAVA_HOME" value="${javaHome}" />
1282e5b6d6dSopenharmony_ci            <!-- Initial Ant command line with all the "interesting" bit in. -->
1292e5b6d6dSopenharmony_ci            <arg line="-f build-icu-data.xml convert-impl -DcldrDir=${cldrDataDir}"/>
1302e5b6d6dSopenharmony_ci            <!-- List all properties in the "convert-impl" task (except cldrDir). -->
1312e5b6d6dSopenharmony_ci            <arg value="-DoutDir=${outDir}"/>
1322e5b6d6dSopenharmony_ci            <arg value="-DgenCCodeDir=${genCCodeDir}"/>
1332e5b6d6dSopenharmony_ci            <arg value="-DgenJavaCodeDir=${genJavaCodeDir}"/>
1342e5b6d6dSopenharmony_ci            <arg value="-DdontGenCode=${dontGenCode}"/>
1352e5b6d6dSopenharmony_ci            <arg value="-DspecialsDir=${specialsDir}"/>
1362e5b6d6dSopenharmony_ci            <arg value="-DoutputTypes=${outputTypes}"/>
1372e5b6d6dSopenharmony_ci            <arg value="-DicuVersion=${icuVersion}"/>
1382e5b6d6dSopenharmony_ci            <arg value="-DicuDataVersion=${icuDataVersion}"/>
1392e5b6d6dSopenharmony_ci            <arg value="-DcldrVersion=${cldrVersion}"/>
1402e5b6d6dSopenharmony_ci            <arg value="-DminDraftStatus=${minDraftStatus}"/>
1412e5b6d6dSopenharmony_ci            <arg value="-DlocaleIdFilter=${localeIdFilter}"/>
1422e5b6d6dSopenharmony_ci            <arg value="-DincludePseudoLocales=${includePseudoLocales}"/>
1432e5b6d6dSopenharmony_ci            <arg value="-DemitReport=${emitReport}"/>
1442e5b6d6dSopenharmony_ci        </exec>
1452e5b6d6dSopenharmony_ci    </target>
1462e5b6d6dSopenharmony_ci
1472e5b6d6dSopenharmony_ci    <!-- Do the actual CLDR data conversion, based on the command line arguments, built in
1482e5b6d6dSopenharmony_ci         default properties and the configuration in the "<convert>" element below. -->
1492e5b6d6dSopenharmony_ci    <target name="convert-impl">
1502e5b6d6dSopenharmony_ci        <taskdef name="convert" classname="org.unicode.icu.tool.cldrtoicu.ant.ConvertIcuDataTask">
1512e5b6d6dSopenharmony_ci            <classpath>
1522e5b6d6dSopenharmony_ci                <pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
1532e5b6d6dSopenharmony_ci            </classpath>
1542e5b6d6dSopenharmony_ci        </taskdef>
1552e5b6d6dSopenharmony_ci        <taskdef name="generateCode" classname="org.unicode.icu.tool.cldrtoicu.ant.GenerateCodeTask">
1562e5b6d6dSopenharmony_ci            <classpath>
1572e5b6d6dSopenharmony_ci                <pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
1582e5b6d6dSopenharmony_ci            </classpath>
1592e5b6d6dSopenharmony_ci        </taskdef>
1602e5b6d6dSopenharmony_ci        <convert cldrDir="${cldrDir}" outputDir="${outDir}" specialsDir="${specialsDir}"
1612e5b6d6dSopenharmony_ci                 outputTypes="${outputTypes}" cldrVersion="${cldrVersion}"
1622e5b6d6dSopenharmony_ci                 icuVersion="${icuVersion}" icuDataVersion="${icuDataVersion}"
1632e5b6d6dSopenharmony_ci                 minimalDraftStatus="${minDraftStatus}" localeIdFilter="${localeIdFilter}"
1642e5b6d6dSopenharmony_ci                 includePseudoLocales="${includePseudoLocales}" emitReport="${emitReport}">
1652e5b6d6dSopenharmony_ci
1662e5b6d6dSopenharmony_ci            <!-- The primary set of locale IDs to be generated by default. The IDs in this list are
1672e5b6d6dSopenharmony_ci                 automatically expanded to include default scripts and all available regions. The
1682e5b6d6dSopenharmony_ci                 rules are:
1692e5b6d6dSopenharmony_ci
1702e5b6d6dSopenharmony_ci                 1) Base languages are expanded to include default scripts (e.g. "en" -> "en_Latn").
1712e5b6d6dSopenharmony_ci                 2) All region and variant subtags are added for any base language or language+script
1722e5b6d6dSopenharmony_ci                    (e.g. "en" -> "en_GB" or "shi_Latn" -> "shi_Latn_MA").
1732e5b6d6dSopenharmony_ci
1742e5b6d6dSopenharmony_ci                 If a non-default script is desired it should be listed explicitly (e.g. "sr_Latn").
1752e5b6d6dSopenharmony_ci
1762e5b6d6dSopenharmony_ci                 Locale IDs with deprecated subtags (which become aliases) must still be listed in
1772e5b6d6dSopenharmony_ci                 full (e.g. "en_RH" or "sr_Latn_YU").
1782e5b6d6dSopenharmony_ci            -->
1792e5b6d6dSopenharmony_ci            <localeIds>
1802e5b6d6dSopenharmony_ci                // A
1812e5b6d6dSopenharmony_ci                af, agq, ak, am, ar, ars, as, asa, ast, az, az_AZ, az_Cyrl
1822e5b6d6dSopenharmony_ci
1832e5b6d6dSopenharmony_ci                // B
1842e5b6d6dSopenharmony_ci                bas, be, bem, bez, bg, bgc, bho, bm, bn, bo, br, brx, bs, bs_BA, bs_Cyrl
1852e5b6d6dSopenharmony_ci
1862e5b6d6dSopenharmony_ci                // C
1872e5b6d6dSopenharmony_ci                ca, ccp, ce, ceb, cgg, chr, ckb, cs, cv, cy
1882e5b6d6dSopenharmony_ci
1892e5b6d6dSopenharmony_ci                // D
1902e5b6d6dSopenharmony_ci                da, dav, de, dje, doi, dsb, dua, dyo, dz
1912e5b6d6dSopenharmony_ci
1922e5b6d6dSopenharmony_ci                // E
1932e5b6d6dSopenharmony_ci                ebu, ee, el, en, en_NH, en_RH, eo, es, et, eu, ewo
1942e5b6d6dSopenharmony_ci
1952e5b6d6dSopenharmony_ci                // F
1962e5b6d6dSopenharmony_ci                fa, ff, ff_Adlm, ff_CM, ff_GN, ff_MR, ff_SN, fi, fil, fo, fr, fur, fy
1972e5b6d6dSopenharmony_ci
1982e5b6d6dSopenharmony_ci                // G
1992e5b6d6dSopenharmony_ci                ga, gd, gl, gsw, gu, guz, gv
2002e5b6d6dSopenharmony_ci
2012e5b6d6dSopenharmony_ci                // H
2022e5b6d6dSopenharmony_ci                ha, haw, he, hi, hi_Latn, hr, hsb, hu, hy
2032e5b6d6dSopenharmony_ci
2042e5b6d6dSopenharmony_ci                // I
2052e5b6d6dSopenharmony_ci                ia, id, ig, ii, in, in_ID, is, it, iw, iw_IL
2062e5b6d6dSopenharmony_ci
2072e5b6d6dSopenharmony_ci                // J
2082e5b6d6dSopenharmony_ci                ja, jgo, jmc, jv
2092e5b6d6dSopenharmony_ci
2102e5b6d6dSopenharmony_ci                // K
2112e5b6d6dSopenharmony_ci                ka, kab, kam, kde, kea, kgp, khq, ki, kk, kkj, kl, kln, km, kn, ko, kok, ks
2122e5b6d6dSopenharmony_ci                ks_Deva, ks_IN, ksb, ksf, ksh, ku, kw, ky
2132e5b6d6dSopenharmony_ci
2142e5b6d6dSopenharmony_ci                // L
2152e5b6d6dSopenharmony_ci                lag, lb, lg, lkt, ln, lo, lrc, lt, lu, luo, luy, lv
2162e5b6d6dSopenharmony_ci
2172e5b6d6dSopenharmony_ci                // M
2182e5b6d6dSopenharmony_ci                mai, mas, mer, mfe, mg, mgh, mgo, mi, mk, ml, mn, mni, mni_IN, mo, mr, ms
2192e5b6d6dSopenharmony_ci                mt, mua, my, mzn
2202e5b6d6dSopenharmony_ci
2212e5b6d6dSopenharmony_ci                // N
2222e5b6d6dSopenharmony_ci                naq, nb, nd, ne, nl, nmg, nn, nnh, no, no_NO, no_NO_NY, nus, nyn
2232e5b6d6dSopenharmony_ci
2242e5b6d6dSopenharmony_ci                // O
2252e5b6d6dSopenharmony_ci                om, or, os
2262e5b6d6dSopenharmony_ci
2272e5b6d6dSopenharmony_ci                // P
2282e5b6d6dSopenharmony_ci                pa, pa_Arab, pa_IN, pa_PK, pcm, pl, ps, pt
2292e5b6d6dSopenharmony_ci
2302e5b6d6dSopenharmony_ci                // Q
2312e5b6d6dSopenharmony_ci                qu
2322e5b6d6dSopenharmony_ci
2332e5b6d6dSopenharmony_ci                // R
2342e5b6d6dSopenharmony_ci                raj, rm, rn, ro, rof, ru, rw, rwk
2352e5b6d6dSopenharmony_ci
2362e5b6d6dSopenharmony_ci                // S
2372e5b6d6dSopenharmony_ci                sa, sah, saq, sat, sat_IN, sbp, sc, sd, sd_Deva, sd_IN, sd_PK, se, seh, ses, sg, sh, sh_BA, sh_CS, sh_YU
2382e5b6d6dSopenharmony_ci                shi, shi_Latn, shi_MA, si, sk, sl, smn, sn, so, sq, sr, sr_BA, sr_CS, sr_Cyrl_CS, sr_Cyrl_YU, sr_Latn
2392e5b6d6dSopenharmony_ci                sr_Latn_CS, sr_Latn_YU, sr_ME, sr_RS, sr_XK, sr_YU, su, su_ID, sv, sw
2402e5b6d6dSopenharmony_ci
2412e5b6d6dSopenharmony_ci                // T
2422e5b6d6dSopenharmony_ci                ta, te, teo, tg, th, ti, tk, tl, tl_PH, to, tr, tt, twq, tzm
2432e5b6d6dSopenharmony_ci
2442e5b6d6dSopenharmony_ci                // U
2452e5b6d6dSopenharmony_ci                ug, uk, ur, uz, uz_AF, uz_Arab, uz_Cyrl, uz_UZ
2462e5b6d6dSopenharmony_ci
2472e5b6d6dSopenharmony_ci                // V
2482e5b6d6dSopenharmony_ci                vai, vai_LR, vai_Latn, vi, vun
2492e5b6d6dSopenharmony_ci
2502e5b6d6dSopenharmony_ci                // W
2512e5b6d6dSopenharmony_ci                wae, wo
2522e5b6d6dSopenharmony_ci
2532e5b6d6dSopenharmony_ci                // X
2542e5b6d6dSopenharmony_ci                xh, xog
2552e5b6d6dSopenharmony_ci
2562e5b6d6dSopenharmony_ci                // Y
2572e5b6d6dSopenharmony_ci                yav, yi, yo, yrl, yue, yue_CN, yue_HK, yue_Hans
2582e5b6d6dSopenharmony_ci
2592e5b6d6dSopenharmony_ci                // Z
2602e5b6d6dSopenharmony_ci                zgh, zh, zh_CN, zh_HK, zh_Hant, zh_MO, zh_SG, zh_TW, zu
2612e5b6d6dSopenharmony_ci            </localeIds>
2622e5b6d6dSopenharmony_ci
2632e5b6d6dSopenharmony_ci            <!-- The following elements configure directories in which a subset of the available
2642e5b6d6dSopenharmony_ci                 locales IDs should be generated. Unlike the main <localeId> element, these
2652e5b6d6dSopenharmony_ci                 filters must specify all locale IDs in full (but since they mostly select base
2662e5b6d6dSopenharmony_ci                 languages, this isn't a big deal).
2672e5b6d6dSopenharmony_ci
2682e5b6d6dSopenharmony_ci                 As well as allowing some data directories to have a subset of available data (via
2692e5b6d6dSopenharmony_ci                 the <localeIds> element) there are also mechanisms for controlling aliasing and
2702e5b6d6dSopenharmony_ci                 the locale parent relation which allows the sharing of some ICU data in cases
2712e5b6d6dSopenharmony_ci                 where it would otherwise need to be copied. The two mechanisms are:
2722e5b6d6dSopenharmony_ci
2732e5b6d6dSopenharmony_ci                 1: inheritLanguageSubtag: Used to rewrite the parent of a locale ID from "root" to
2742e5b6d6dSopenharmony_ci                    its language subtag (e.g. "zh_Hant" has a natural parent of "root", but to allow
2752e5b6d6dSopenharmony_ci                    some base language data to be shared it can be made to have a parent of "zh").
2762e5b6d6dSopenharmony_ci
2772e5b6d6dSopenharmony_ci                 2: forcedAlias: Used to add aliases for specific directories in order to affect the
2782e5b6d6dSopenharmony_ci                    ICU behaviour in special cases.
2792e5b6d6dSopenharmony_ci
2802e5b6d6dSopenharmony_ci                 Between them these mechanisms are known as "tailorings" of the affected locales. -->
2812e5b6d6dSopenharmony_ci            <!-- TODO: Explain why these special cases are needed/different. -->
2822e5b6d6dSopenharmony_ci
2832e5b6d6dSopenharmony_ci            <!-- Collation data is large, but also more sharable than other data, which is why there
2842e5b6d6dSopenharmony_ci                 are a number of aliases and parent remappings for this directory. -->
2852e5b6d6dSopenharmony_ci            <directory dir="coll" inheritLanguageSubtag="bs_Cyrl, sr_Latn, zh_Hant">
2862e5b6d6dSopenharmony_ci                <!-- These aliases are to avoid needing to copy and maintain the same collation data
2872e5b6d6dSopenharmony_ci                     for "zh" and "yue". The maximized versions of "yue_Hans" is "yue_Hans_CN" (vs
2882e5b6d6dSopenharmony_ci                     "zh_Hans_CN"), and for "yue" it's "yue_Hant_HK" (vs "zh_Hant_HK"), so the
2892e5b6d6dSopenharmony_ci                     aliases are effectively just rewriting the base language. -->
2902e5b6d6dSopenharmony_ci                <forcedAlias source="yue" target="zh_Hant"/>
2912e5b6d6dSopenharmony_ci                <forcedAlias source="yue_Hant" target="zh_Hant"/>
2922e5b6d6dSopenharmony_ci                <forcedAlias source="yue_CN" target="zh_Hans"/>
2932e5b6d6dSopenharmony_ci                <forcedAlias source="yue_Hans" target="zh_Hans"/>
2942e5b6d6dSopenharmony_ci                <forcedAlias source="yue_Hans_CN" target="zh_Hans"/>
2952e5b6d6dSopenharmony_ci
2962e5b6d6dSopenharmony_ci                <!-- TODO: Find out and document this properly. -->
2972e5b6d6dSopenharmony_ci                <forcedAlias source="sr_ME" target="sr_Cyrl_ME"/>
2982e5b6d6dSopenharmony_ci
2992e5b6d6dSopenharmony_ci                <localeIds>
3002e5b6d6dSopenharmony_ci                    root,
3012e5b6d6dSopenharmony_ci
3022e5b6d6dSopenharmony_ci                    // A-B
3032e5b6d6dSopenharmony_ci                    af, am, ars, ar, as, az, be, bg, bn, bo, br, bs_Cyrl, bs,
3042e5b6d6dSopenharmony_ci
3052e5b6d6dSopenharmony_ci                    // C-F
3062e5b6d6dSopenharmony_ci                    ca, ceb, chr, cs, cy, da, de_AT, de, dsb, dz, ee, el, en,
3072e5b6d6dSopenharmony_ci                    en_US_POSIX, en_US, eo, es, et, fa_AF, fa, ff_Adlm, ff, fil, fi, fo, fr_CA, fr, fy,
3082e5b6d6dSopenharmony_ci
3092e5b6d6dSopenharmony_ci                    // G-J
3102e5b6d6dSopenharmony_ci                    ga, gl, gu, ha, haw, he, hi, hr, hsb, hu, hy,
3112e5b6d6dSopenharmony_ci                    id_ID, id, ig, in, in_ID, is, it, iw_IL, iw, ja,
3122e5b6d6dSopenharmony_ci
3132e5b6d6dSopenharmony_ci                    // K-P
3142e5b6d6dSopenharmony_ci                    ka, kk, kl, km, kn, kok, ko, ku, ky, lb, lkt, ln, lo, lt, lv,
3152e5b6d6dSopenharmony_ci                    mk, ml, mn, mo, mr, ms, mt, my, nb, nb_NO, ne, nl, nn, no, no_NO,
3162e5b6d6dSopenharmony_ci                    om, or, pa_IN, pa, pa_Guru, pl, ps, pt,
3172e5b6d6dSopenharmony_ci
3182e5b6d6dSopenharmony_ci                    // R-T
3192e5b6d6dSopenharmony_ci                    ro, ru, sa, se, sh_BA, sh_CS, sh, sh_YU, si, sk, sl, smn, sq,
3202e5b6d6dSopenharmony_ci                    sr_BA, sr_Cyrl_ME, sr_Latn, sr_ME, sr_RS, sr, sv, sw,
3212e5b6d6dSopenharmony_ci                    ta, te, th, tk, to, tr,
3222e5b6d6dSopenharmony_ci
3232e5b6d6dSopenharmony_ci                    // U-Z
3242e5b6d6dSopenharmony_ci                    ug, uk, ur, uz, vi, wae, wo, xh, yi, yo, yue_CN, yue_Hans_CN, yue_Hans
3252e5b6d6dSopenharmony_ci                    yue_Hant, yue, zh_CN, zh_Hans, zh_Hant, zh_HK, zh_MO, zh_SG, zh_TW, zh, zu
3262e5b6d6dSopenharmony_ci                </localeIds>
3272e5b6d6dSopenharmony_ci            </directory>
3282e5b6d6dSopenharmony_ci
3292e5b6d6dSopenharmony_ci            <directory dir="rbnf">
3302e5b6d6dSopenharmony_ci                <!-- It is not at all clear why this is being done. It's certainly not exactly the
3312e5b6d6dSopenharmony_ci                     same as above, since (a) the alias is reversed (b) "zh_Hant" does exist, with
3322e5b6d6dSopenharmony_ci                     different data than "yue", so this alias is not just rewriting the base
3332e5b6d6dSopenharmony_ci                     language. -->
3342e5b6d6dSopenharmony_ci                <!-- TODO: Find out and document this properly. -->
3352e5b6d6dSopenharmony_ci                <forcedAlias source="zh_Hant_HK" target="yue"/>
3362e5b6d6dSopenharmony_ci
3372e5b6d6dSopenharmony_ci                <localeIds>
3382e5b6d6dSopenharmony_ci                    root,
3392e5b6d6dSopenharmony_ci
3402e5b6d6dSopenharmony_ci                    // A-E
3412e5b6d6dSopenharmony_ci                    af, ak, am, ars, ar, az, be, bg, bs, ca, ccp, chr, cs, cy,
3422e5b6d6dSopenharmony_ci                    da, de_CH, de, ee, el, en_001, en_IN, en, eo, es_419, es_DO,
3432e5b6d6dSopenharmony_ci                    es_GT, es_HN, es_MX, es_NI, es_PA, es_PR, es_SV, es, es_US, et,
3442e5b6d6dSopenharmony_ci
3452e5b6d6dSopenharmony_ci                    // F-P
3462e5b6d6dSopenharmony_ci                    fa_AF, fa, ff, fil, fi, fo, fr_BE, fr_CH, fr, ga, he, hi, hr,
3472e5b6d6dSopenharmony_ci                    hu, hy, id, in, is, it, iw, ja, ka, kk, kl, km, ko, ky, lb,
3482e5b6d6dSopenharmony_ci                    lo, lrc, lt, lv, mk, ms, mt, my, nb, ne, nl, nn, no, pl, pt_PT, pt,
3492e5b6d6dSopenharmony_ci
3502e5b6d6dSopenharmony_ci                    // Q-Z
3512e5b6d6dSopenharmony_ci                    qu, ro, ru, se, sh, sk, sl, sq, sr_Latn, sr, su, sv, sw, ta, th, tr,
3522e5b6d6dSopenharmony_ci                    uk, vi, yue_Hans, yue, zh_Hant_HK, zh_Hant, zh_HK, zh_MO, zh_TW, zh
3532e5b6d6dSopenharmony_ci                </localeIds>
3542e5b6d6dSopenharmony_ci            </directory>
3552e5b6d6dSopenharmony_ci
3562e5b6d6dSopenharmony_ci            <directory dir="brkitr" inheritLanguageSubtag="zh_Hant">
3572e5b6d6dSopenharmony_ci                <localeIds>
3582e5b6d6dSopenharmony_ci                    root,
3592e5b6d6dSopenharmony_ci                    de, el, en, en_US_POSIX, en_US, es, fi, fr, it, ja, pt, ru, sv, zh_Hant, zh
3602e5b6d6dSopenharmony_ci                </localeIds>
3612e5b6d6dSopenharmony_ci            </directory>
3622e5b6d6dSopenharmony_ci
3632e5b6d6dSopenharmony_ci            <!-- GLOBAL ALIASES -->
3642e5b6d6dSopenharmony_ci
3652e5b6d6dSopenharmony_ci            <!-- Some spoken languages (e.g. "ars") inherit all their data from a written language
3662e5b6d6dSopenharmony_ci                 (e.g. "ar_SA"). However CLDR doesn't currently support a way to represent that
3672e5b6d6dSopenharmony_ci                 relationship. Unlike deprecated languages for which an alias can be inferred from
3682e5b6d6dSopenharmony_ci                 the "languageAlias" CLDR data, there's no way in CLDR to represent the fact that
3692e5b6d6dSopenharmony_ci                 we want "ars" (a non-deprecated language) to inherit the data of "ar_SA".
3702e5b6d6dSopenharmony_ci
3712e5b6d6dSopenharmony_ci                 This alias is the first example of potentially many cases where ICU needs to
3722e5b6d6dSopenharmony_ci                 generate an alias in order to affect "sideways inheritance" for spoken languages,
3732e5b6d6dSopenharmony_ci                 and at some stage it should probably be supported properly in the CLDR data. -->
3742e5b6d6dSopenharmony_ci            <forcedAlias source="ars" target="ar_SA"/>
3752e5b6d6dSopenharmony_ci
3762e5b6d6dSopenharmony_ci            <!-- A legacy global alias (note that "no_NO_NY" is not even structurally valid). -->
3772e5b6d6dSopenharmony_ci            <forcedAlias source="no_NO_NY" target="nn_NO"/>
3782e5b6d6dSopenharmony_ci
3792e5b6d6dSopenharmony_ci            <!-- This one is a bit silly, it is just to generate a stub for no_NO, which is
3802e5b6d6dSopenharmony_ci                 not in CLDR. If we do not do this, then including it in localeIds will generate
3812e5b6d6dSopenharmony_ci                 empty no_Latn and no_Latn_NO and then no_NO aliasing to no_Latn_NO. -->
3822e5b6d6dSopenharmony_ci            <forcedAlias source="no_NO" target="no"/>
3832e5b6d6dSopenharmony_ci
3842e5b6d6dSopenharmony_ci            <!-- ALTERNATE VALUES -->
3852e5b6d6dSopenharmony_ci
3862e5b6d6dSopenharmony_ci            <!-- The following elements configure alternate values for some special case paths.
3872e5b6d6dSopenharmony_ci                 The target path will only be replaced if both it, and the source path, exist in
3882e5b6d6dSopenharmony_ci                 the CLDR data (paths will not be modified if only the source path exists).
3892e5b6d6dSopenharmony_ci
3902e5b6d6dSopenharmony_ci                 Since the paths must represent the same semantic type of data, they must be in the
3912e5b6d6dSopenharmony_ci                 same "namespace" (same element names) and must not contain value attributes. Thus
3922e5b6d6dSopenharmony_ci                 they can only differ by distinguishing attributes (either added or modified).
3932e5b6d6dSopenharmony_ci
3942e5b6d6dSopenharmony_ci                 This feature is typically used to select alternate translations (e.g. short forms)
3952e5b6d6dSopenharmony_ci                 for certain paths. -->
3962e5b6d6dSopenharmony_ci            <!-- <altPath target="//path/to/value[@attr='foo']"
3972e5b6d6dSopenharmony_ci                          source="//path/to/value[@attr='bar']"
3982e5b6d6dSopenharmony_ci                          locales="xx,yy_ZZ"/> -->
3992e5b6d6dSopenharmony_ci        </convert>
4002e5b6d6dSopenharmony_ci        
4012e5b6d6dSopenharmony_ci        <generateCode cldrDir="${cldrDir}" cOutDir="${genCCodeDir}" javaOutDir="${genJavaCodeDir}" unless:true="${dontGenCode}" />
4022e5b6d6dSopenharmony_ci    </target>
4032e5b6d6dSopenharmony_ci
4042e5b6d6dSopenharmony_ci    <target name="clean" depends="init-args, prepare-jar">
4052e5b6d6dSopenharmony_ci        <taskdef name="outputDirectories" classname="org.unicode.icu.tool.cldrtoicu.ant.CleanOutputDirectoryTask">
4062e5b6d6dSopenharmony_ci            <classpath>
4072e5b6d6dSopenharmony_ci                <pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
4082e5b6d6dSopenharmony_ci            </classpath>
4092e5b6d6dSopenharmony_ci        </taskdef>
4102e5b6d6dSopenharmony_ci        <taskdef name="generateCode" classname="org.unicode.icu.tool.cldrtoicu.ant.GenerateCodeTask">
4112e5b6d6dSopenharmony_ci            <classpath>
4122e5b6d6dSopenharmony_ci                <pathelement path="target/cldr-to-icu-1.0-SNAPSHOT-jar-with-dependencies.jar"/>
4132e5b6d6dSopenharmony_ci            </classpath>
4142e5b6d6dSopenharmony_ci        </taskdef>
4152e5b6d6dSopenharmony_ci
4162e5b6d6dSopenharmony_ci        <!-- If a directory is listed here, then every file in it is assumed to be automatically
4172e5b6d6dSopenharmony_ci             generated by the conversion tool, unless it is explicitly listed in a <retain> element.
4182e5b6d6dSopenharmony_ci             The tool then checks every file to determine if it has the expected header present,
4192e5b6d6dSopenharmony_ci             indiciating that it was automatically generated, before deleting it.
4202e5b6d6dSopenharmony_ci             
4212e5b6d6dSopenharmony_ci             If unexpected files are found, the "clean" task will fail without deleting anything
4222e5b6d6dSopenharmony_ci             (unless'forceDelete' is set to override this). Note that even if 'forceDelete' is set,
4232e5b6d6dSopenharmony_ci             the files listed explicitly below will never be deleted by this process.
4242e5b6d6dSopenharmony_ci
4252e5b6d6dSopenharmony_ci             This two-step approach minimizes the risk that the conversion process will ever
4262e5b6d6dSopenharmony_ci             accidentally delete a manually maintained file.             
4272e5b6d6dSopenharmony_ci             -->
4282e5b6d6dSopenharmony_ci        <outputDirectories root="${outDir}" forceDelete="${forceDelete}">
4292e5b6d6dSopenharmony_ci            <dir name="brkitr">
4302e5b6d6dSopenharmony_ci                <retain path="dictionaries"/>
4312e5b6d6dSopenharmony_ci                <retain path="lstm"/>
4322e5b6d6dSopenharmony_ci                <retain path="rules"/>
4332e5b6d6dSopenharmony_ci            </dir>
4342e5b6d6dSopenharmony_ci            <dir name="coll">
4352e5b6d6dSopenharmony_ci                <!-- Legacy files whose file names aren't supported for automatic generation.
4362e5b6d6dSopenharmony_ci                     Simple to maintain manually and unlikely to ever change again. -->
4372e5b6d6dSopenharmony_ci                <retain path="de__PHONEBOOK.txt"/>
4382e5b6d6dSopenharmony_ci                <retain path="de_.txt"/>
4392e5b6d6dSopenharmony_ci                <retain path="es__TRADITIONAL.txt"/>
4402e5b6d6dSopenharmony_ci                <retain path="es_.txt"/>
4412e5b6d6dSopenharmony_ci            </dir>
4422e5b6d6dSopenharmony_ci            <dir name="curr"/>
4432e5b6d6dSopenharmony_ci            <dir name="lang"/>
4442e5b6d6dSopenharmony_ci            <dir name="locales"/>
4452e5b6d6dSopenharmony_ci            <dir name="misc">
4462e5b6d6dSopenharmony_ci                <!-- Machine generated files produced by different tools.
4472e5b6d6dSopenharmony_ci                     Possibly worth moving into the new LDML conversion tool one day. -->
4482e5b6d6dSopenharmony_ci                <retain path="currencyNumericCodes.txt"/>
4492e5b6d6dSopenharmony_ci                <retain path="zoneinfo64.txt"/>
4502e5b6d6dSopenharmony_ci                <!-- Project file (not ICU data), unlikely to ever be auto-generated. -->
4512e5b6d6dSopenharmony_ci                <retain path="icudata.rc"/>
4522e5b6d6dSopenharmony_ci                <!-- Small high-level metadata file, stable and easy to maintain manually. -->
4532e5b6d6dSopenharmony_ci                <retain path="icustd.txt"/>
4542e5b6d6dSopenharmony_ci            </dir>
4552e5b6d6dSopenharmony_ci            <dir name="rbnf"/>
4562e5b6d6dSopenharmony_ci            <dir name="region"/>
4572e5b6d6dSopenharmony_ci            <dir name="translit">
4582e5b6d6dSopenharmony_ci                <!-- Small, easy to maintain, special case top-level files. -->
4592e5b6d6dSopenharmony_ci                <retain path="en.txt"/>
4602e5b6d6dSopenharmony_ci                <retain path="el.txt"/>
4612e5b6d6dSopenharmony_ci            </dir>
4622e5b6d6dSopenharmony_ci            <dir name="unit"/>
4632e5b6d6dSopenharmony_ci            <dir name="zone">
4642e5b6d6dSopenharmony_ci                <!-- Manually edited to support TZ database name compatibility. -->
4652e5b6d6dSopenharmony_ci                <retain path="tzdbNames.txt"/>
4662e5b6d6dSopenharmony_ci            </dir>
4672e5b6d6dSopenharmony_ci        </outputDirectories>
4682e5b6d6dSopenharmony_ci        
4692e5b6d6dSopenharmony_ci        <generateCode cOutDir="${genCCodeDir}" javaOutDir="${genJavaCodeDir}" action="clean" />
4702e5b6d6dSopenharmony_ci    </target>
4712e5b6d6dSopenharmony_ci</project>
4722e5b6d6dSopenharmony_ci
473