<!--
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html#License
*******************************************************************************
* Copyright (C) 2009-2015, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
-->
<project name="core" 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, copy-data" 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="findbugs" depends="@findbugs" description="Search the project for possible defects using FindBugs." />

    <target name="copy-data" depends="set-icuconfig-datapath" unless="icu4c.data.path" description="Extract pre-built ICU core data files and copy them to the project's binary directory">
        <unjar src="${icu4j.data.jar}" dest="${bin.dir}">
            <patternset>
                <exclude name="META-INF"/>
                <exclude name="META-INF/**/*"/>
                <exclude name="${icu4j.data.path}/coll/**"/>
                <exclude name="${icu4j.data.path}/curr/**"/>
                <exclude name="${icu4j.data.path}/lang/**"/>
                <exclude name="${icu4j.data.path}/region/**"/>
                <exclude name="${icu4j.data.path}/translit/**"/>
                <exclude name="**/*.cnv"/>
                <exclude name="**/cnvalias.icu"/>
            </patternset>
        </unjar>
        <unjar src="${icu4j.tzdata.jar}" dest="${bin.dir}">
            <patternset>
                <exclude name="META-INF"/>
                <exclude name="META-INF/**/*"/>
            </patternset>
        </unjar>

        <antcall target="@full-locale-names">
            <param name="res.dir" value="${bin.dir}/${icu4j.data.path}"/>
        </antcall>

        <antcall target="@full-locale-names">
            <param name="res.dir" value="${bin.dir}/${icu4j.data.path}/brkitr"/>
        </antcall>

        <antcall target="@full-locale-names">
            <param name="res.dir" value="${bin.dir}/${icu4j.data.path}/rbnf"/>
        </antcall>

        <antcall target="@full-locale-names">
            <param name="res.dir" value="${bin.dir}/${icu4j.data.path}/zone"/>
        </antcall>
    </target>

    <target name="set-icuconfig-datapath" if="icu4c.data.path">
        <propertyfile
                file="${bin.dir}/com/ibm/icu/ICUConfig.properties"
                comment="ICU runtime configuration generated by Ant">
            <entry key="com.ibm.icu.impl.ICUBinary.dataPath" value="${icu4c.data.path}"/>
        </propertyfile>
    </target>
</project>
