12e5b6d6dSopenharmony_ci<!--
22e5b6d6dSopenharmony_ci* © 2016 and later: Unicode, Inc. and others.
32e5b6d6dSopenharmony_ci* License & terms of use: http://www.unicode.org/copyright.html
42e5b6d6dSopenharmony_ci*******************************************************************************
52e5b6d6dSopenharmony_ci* Copyright (C) 2012-2013, International Business Machines Corporation and    *
62e5b6d6dSopenharmony_ci* others. All Rights Reserved.                                                *
72e5b6d6dSopenharmony_ci*******************************************************************************
82e5b6d6dSopenharmony_ci-->
92e5b6d6dSopenharmony_ci<project name="currency-numeric" default="build" basedir=".">
102e5b6d6dSopenharmony_ci    <property name="out.dir" value="${basedir}/out"/>
112e5b6d6dSopenharmony_ci    <property name="src.dir" value="${basedir}/src"/>
122e5b6d6dSopenharmony_ci    <property name="classes.dir" value="${out.dir}/bin"/>
132e5b6d6dSopenharmony_ci    <property name="res.dir" value="${out.dir}/res"/>
142e5b6d6dSopenharmony_ci    <property name="xml.dir" value="${out.dir}/xml"/>
152e5b6d6dSopenharmony_ci
162e5b6d6dSopenharmony_ci    <property name="base.url" value="https://www.six-group.com/dam/download/financial-information/data-center/iso-currrency/lists/"/>
172e5b6d6dSopenharmony_ci    <property name="current.xml" value="list-one.xml"/>
182e5b6d6dSopenharmony_ci    <property name="historic.xml" value="list-three.xml"/>
192e5b6d6dSopenharmony_ci
202e5b6d6dSopenharmony_ci<target name="build" depends="check, resource" description="Verify ICU's local data and generate ISO 4217 alpha-numeric code mapping data resource"/>
212e5b6d6dSopenharmony_ci
222e5b6d6dSopenharmony_ci<target name="classes" description="Build the Java tool">
232e5b6d6dSopenharmony_ci    <mkdir dir="${classes.dir}"/>
242e5b6d6dSopenharmony_ci    <javac srcdir="${src.dir}" destdir="${classes.dir}"
252e5b6d6dSopenharmony_ci            target="1.7" encoding="UTF-8" includeAntRuntime="false"/>
262e5b6d6dSopenharmony_ci</target>
272e5b6d6dSopenharmony_ci
282e5b6d6dSopenharmony_ci<target name="_checkLocalXml">
292e5b6d6dSopenharmony_ci    <condition property="isLocalXml">
302e5b6d6dSopenharmony_ci        <and>
312e5b6d6dSopenharmony_ci            <available file="${basedir}/${current.xml}"/>
322e5b6d6dSopenharmony_ci            <available file="${basedir}/${historic.xml}"/>
332e5b6d6dSopenharmony_ci        </and>
342e5b6d6dSopenharmony_ci    </condition>
352e5b6d6dSopenharmony_ci</target>
362e5b6d6dSopenharmony_ci
372e5b6d6dSopenharmony_ci<target name="_localXml" depends="_checkLocalXml" if="isLocalXml">
382e5b6d6dSopenharmony_ci    <echo message="Using local ISO 4217 XML data files"/>
392e5b6d6dSopenharmony_ci    <copy file="${current.xml}" todir="${xml.dir}"/>
402e5b6d6dSopenharmony_ci    <copy file="${historic.xml}" todir="${xml.dir}"/>
412e5b6d6dSopenharmony_ci</target>
422e5b6d6dSopenharmony_ci
432e5b6d6dSopenharmony_ci<target name="_downloadXml" unless="isLocalXml">
442e5b6d6dSopenharmony_ci    <echo message="Downloading ISO 4217 XML data files"/>
452e5b6d6dSopenharmony_ci    <mkdir dir="${xml.dir}"/>
462e5b6d6dSopenharmony_ci    <get src="${base.url}${current.xml}" dest="${xml.dir}"/>
472e5b6d6dSopenharmony_ci    <get src="${base.url}${historic.xml}" dest="${xml.dir}"/>
482e5b6d6dSopenharmony_ci</target>
492e5b6d6dSopenharmony_ci
502e5b6d6dSopenharmony_ci<target name="xmlData" depends="_localXml, _downloadXml" description="Prepare necessary ISO 4217 XML data files">
512e5b6d6dSopenharmony_ci</target>
522e5b6d6dSopenharmony_ci
532e5b6d6dSopenharmony_ci<target name="check" depends="classes, xmlData" description="Verify if ICU's local mapping data is synchronized with the XML data">
542e5b6d6dSopenharmony_ci    <java classname="com.ibm.icu.dev.tool.currency.Main"
552e5b6d6dSopenharmony_ci            classpath="${classes.dir}"
562e5b6d6dSopenharmony_ci            failonerror="true">
572e5b6d6dSopenharmony_ci        <arg value="check"/>
582e5b6d6dSopenharmony_ci        <arg value="${xml.dir}/${current.xml}"/>
592e5b6d6dSopenharmony_ci        <arg value="${xml.dir}/${historic.xml}"/>
602e5b6d6dSopenharmony_ci    </java>
612e5b6d6dSopenharmony_ci</target>
622e5b6d6dSopenharmony_ci
632e5b6d6dSopenharmony_ci<target name="resource" depends="classes" description="Build ISO 4217 alpha-numeric code mapping data resource">
642e5b6d6dSopenharmony_ci    <mkdir dir="${res.dir}"/>
652e5b6d6dSopenharmony_ci    <java classname="com.ibm.icu.dev.tool.currency.Main"
662e5b6d6dSopenharmony_ci            classpath="${classes.dir}"
672e5b6d6dSopenharmony_ci            failonerror="true">
682e5b6d6dSopenharmony_ci        <arg value="build"/>
692e5b6d6dSopenharmony_ci        <arg value="${res.dir}"/>
702e5b6d6dSopenharmony_ci    </java>
712e5b6d6dSopenharmony_ci    <echo message="ISO 4217 numeric code mapping data was successfully created in ${res.dir}"/>
722e5b6d6dSopenharmony_ci</target>
732e5b6d6dSopenharmony_ci
742e5b6d6dSopenharmony_ci<target name="clean" description="Delete build outputs">
752e5b6d6dSopenharmony_ci    <delete dir="${out.dir}"/>
762e5b6d6dSopenharmony_ci</target>
772e5b6d6dSopenharmony_ci
782e5b6d6dSopenharmony_ci</project>
79