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 CLDR 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        <!-- Android-changed: By default proddata is getting build to cldr-staging instead of cldr-aux -->
46        <property name="env.CLDR_TMP_DIR" location="${env.CLDR_DIR}/../cldr-staging" />
47        <property name="cldr.prod.dir" location="${env.CLDR_TMP_DIR}/production/" />
48        <echo message="java home: ${java.home}"/>
49        <echo message="java version: ${java.version}"/>
50        <echo message="ant java version: ${ant.java.version}"/>
51        <echo message="${ant.version}"/>
52        <echo message="cldr tools dir: ${cldrtools.dir}"/>
53        <echo message="cldr tools jar: ${cldrtools.jar}"/>
54        <echo message="cldr tools classes: ${env.CLDR_CLASSES}"/>
55        <echo message="CLDR_TMP_DIR: ${env.CLDR_TMP_DIR} "/>
56        <echo message="cldr.prod.dir (production data): ${cldr.prod.dir}"/>
57    </target>
58    <target name="setup" depends="init">
59        <mkdir dir="${env.CLDR_TMP_DIR}"/> <!-- make sure parent dir exists -->
60        <condition property="cldrprod.exists">
61            <available file="${cldr.prod.dir}" type="dir"/>
62        </condition>
63    </target>
64
65    <target name="cleanprod" depends="init, setup" if="cldrprod.exists">
66        <delete dir="${cldr.prod.dir}" />
67    </target>
68    <target name="proddata" depends="init,setup" unless="cldrprod.exists">
69        <echo message="Rebuilding ${cldr.prod.dir} - takes a while!"/>
70
71        <!-- setup prod data -->
72        <java fork="true" jar="${cldrtools.jar}">
73            <arg value="org.unicode.cldr.tool.GenerateProductionData" /> <!-- change to short alias 'proddata' or similar when annotated -->
74            <arg value="-v" />
75            <!-- TODO: for now, we just let the default source/target paths used.
76                 could set '-s' / '-d' for explicit source/dest -->
77        </java>
78    </target>
79</project>
80