<!--
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*******************************************************************************
* Copyright (C) 2011-2014, International Business Machines Corporation and         *
* others. All Rights Reserved.                                                *
*******************************************************************************
-->
<project name="samples" default="build" basedir=".">
    <property file="build-local.properties"/>
    <property file="build.properties"/>
    <import file="${shared.dir}/build/common-targets.xml"/>

    <path id="javac.classpathref">
        <path refid="javac.classpathref.${ant.project.name}"/>
    </path>
    <property name="jar.name" value="icu4j-${ant.project.name}.jar"/>
    <property name="src.jar.name" value="icu4j-${ant.project.name}-src.jar"/>

    <target name="build" depends="compile, copy, jar, src-jar" description="Build the project"/>

    <target name="build-all" depends="@build-all" description="Build the project including all dependencies"/>

    <target name="clean" depends="@clean" description="Clean up the build outputs"/>

    <target name="compile" depends="@compile" description="Compile java source files"/>

    <target name="copy" depends="@copy" description="Copy non-java runtime files to the project's binary directory"/>

    <target name="jar" depends="compile, copy, @jar" description="Create the project's jar file"/>

    <target name="src-jar" depends="@src-jar" description="Create the project's source jar file"/>
	
	<target name="rebuild-iuc-data" description="Rebuild IUC sample data">
		<!-- package to build into -->
		<property name="iuc.package" value="com/ibm/icu/samples/iuc" />
		<!-- output location -->		
		<property name="iuc.dataoutdir" value="src/${iuc.package}/data" />
		<!-- tmp location -->
		<property name="iuc.tmp" value="out/tmp" />
                <property name="iuc.res.src" value="c" />
		<!-- property for the root dir of our messages. -->
		<fail unless="iuc.res.src" message="Please set -Diuc.res.src=/path/ where /path/ is a checkout of http://source.icu-project.org/repos/icu/icuapps/trunk/icufacts/c" />
		<!-- properties for the two packages we will be building. -->
		<property name="iuc.res.reshello" value="reshello" />
		<property name="iuc.res.popmsg" value="popmsg" />
		<!-- paths for these two packages -->
		<property name="iuc.res.reshello.path" value="${iuc.res.src}/s30_reshello/${iuc.res.reshello}" />
		<property name="iuc.res.popmsg.path" value="${iuc.res.src}/s40_popmsg/${iuc.res.popmsg}" />
		<property name="iuc.bldicures" value="${iuc.res.src}/bldicures.py" />
		<!-- <available file="${iuc.bldicures}" type="file" property="iuc.bldicures.present" /> -->
		<fail unless="iuc.bldicures" message="Please set -Diuc.bldicures=/path/bldicures.py - which you can get from &lt;http://source.icu-project.org/repos/icu/tools/trunk/scripts/bldicures.py&gt;" />
		<mkdir dir="${iuc.tmp}" />
		<!-- make reshello -->
		<delete dir="${iuc.tmp}/${iuc.res.reshello}" /> <!-- clean up -->
		<exec executable="${iuc.bldicures}">
			<arg value="-v" />
			<arg value="--endian" />
			<arg value="big" />
			<arg value="--mode" />
			<arg value="files" />
			<arg value="--from" />
			<arg value="${iuc.res.reshello.path}" />
			<arg value="--dest" />
			<arg value="${iuc.tmp}/${iuc.res.reshello}" />
			<arg value="--name" />
			<arg value="${iuc.res.reshello}" />
		</exec>
		<move file="${iuc.tmp}/${iuc.res.reshello}/${iuc.res.reshello}" todir="${iuc.dataoutdir}/" />
		<!-- make popmsg -->
		<delete dir="${iuc.tmp}/${iuc.res.popmsg}" /> <!-- clean up -->
		<exec executable="${iuc.bldicures}">
			<arg value="-v" />
			<arg value="--endian" />
			<arg value="big" />
			<arg value="--mode" />
			<arg value="files" />
			<arg value="--from" />
			<arg value="${iuc.res.popmsg.path}" />
			<arg value="--dest" />
			<arg value="${iuc.tmp}/${iuc.res.popmsg}" />
			<arg value="--name" />
			<arg value="${iuc.res.popmsg}" />
		</exec>
		<move file="${iuc.tmp}/${iuc.res.popmsg}/${iuc.res.popmsg}" todir="${iuc.dataoutdir}/" />
		<delete dir="${iuc.tmp}" /> <!-- clean up -->
	</target>
</project>
