12e5b6d6dSopenharmony_ci<!-- © 2020 and later: Unicode, Inc. and others.
22e5b6d6dSopenharmony_ci     License & terms of use: http://www.unicode.org/copyright.html -->
32e5b6d6dSopenharmony_ci
42e5b6d6dSopenharmony_ci<!-- This build file is intended to become the single mechanism for working with CLDR
52e5b6d6dSopenharmony_ci     code and data when building ICU data.
62e5b6d6dSopenharmony_ci     
72e5b6d6dSopenharmony_ci     Eventually it will encompass:
82e5b6d6dSopenharmony_ci     * Building ICU data form CLDR data via cldr-to-icu.
92e5b6d6dSopenharmony_ci     * Building the CLDR libraries needed to support ICU data conversion.
102e5b6d6dSopenharmony_ci     * Copying CLDR test data for ICU regression tests.
112e5b6d6dSopenharmony_ci
122e5b6d6dSopenharmony_ci     It's not complete yet, so for now follow the instructions in:
132e5b6d6dSopenharmony_ci       icu4c/source/data/cldr-icu-readme.txt
142e5b6d6dSopenharmony_ci     -->
152e5b6d6dSopenharmony_ci
162e5b6d6dSopenharmony_ci<!-- Using the directory of this build.xml file as ${basedir}. -->
172e5b6d6dSopenharmony_ci<project name="CLDR" basedir=".">
182e5b6d6dSopenharmony_ci
192e5b6d6dSopenharmony_ci    <!-- Initialize any properties not already set on the command line. -->
202e5b6d6dSopenharmony_ci    <target name="init-args">
212e5b6d6dSopenharmony_ci        <property environment="env"/>
222e5b6d6dSopenharmony_ci        <!-- Inherit properties from environment variable unless specified. As usual
232e5b6d6dSopenharmony_ci             with Ant, this is messier than it should be. All we are saying here is:
242e5b6d6dSopenharmony_ci             "Use the property if explicitly set, otherwise use the environment variable."
252e5b6d6dSopenharmony_ci             We cannot just set the property to the environment variable, since expansion
262e5b6d6dSopenharmony_ci             fails for non existent properties, and you are left with a literal value of
272e5b6d6dSopenharmony_ci             "${env.CLDR_DIR}". -->
282e5b6d6dSopenharmony_ci        <condition property="cldrDir" value="${env.CLDR_DIR}">
292e5b6d6dSopenharmony_ci            <isset property="env.CLDR_DIR"/>
302e5b6d6dSopenharmony_ci        </condition>
312e5b6d6dSopenharmony_ci        <fail unless="cldrDir"
322e5b6d6dSopenharmony_ci             message="Set the CLDR_DIR environment variable (or cldrDir property) to the top level CLDR source directory (containing 'common')."/>
332e5b6d6dSopenharmony_ci        <property name="testDataDir4C" value="${basedir}/../../icu4c/source/test/testdata/cldr"/>
342e5b6d6dSopenharmony_ci        <property name="testDataDir4J" value="${basedir}/../../icu4j/main/tests/core/src/com/ibm/icu/dev/data/cldr"/>
352e5b6d6dSopenharmony_ci    </target>
362e5b6d6dSopenharmony_ci
372e5b6d6dSopenharmony_ci    <!-- Copies CLDR test data directories, after deleting previous
382e5b6d6dSopenharmony_ci         contents to prevent inconsistent state. -->
392e5b6d6dSopenharmony_ci    <target name="copy-cldr-testdata" depends="init-args, clean-cldr-testdata">
402e5b6d6dSopenharmony_ci        <!-- CLDR test data directories to be copied into ICU. -->
412e5b6d6dSopenharmony_ci        <fileset id="cldrTestData" dir="${cldrDir}/common/testData">
422e5b6d6dSopenharmony_ci            <!-- Add directories here to control which test data is installed. -->
432e5b6d6dSopenharmony_ci            <include name="units/**"/> <!-- Used in UnitsTest tests -->
442e5b6d6dSopenharmony_ci        </fileset>
452e5b6d6dSopenharmony_ci
462e5b6d6dSopenharmony_ci        <copy todir="${testDataDir4C}">
472e5b6d6dSopenharmony_ci            <fileset refid="cldrTestData"/>
482e5b6d6dSopenharmony_ci        </copy>
492e5b6d6dSopenharmony_ci        <copy todir="${testDataDir4J}">
502e5b6d6dSopenharmony_ci            <fileset refid="cldrTestData"/>
512e5b6d6dSopenharmony_ci        </copy>
522e5b6d6dSopenharmony_ci    </target>
532e5b6d6dSopenharmony_ci
542e5b6d6dSopenharmony_ci    <!-- Deletes CLDR test data -->
552e5b6d6dSopenharmony_ci    <target name="clean-cldr-testdata" depends="init-args">
562e5b6d6dSopenharmony_ci        <delete dir="${testDataDir4C}"/>
572e5b6d6dSopenharmony_ci        <delete dir="${testDataDir4J}"/>
582e5b6d6dSopenharmony_ci    </target>
592e5b6d6dSopenharmony_ci
602e5b6d6dSopenharmony_ci    <!-- Builds the ICU data, using the Ant build file in the cldr-to-icu directory and passing.
612e5b6d6dSopenharmony_ci         through any specified arguments for controlling the build. If you need more control when
622e5b6d6dSopenharmony_ci         building ICU data (such as incrementally building parts of the data), you should use the
632e5b6d6dSopenharmony_ci         build-icu-data.xml file directly. -->
642e5b6d6dSopenharmony_ci    <target name="build-icu-data">
652e5b6d6dSopenharmony_ci        <ant dir="cldr-to-icu" antfile="build-icu-data.xml" target="all" inheritAll="true"/>
662e5b6d6dSopenharmony_ci    </target>
672e5b6d6dSopenharmony_ci
682e5b6d6dSopenharmony_ci    <!-- Deletes generated ICU data by invoking "clean" in cldr-to-icu/build-icu-data.xml -->
692e5b6d6dSopenharmony_ci    <target name="clean-icu-data">
702e5b6d6dSopenharmony_ci        <ant dir="cldr-to-icu" antfile="build-icu-data.xml" target="clean" inheritAll="true"/>
712e5b6d6dSopenharmony_ci    </target>
722e5b6d6dSopenharmony_ci
732e5b6d6dSopenharmony_ci    <!-- Installs the CLDR library dependencies needed for building ICU data. -->
742e5b6d6dSopenharmony_ci    <target name="install-cldr-libs" depends="init-args">
752e5b6d6dSopenharmony_ci        <exec dir="lib" executable="install-cldr-jars.sh" resolveexecutable="true" failonerror="true">
762e5b6d6dSopenharmony_ci            <arg line="${cldrDir}"/>
772e5b6d6dSopenharmony_ci        </exec>
782e5b6d6dSopenharmony_ci    </target>
792e5b6d6dSopenharmony_ci</project>
80