blob: b9027dbc7a19158e3eb4814298ee836a989351b6 [file] [log] [blame]
<!--
* © 2016 and later: Unicode, Inc. and others.
* License & terms of use: http://www.unicode.org/copyright.html
*******************************************************************************
* Copyright (C) 1997-2016, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
-->
<project name="icu4j" default="jar" basedir="."
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:jacoco="antlib:org.jacoco.ant">
<property file="build-local.properties"/>
<property file="build.properties"/>
<property name="shared.dir" value="main/shared"/>
<import file="${shared.dir}/build/common-targets.xml"/>
<property environment="env"/>
<!-- icu4j binaries -->
<property name="icu4j.jar.file" value="icu4j.jar"/>
<property name="icu4jtests.jar.file" value="icu4jtests.jar"/>
<property name="icu4j-charset.jar.file" value="icu4j-charset.jar"/>
<property name="icu4j-localespi.jar.file" value="icu4j-localespi.jar"/>
<property name="icu4jdemos.jar.file" value="icu4jdemos.jar"/>
<!-- icu4j API doc jar file -->
<property name="icu4jdocs.jar.file" value="icu4j-docs.jar"/>
<!-- icu4j src jar files -->
<property name="icu4j-src.jar.file" value="icu4j-src.jar"/>
<property name="icu4j-charset-src.jar.file" value="icu4j-charset-src.jar"/>
<property name="icu4j-localespi-src.jar.file" value="icu4j-localespi-src.jar"/>
<!-- icu4j source package archive files -->
<property name="icu4jsrc.zip.file" value="icu4j.zip"/>
<property name="icu4jsrc.tgz.file" value="icu4j.tgz"/>
<!-- icu4j versioned release files -->
<property name="icu4j.jar.versioned.file" value="icu4j-${release.file.ver}.jar"/>
<property name="icu4j-charset.jar.versioned.file" value="icu4j-charset-${release.file.ver}.jar"/>
<property name="icu4j-localespi.jar.versioned.file" value="icu4j-localespi-${release.file.ver}.jar"/>
<property name="icu4j-src.jar.versioned.file" value="icu4j-${release.file.ver}-src.jar"/>
<property name="icu4j-charset-src.jar.versioned.file" value="icu4j-charset-${release.file.ver}-src.jar"/>
<property name="icu4j-localespi-src.jar.versioned.file" value="icu4j-localespi-${release.file.ver}-src.jar"/>
<property name="icu4jdocs.jar.versioned.file" value="icu4j-${release.file.ver}-docs.jar"/>
<!-- <property name="icu4jsrc.zip.versioned.file" value="icu4j-${release.file.ver}.zip"/> -->
<property name="icu4jsrc.tgz.versioned.file" value="icu4j-${release.file.ver}.tgz"/>
<!-- API doc -->
<property name="icu4j.api.doc.title" value="ICU4J ${api.doc.version} API Specification"/>
<property name="icu4j.api.doc.window.title" value="ICU4J ${api.doc.version}"/>
<property name="icu4j.api.doc.header" value="ICU4J ${api.doc.version}"/>
<property name="icu4j.api.doc.jdk.link" value="https://docs.oracle.com/javase/8/docs/api/"/>
<property name="icu4j.api.doc.copyright.footer" value="&lt;font size=-1&gt;Copyright &#x00A9; 2016 Unicode, Inc. and others.&lt;/font&gt;"/>
<!-- API docs for maven repo -->
<property name="icu4jdocs.main.jar.versioned.file" value="icu4j-${release.file.ver}-docs.jar"/>
<property name="icu4j.main.api.doc.title" value="ICU4J (com.ibm.icu:icu4j) ${api.doc.version} API Specification"/>
<property name="icu4j.main.api.doc.window.title" value="ICU4J (com.ibm.icu:icu4j) ${api.doc.version}"/>
<property name="icu4j.main.api.doc.header" value="ICU4J (com.ibm.icu:icu4j) ${api.doc.version}"/>
<property name="icu4jdocs.charset.jar.versioned.file" value="icu4j-charset-${release.file.ver}-docs.jar"/>
<property name="icu4j.charset.api.doc.title" value="ICU4J Charset (com.ibm.icu:icu4j-charset) ${api.doc.version} API Specification"/>
<property name="icu4j.charset.api.doc.window.title" value="ICU4J Charset (com.ibm.icu:icu4j-charset) ${api.doc.version}"/>
<property name="icu4j.charset.api.doc.header" value="ICU4J Charset (com.ibm.icu:icu4j-charset) ${api.doc.version}"/>
<property name="icu4jdocs.localespi.jar.versioned.file" value="icu4j-localespi-${release.file.ver}-docs.jar"/>
<property name="icu4j.locspi.api.doc.title" value="ICU4J Locale SPI Provider (com.ibm.icu:icu4j-localespi) ${api.doc.version} API Specification"/>
<property name="icu4j.locspi.api.doc.window.title" value="ICU4J Locale SPI Provider (com.ibm.icu:icu4j-localespi) ${api.doc.version}"/>
<property name="icu4j.locspi.api.doc.header" value="ICU4J Locale SPI Provider (com.ibm.icu:icu4j-localespi) ${api.doc.version}"/>
<!-- directories -->
<property name="release.dir" value="release"/>
<property name="doc.dir" value="doc"/>
<property name="maven.doc.base.dir" value="${out.dir}/mavendoc"/>
<property name="cldr.util.out.dir" value="${out.dir}/cldr_util"/>
<property name="cldr.release.dir" value="release_cldr"/>
<property name="external-jars" value="lib"/>
<!-- Java version check -->
<condition property="is.java8">
<matches string="${java.version}" pattern="^1\.8\.\d.*"/>
</condition>
<condition property="is.java9">
<matches string="${java.version}" pattern="^9((-.|\.\d).*)?"/>
</condition>
<condition property="is.java10">
<matches string="${java.version}" pattern="^10((-.|\.\d).*)?"/>
</condition>
<condition property="is.java11">
<matches string="${java.version}" pattern="^11((-.|\.\d).*)?"/>
</condition>
<condition property="is.java12">
<matches string="${java.version}" pattern="^12((-.|\.\d).*)?"/>
</condition>
<condition property="is.java13">
<matches string="${java.version}" pattern="^13((-.|\.\d).*)?"/>
</condition>
<condition property="is.java14">
<matches string="${java.version}" pattern="^14((-.|\.\d).*)?"/>
</condition>
<condition property="is.java15">
<matches string="${java.version}" pattern="^15((-.|\.\d).*)?"/>
</condition>
<condition property="is.java16">
<matches string="${java.version}" pattern="^16((-.|\.\d).*)?"/>
</condition>
<condition property="is.java17">
<matches string="${java.version}" pattern="^17((-.|\.\d).*)?"/>
</condition>
<condition property="is.java18">
<matches string="${java.version}" pattern="^18((-.|\.\d).*)?"/>
</condition>
<condition property="is.java19">
<matches string="${java.version}" pattern="^19((-.|\.\d).*)?"/>
</condition>
<condition property="is.java9.plus">
<or>
<isset property="is.java9"/>
<isset property="is.java10"/>
<isset property="is.java11"/>
<isset property="is.java12"/>
<isset property="is.java13"/>
<isset property="is.java14"/>
<isset property="is.java15"/>
<isset property="is.java16"/>
<isset property="is.java17"/>
<isset property="is.java18"/>
<isset property="is.java19"/>
</or>
</condition>
<condition property="is.java8.plus">
<or>
<isset property="is.java8"/>
<isset property="is.java9.plus"/>
</or>
</condition>
<fail message="The JDK version is too old or unknown.">
<condition>
<not>
<isset property="is.java8.plus"/>
</not>
</condition>
</fail>
<!-- Build environment info -->
<property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
<target name="info" description="Display the build environment information">
<echo message="----- Build Environment Information -------------------"/>
<echo message="Java Home: ${java.home}"/>
<echo message="Java Version: ${java.version}"/>
<echo message="Ant Home: ${ant.home}"/>
<echo message="Ant Version: ${ant.version}"/>
<echo message="OS: ${os.name}"/>
<echo message="OS Version: ${os.version}"/>
<echo message="OS Arch: ${os.arch}"/>
<echo message="Host: ${env.COMPUTERNAME}"/>
<echo message="-------------------------------------------------------"/>
</target>
<target name="clean" description="Clean up build outputs">
<ant dir="${icu4j.core.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.collate.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.charset.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.currdata.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.langdata.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.localespi.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.regiondata.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.translit.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.test-framework.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.core-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.collate-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.charset-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.localespi-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.packaging-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.translit-tests.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.build-tools.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.tools.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.demos.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.samples.dir}" target="clean" inheritAll="false"/>
<ant dir="${icu4j.perf-tests.dir}" target="clean" inheritAll="false"/>
<!-- delete all .jar files root directory -->
<delete>
<fileset dir="." includes="icu4j*.jar"/>
</delete>
<delete dir="${release.dir}"/>
<delete dir="${doc.dir}"/>
<delete dir="${out.dir}"/>
<delete dir="${module.dir}"/>
<delete dir="${cldr.release.dir}"/>
</target>
<target name="ivy-clean">
<ivy:cleancache/>
</target>
<!-- Ivy Targets -->
<property name="ivy.install.version" value="2.5.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load ivy here from ivy home, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="test-init-junit-dependency" depends="init-ivy">
<ivy:retrieve/>
</target>
<target name="init" depends="test-init-junit-dependency"
description="Initialize the environment for build and test. May require internet access."/>
<target name="_classifytests">
<condition property="testaction.run">
<isset property="testclass"/>
</condition>
<condition property="testaction.class">
<and>
<isset property="testclass"/>
<not><isset property="testnames"/></not>
</and>
</condition>
<condition property="testaction.tests">
<and>
<isset property="testclass"/>
<isset property="testnames"/>
</and>
</condition>
<condition property="testaction.error">
<and>
<not><isset property="testclass"/></not>
<isset property="testnames"/>
</and>
</condition>
<condition property="testaction.all">
<and>
<not><isset property="testclass"/></not>
<not><isset property="testnames"/></not>
</and>
</condition>
</target>
<target name="checkTest" depends="_classifytests, tests, runallTests, noTests" if="testaction.run" description="Run only the specified tests of the specified test class or, if no arguments are given, the standard ICU4J test suite.">
<sequential>
<delete dir="${junit.out.dir}/checkTest"/>
<mkdir dir="${junit.out.dir}/checkTest"/>
<junit printsummary="yes" fork="yes">
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg value="-DICU.exhaustive=10"/>
<classpath>
<path refid="junit.jars"/>
<path refid="junit.icu.jars"/>
</classpath>
<test name="${testclass}" todir="${junit.out.dir}/checkTest" outfile="checkTest" methods="${testnames}" if="testaction.tests">
<formatter type="xml"/>
</test>
<test name="${testclass}" todir="${junit.out.dir}/checkTest" outfile="checkTest" if="testaction.class">
<formatter type="xml"/>
</test>
</junit>
<junitreport todir="${junit.out.dir}/checkTest">
<fileset dir="${junit.out.dir}/checkTest">
<include name="checkTest.xml"/>
</fileset>
<report format="frames" todir="${junit.out.dir}/checkTest/html"/>
</junitreport>
<fail message="test failed: @{testdir}" if="@{failure-status}" />
</sequential>
</target>
<target name="runallTests" if="testaction.all">
<antcall target="allTests"/>
</target>
<target name="allTests" depends="check"/>
<target name="noTests" if="testaction.error">
<echo>Execute JUnit testing using -Dtestclass='class-name' -Dtestnames='test-name1>, test-name2, ...'</echo>
</target>
<!-- Junit Targets -->
<macrodef name="icu-junit">
<attribute name="test-name"/>
<attribute name="jvm-options" default=""/>
<attribute name="classpath" default="junit.icu.jars"/>
<attribute name="failure-status" default="ignore"/>
<element name="junit-fileset"/>
<element name="junit-parameters" optional="true"/>
<sequential>
<echo message="@{jvm-options}"/>
<!--set the property - if it was set before it won't override-->
<property name="user-jvm-options" value=""/>
<property name="internal-jvm-options" value=""/>
<property name="com.ibm.icu.impl.breakiter.useMLPhraseBreaking" value=""/>
<delete dir="${junit.out.dir}/@{test-name}"/>
<mkdir dir="${junit.out.dir}/@{test-name}"/>
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no"
failureproperty="@{failure-status}" tempdir="${junit.out.dir}">
<sysproperty key="com.ibm.icu.impl.breakiter.useMLPhraseBreaking" value="${com.ibm.icu.impl.breakiter.useMLPhraseBreaking}" />
<jvmarg value="-Xss4m"/>
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<jvmarg line="${user-jvm-options}"/>
<jvmarg line="@{jvm-options}"/>
<jvmarg line="${internal-jvm-options}"/>
<junit-parameters/>
<classpath>
<path refid="junit.jars"/>
<path refid="@{classpath}"/>
</classpath>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest todir="${junit.out.dir}/@{test-name}">
<junit-fileset/>
</batchtest>
</junit>
<junitreport tofile="@{test-name}-TestSuite.xml" todir="${junit.out.dir}/@{test-name}">
<fileset dir="${junit.out.dir}/@{test-name}">
<include name="*.xml"/>
</fileset>
<report format="frames" todir="${junit.out.dir}/@{test-name}/html"/>
</junitreport>
<fail message="test failed: @{test-name}" if="@{failure-status}" />
</sequential>
</macrodef>
<property name="junit.out.dir" value="${out.dir}/junit-results"/>
<property name="junit.core.jar" value="${external-jars}/junit-4.12.jar"/>
<property name="junit.hamcrest.jar" value="${external-jars}/hamcrest-core-1.3.jar"/>
<property name="junit.junitparams.jar" value="${external-jars}/JUnitParams-1.0.5.jar"/>
<path id="junit.jars">
<pathelement path="${junit.core.jar}"/>
<pathelement path="${junit.hamcrest.jar}"/>
<pathelement path="${junit.junitparams.jar}"/>
</path>
<path id="junit.icu.jars">
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.currdata.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
<pathelement location="${icu4j.translit.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.tools.jar}"/>
<pathelement location="${icu4j.core-tests.jar}"/>
<pathelement location="${icu4j.collate-tests.jar}"/>
<pathelement location="${icu4j.charset-tests.jar}"/>
<pathelement location="${icu4j.translit-tests.jar}"/>
<pathelement location="${icu4j.localespi-tests.jar}"/>
<pathelement location="${icu4j.packaging-tests.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
</path>
<path id="junit.icu.release.jars">
<pathelement location="${icu4j.jar.file}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4jtests.jar.file}"/>
</path>
<path id="junit.icu.localespi-tests.jars">
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.localespi-tests.jar}"/>
</path>
<path id="junit.icu.localespi-tests.java9.jars">
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.localespi-tests.jar}"/>
<pathelement location="${icu4j.localespi.jar}"/>
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.currdata.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
</path>
<!--Class names that will be included/excluded as tests-->
<patternset id="test-classes-patternset">
<include name="**/*Test*"/>
<exclude name="**/*Fmwk*"/>
<exclude name="**/*TestUtility*"/>
<exclude name="**/*TestHelper*"/>
<exclude name="**/*TestCase*"/>
<exclude name="**/*TestData*"/>
<exclude name="**/*TestSample*"/>
<exclude name="**/*$*.class"/>
<exclude name="**/data/**"/>
<exclude name="com/ibm/icu/dev/test/*"/>
</patternset>
<!--Class names that will be included/excluded as tests for time zone check-->
<patternset id="timeZoneCheck-patternset">
<include name="**/TimeZoneFormatTest*"/>
<exclude name="**/*$*.class"/>
</patternset>
<!--Class names that will be included/excluded as tests for packaging check-->
<patternset id="packagingCheck-patternset">
<include name="**/TestLocaleNamePackaging*"/>
<exclude name="**/*$*.class"/>
</patternset>
<!--Class names that will be included/excluded as tests for locale SPI check-->
<patternset id="localespiCheck-patternset">
<include name="**/*Test*"/>
<exclude name="com/ibm/icu/dev/test/localespi/TestUtil.*"/>
<exclude name="**/*$*.class"/>
</patternset>
<!-- meta build targets -->
<target name="all" depends="info, main, tests, build-tools, tools, demos, samples, perf-tests, jar, docs" description="Build all primary targets"/>
<target name="main" depends="info, core, collate, charset, currdata, langdata, regiondata, translit, localespi" description="Build ICU4J runtime library classes"/>
<target name="tests" depends="info, core-tests, charset-tests, collate-tests, packaging-tests, translit-tests, localespi-tests" description="Build ICU4J test classes"/>
<target name="secure" depends="icu4jJar" description="(Deprecated)Build ICU4J API and test classes for running the ICU4J test suite with Java security manager enabled"/>
<!-- Check to see if JVM_OPTIONS environment variable is set. This can be use to set the heap size. -->
<property name="env.JVM_OPTIONS" value=""/>
<property name="jvm_options" value="${env.JVM_OPTIONS}"/>
<target name="_check">
<parallel>
<antcall target="_charsetCheck"/>
<antcall target="_collateCheck"/>
<antcall target="_coreCheck"/>
<antcall target="_translitCheck"/>
</parallel>
</target>
<target name="exhaustiveCheck" description="Run the standard ICU4J test suite in exhaustive mode">
<antcall target="check">
<param name="internal-jvm-options" value="-DICU.exhaustive=10"/>
</antcall>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="check" depends="main, tests" description="Run the standard ICU4J test suite">
<antcall target="_check"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="runTest" description="Run the standard ICU4J test suite without calling any other build targets">
<antcall target="_check"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="releaseJarCheck" depends="jar, icu4jtestsJar" description="Run the ICU4J test suite with ICU4J release jar files">
<icu-junit test-name="releaseJarCheck"
classpath="junit.icu.release.jars"
failure-status="icu-junit-failure">
<junit-fileset>
<zipfileset src="${icu4jtests.jar.file}">
<patternset refid="test-classes-patternset"/>
</zipfileset>
</junit-fileset>
</icu-junit>
<fail message="test failed - icu4j/icu4j-charset" if="icu-junit-failure" />
<property name="test.java.ext.dir" value="${out.dir}/localespi-ext"/>
<delete dir="${test.java.ext.dir}"/>
<mkdir dir="${test.java.ext.dir}"/>
<copy file="${icu4j-localespi.jar.file}" todir="${test.java.ext.dir}"/>
<copy file="${icu4j.jar.file}" todir="${test.java.ext.dir}"/>
<icu-junit test-name="releaseJarCheck-localespi"
classpath="junit.icu.localespi-tests.jars"
jvm-options="-Djava.ext.dirs=${test.java.ext.dir}${path.separator}${java.ext.dirs}"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.localespi-tests.dir}/${bin.dir}">
<patternset refid="localespiCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
<fail message="test failed - icu4j-localespi" if="icu-junit-failure" />
</target>
<target name="timeZoneCheck" depends="main, tests" description="Run the complete test for TimeZoneRoundTripAll">
<icu-junit test-name="timeZoneCheck"
jvm-options="-DTimeZoneRoundTripAll=true"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.core-tests.dir}/${bin.dir}">
<patternset refid="timeZoneCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="jdktzCheck" description="Run the standard ICU4J test suite with JDK TimeZone">
<antcall target="check">
<param name="internal-jvm-options" value="-Dcom.ibm.icu.util.TimeZone.DefaultTimeZoneType=JDK"/>
</antcall>
</target>
<path id="junit.icu.jars.PackagingCheckNoLangData">
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.packaging-tests.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
</path>
<path id="junit.icu.jars.PackagingCheckNoRegionData">
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.packaging-tests.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
</path>
<path id="junit.icu.jars.PackagingCheckNoLangNorRegionData">
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.packaging-tests.jar}"/>
</path>
<target name="_packagingCheckNoLangData">
<!-- region data but no language data -->
<icu-junit test-name="packaging-NoLangData"
classpath="junit.icu.jars.PackagingCheckNoLangData"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.packaging-tests.dir}/${bin.dir}">
<patternset refid="packagingCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="_packagingCheckNoRegionData">
<!-- language data but no region data -->
<icu-junit test-name="packaging-NoRegionData"
classpath="junit.icu.jars.PackagingCheckNoRegionData"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.packaging-tests.dir}/${bin.dir}">
<patternset refid="packagingCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="_packagingCheckNoLangNorRegionData">
<!-- neither region nor language data -->
<icu-junit test-name="packaging-NoLangNorRegionData"
classpath="junit.icu.jars.PackagingCheckNoLangNorRegionData"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.packaging-tests.dir}/${bin.dir}">
<patternset refid="packagingCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="packagingCheck" depends="info, core, langdata, regiondata, packaging-tests" description="Run packaging tests">
<antcall target="_packagingCheckNoLangData"/>
<antcall target="_packagingCheckNoRegionData"/>
<antcall target="_packagingCheckNoLangNorRegionData"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="_coreCheck">
<icu-junit test-name="core" failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.core-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="coreCheck" depends="info, core, currdata, langdata, regiondata, core-tests" description="Run only the core tests">
<antcall target="_coreCheck"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="_charsetCheck">
<icu-junit test-name="charset" failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.charset-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="charsetCheck" depends="info, core, charset, currdata, langdata, regiondata, core-tests, charset-tests" description="Run only the charset tests">
<antcall target="_charsetCheck"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="_collateCheck">
<icu-junit test-name="collate" failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.collate-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="collateCheck" depends="info, core, collate, currdata, langdata, regiondata, core-tests, collate-tests" description="Run only the collation tests">
<antcall target="_collateCheck"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="_translitCheck">
<icu-junit test-name="translit" failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.translit-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="translitCheck" depends="info, core, translit, langdata, translit-tests" description="Run the ICU4J Translit test suite">
<antcall target="_translitCheck"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="_localespiCheck" unless="is.java9.plus">
<icu-junit test-name="localespi"
classpath="junit.icu.localespi-tests.jars"
jvm-options="-Djava.ext.dirs=${icu4j.core.dir}/${jar.dir}${path.separator}${icu4j.localespi.dir}/${jar.dir}${path.separator}${icu4j.collate.dir}/${jar.dir}${path.separator}${icu4j.currdata.dir}/${jar.dir}${path.separator}${icu4j.langdata.dir}/${jar.dir}${path.separator}${icu4j.regiondata.dir}/${jar.dir}${path.separator}${java.ext.dirs}"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.localespi-tests.dir}/${bin.dir}">
<patternset refid="localespiCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="_localespiCheckJava9Plus" if="is.java9.plus">
<icu-junit test-name="localespi"
classpath="junit.icu.localespi-tests.java9.jars"
jvm-options="-Djava.locale.providers=CLDR,COMPAT,SPI"
failure-status="icu-junit-failure">
<junit-fileset>
<fileset dir="${icu4j.localespi-tests.dir}/${bin.dir}">
<patternset refid="localespiCheck-patternset"/>
</fileset>
</junit-fileset>
</icu-junit>
</target>
<target name="localespiCheck" depends="info, localespi, localespi-tests" description="Run the ICU4J Locale SPI test suite">
<antcall target="_localespiCheck"/>
<antcall target="_localespiCheckJava9Plus"/>
<fail message="test failed" if="icu-junit-failure" />
</target>
<target name="secureCheck" depends="jar, icu4jtestsJar" description="Run the ICU4J test suite with Java security manager enabled">
<icu-junit test-name="secureCheck"
classpath="junit.icu.release.jars"
jvm-options="-Djava.security.manager -Djava.security.policy=${user.dir}/${shared.dir}/data/security.policy"
failure-status="icu-junit-failure">
<junit-fileset>
<zipfileset src="${icu4jtests.jar.file}">
<patternset refid="test-classes-patternset"/>
</zipfileset>
</junit-fileset>
</icu-junit>
<fail message="test failed" if="icu-junit-failure" />
</target>
<!-- jar targets -->
<target name="jar" depends="icu4jJar, charset, localespi" description="Build ICU4J runtime library jar files">
<copy file="${icu4j.charset.jar}" tofile="${icu4j-charset.jar.file}"/>
<copy file="${icu4j.localespi.jar}" tofile="${icu4j-localespi.jar.file}" failonerror="false"/>
</target>
<target name="icu4jJar" depends="info, core, collate, currdata, langdata, regiondata, translit" description="Build ICU4J all-in-one core jar">
<mkdir dir="${out.dir}"/>
<!-- manifest -->
<copy file="manifest.stub" todir="${out.dir}">
<filterset>
<filter token="SPECVERSION" value="${jar.spec.version}"/>
<filter token="IMPLVERSION" value="${jar.impl.version}"/>
<filter token="COPYRIGHT" value="${jar.copyright.info}"/>
<filter token="EXECENV" value="${jar.exec.env}"/>
</filterset>
</copy>
<!-- jar -->
<jar jarfile="${icu4j.jar.file}"
compress="true"
manifest="${out.dir}/manifest.stub">
<fileset dir="${icu4j.core.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.collate.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.currdata.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.langdata.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.regiondata.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.translit.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${shared.dir}/licenses">
<include name="LICENSE"/>
</fileset>
</jar>
</target>
<target name="icu4jSrcJar" description="Build icu4j-src.jar">
<jar jarfile="${icu4j-src.jar.file}"
compress="true">
<fileset dir="${icu4j.core.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${icu4j.collate.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${icu4j.currdata.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${icu4j.langdata.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${icu4j.regiondata.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${icu4j.translit.dir}/${src.dir}" includes="**/*.java"/>
<fileset dir="${shared.dir}/licenses">
<include name="LICENSE"/>
</fileset>
</jar>
</target>
<target name="icu4jtestsJar" depends="info, tests, tools" description="Build ICU4J all-in-one test jar">
<jar jarfile="${icu4jtests.jar.file}"
compress="true">
<fileset dir="${icu4j.test-framework.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.core-tests.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.collate-tests.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.translit-tests.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.charset-tests.dir}/${bin.dir}" includes="**/*"/>
<fileset dir="${icu4j.tools.dir}/${bin.dir}" includes="com/ibm/icu/dev/tool/locale/**"/>
</jar>
</target>
<target name="jarDemos" depends="icu4jJar, demos" description="Build ICU4J demo jar file">
<copy file="${icu4j.demos.jar}" tofile="${icu4jdemos.jar.file}"/>
</target>
<!-- release targets -->
<target name="_check_config_for_release" depends="_checkJCite">
<condition property="release.build.config.ok">
<and>
<isset property="is.java8"/>
<isset property="jcite.libs"/>
</and>
</condition>
</target>
<target name="_verify_config_for_release" depends="_check_config_for_release" unless="release.build.config.ok">
<condition property="disp.is.java8" value="${java.version}" else="${java.version} - Must be 1.8!">
<isset property="is.java8"/>
</condition>
<condition property="disp.jcite.libs" value="${jcite.libs}" else="Not Defined!">
<isset property="jcite.libs"/>
</condition>
<echo message="################################################################"/>
<echo message="[WARNING] Insufficient Build Configuration for ICU4J Release"/>
<echo message="JDK 8 Tools: ${disp.is.java8}"/>
<echo message="JCite Library Path: ${disp.jcite.libs}"/>
<echo message="################################################################"/>
</target>
<target name="_final_release_check" depends="_verify_config_for_release">
<fail message="Insufficient Build Configuration for ICU4J Release" unless="release.build.config.ok"/>
<fail message="Maven Ant Tasks are required to publish libraries. Set maven-ant-tasks.jar property. Maven Ant Tasks URL: http://maven.apache.org/ant-tasks/" unless="maven-ant-tasks.jar"/>
<condition property="no_maven-ant-tasks">
<available file="${maven-ant-tasks.jar}"/>
</condition>
<fail message="Maven Ant Tasks not found at ${maven-ant-tasks.jar}" unless="no_maven-ant-tasks"/>
</target>
<!--
The ant target releaseFinal is used for ICU official release.
This target builds ICU4J library jars, source jars and API document jars.
Also, this target publishes ICU4J artifacts to OSSRH staging repository.
Prerequisites
1) Apache Maven Ant tasks - http://maven.apache.org/ant-tasks
Note: Apache Maven Ant tasks was already deprecated. You can still
download the latest version from Maven Central
http://central.maven.org/maven2/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar
TODO: Because mavne-ant-tasks was already deprecated and no longer maintained,
we should look for alternative solution.
2) GnuPG
3) Put build-local.properties to specify followings
maven-ant-tasks.jar = [location of maven ant tasks jar file]
gpg.user = ICU Project
4) Maven configuration file ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>icu4j-releases</id>
<username>[oss.sonatype.org Nexus account ID]</username>
<password>[oss.sonatype.org Nexus account password]</password>
</server>
<server>
<id>icu4j-snapshots</id>
<username>[oss.sonatype.org Nexus account ID]</username>
<password>[oss.sonatype.org Nexus account password]</password>
</server>
</servers>
</settings>
-->
<target name="releaseFinal" depends="info, _final_release_check, releaseVer, docsMaven"
description="Build all ICU4J release files for distribution and upload them to the OSSRH staging repository">
<property name="maven.pom.dir" value="maven"/>
<property name="maven.icu4j.release.dir" value="${release.dir}/maven/icu4j"/>
<property name="maven.charset.release.dir" value="${release.dir}/maven/icu4j-charset"/>
<property name="maven.localespi.release.dir" value="${release.dir}/maven/icu4j-localespi"/>
<property name="maven.icu4j.jar.file" value="icu4j-${maven.pom.ver}.jar"/>
<property name="maven.icu4j.src.jar.file" value="icu4j-${maven.pom.ver}-sources.jar"/>
<property name="maven.icu4j.doc.jar.file" value="icu4j-${maven.pom.ver}-javadoc.jar"/>
<property name="maven.charset.jar.file" value="icu4j-charset-${maven.pom.ver}.jar"/>
<property name="maven.charset.src.jar.file" value="icu4j-charset-${maven.pom.ver}-sources.jar"/>
<property name="maven.charset.doc.jar.file" value="icu4j-charset-${maven.pom.ver}-javadoc.jar"/>
<property name="maven.localespi.jar.file" value="icu4j-localespi-${maven.pom.ver}.jar"/>
<property name="maven.localespi.src.jar.file" value="icu4j-localespi-${maven.pom.ver}-sources.jar"/>
<property name="maven.localespi.doc.jar.file" value="icu4j-localespi-${maven.pom.ver}-javadoc.jar"/>
<delete dir="${release.dir}/maven"/>
<mkdir dir="${maven.icu4j.release.dir}"/>
<mkdir dir="${maven.charset.release.dir}"/>
<mkdir dir="${maven.localespi.release.dir}"/>
<!-- copy pom.xml with version -->
<copy file="${maven.pom.dir}/icu4j/pom.xml" todir="${maven.icu4j.release.dir}">
<filterset>
<filter token="POMVERSION" value="${maven.pom.ver}"/>
</filterset>
</copy>
<copy file="${maven.pom.dir}/icu4j-charset/pom.xml" todir="${maven.charset.release.dir}">
<filterset>
<filter token="POMVERSION" value="${maven.pom.ver}"/>
</filterset>
</copy>
<copy file="${maven.pom.dir}/icu4j-localespi/pom.xml" todir="${maven.localespi.release.dir}">
<filterset>
<filter token="POMVERSION" value="${maven.pom.ver}"/>
</filterset>
</copy>
<!-- copy ICU release binaries and source archive to the maven release directory -->
<copy file="${release.dir}/${icu4j.jar.versioned.file}"
tofile="${maven.icu4j.release.dir}/${maven.icu4j.jar.file}"/>
<copy file="${release.dir}/${icu4j-charset.jar.versioned.file}"
tofile="${maven.charset.release.dir}/${maven.charset.jar.file}"/>
<copy file="${release.dir}/${icu4j-localespi.jar.versioned.file}"
tofile="${maven.localespi.release.dir}/${maven.localespi.jar.file}"/>
<copy file="${release.dir}/${icu4j-src.jar.versioned.file}"
tofile="${maven.icu4j.release.dir}/${maven.icu4j.src.jar.file}"/>
<copy file="${release.dir}/${icu4j-charset-src.jar.versioned.file}"
tofile="${maven.charset.release.dir}/${maven.charset.src.jar.file}"/>
<copy file="${release.dir}/${icu4j-localespi-src.jar.versioned.file}"
tofile="${maven.localespi.release.dir}/${maven.localespi.src.jar.file}"/>
<!-- javadoc jar for maven release -->
<jar jarfile="${maven.icu4j.release.dir}/${maven.icu4j.doc.jar.file}"
compress="true"
basedir="${maven.doc.base.dir}/icu4j"/>
<jar jarfile="${maven.charset.release.dir}/${maven.charset.doc.jar.file}"
compress="true"
basedir="${maven.doc.base.dir}/charset"/>
<jar jarfile="${maven.localespi.release.dir}/${maven.localespi.doc.jar.file}"
compress="true"
basedir="${maven.doc.base.dir}/localespi"/>
<!-- sign release files-->
<macrodef name="gpg">
<attribute name="file"/>
<sequential>
<delete file="@{file}.asc" failonerror="false"/>
<exec executable="gpg">
<arg value="-u"/>
<arg value="${gpg.user}"/>
<arg value="-ab"/>
<arg value="-o"/>
<arg value="@{file}.asc"/>
<arg value="@{file}"/>
</exec>
</sequential>
</macrodef>
<gpg file="${maven.icu4j.release.dir}/pom.xml"/>
<gpg file="${maven.icu4j.release.dir}/${maven.icu4j.jar.file}"/>
<gpg file="${maven.icu4j.release.dir}/${maven.icu4j.src.jar.file}"/>
<gpg file="${maven.icu4j.release.dir}/${maven.icu4j.doc.jar.file}"/>
<gpg file="${maven.charset.release.dir}/pom.xml"/>
<gpg file="${maven.charset.release.dir}/${maven.charset.jar.file}"/>
<gpg file="${maven.charset.release.dir}/${maven.charset.src.jar.file}"/>
<gpg file="${maven.charset.release.dir}/${maven.charset.doc.jar.file}"/>
<gpg file="${maven.localespi.release.dir}/pom.xml"/>
<gpg file="${maven.localespi.release.dir}/${maven.localespi.jar.file}"/>
<gpg file="${maven.localespi.release.dir}/${maven.localespi.src.jar.file}"/>
<gpg file="${maven.localespi.release.dir}/${maven.localespi.doc.jar.file}"/>
<!-- deploy ICU4J artifacts to the OSSRH staging repository -->
<path id="maven-ant-tasks.classpath" path="${maven-ant-tasks.jar}"/>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
classpathref="maven-ant-tasks.classpath"/>
<deploy xmlns="urn:maven-artifact-ant" file="${maven.icu4j.release.dir}/${maven.icu4j.jar.file}">
<pom file="${maven.icu4j.release.dir}/pom.xml"/>
<attach file="${maven.icu4j.release.dir}/pom.xml.asc" type="pom.asc"/>
<attach file="${maven.icu4j.release.dir}/${maven.icu4j.jar.file}.asc" type="jar.asc"/>
<attach file="${maven.icu4j.release.dir}/${maven.icu4j.src.jar.file}" classifier="sources"/>
<attach file="${maven.icu4j.release.dir}/${maven.icu4j.src.jar.file}.asc" classifier="sources" type="jar.asc"/>
<attach file="${maven.icu4j.release.dir}/${maven.icu4j.doc.jar.file}" classifier="javadoc"/>
<attach file="${maven.icu4j.release.dir}/${maven.icu4j.doc.jar.file}.asc" classifier="javadoc" type="jar.asc"/>
</deploy>
<deploy xmlns="urn:maven-artifact-ant" file="${maven.charset.release.dir}/${maven.charset.jar.file}">
<pom file="${maven.charset.release.dir}/pom.xml"/>
<attach file="${maven.charset.release.dir}/pom.xml.asc" type="pom.asc"/>
<attach file="${maven.charset.release.dir}/${maven.charset.jar.file}.asc" type="jar.asc"/>
<attach file="${maven.charset.release.dir}/${maven.charset.src.jar.file}" classifier="sources"/>
<attach file="${maven.charset.release.dir}/${maven.charset.src.jar.file}.asc" classifier="sources" type="jar.asc"/>
<attach file="${maven.charset.release.dir}/${maven.charset.doc.jar.file}" classifier="javadoc"/>
<attach file="${maven.charset.release.dir}/${maven.charset.doc.jar.file}.asc" classifier="javadoc" type="jar.asc"/>
</deploy>
<deploy xmlns="urn:maven-artifact-ant" file="${maven.localespi.release.dir}/${maven.localespi.jar.file}">
<pom file="${maven.localespi.release.dir}/pom.xml"/>
<attach file="${maven.localespi.release.dir}/pom.xml.asc" type="pom.asc"/>
<attach file="${maven.localespi.release.dir}/${maven.localespi.jar.file}.asc" type="jar.asc"/>
<attach file="${maven.localespi.release.dir}/${maven.localespi.src.jar.file}" classifier="sources"/>
<attach file="${maven.localespi.release.dir}/${maven.localespi.src.jar.file}.asc" classifier="sources" type="jar.asc"/>
<attach file="${maven.localespi.release.dir}/${maven.localespi.doc.jar.file}" classifier="javadoc"/>
<attach file="${maven.localespi.release.dir}/${maven.localespi.doc.jar.file}.asc" classifier="javadoc" type="jar.asc"/>
</deploy>
</target>
<target name="releaseVer" depends="info, releaseBinaries, releaseJarCheck, releaseSrcJars, releaseDocs, releaseSourceArchiveTgz"
description="Build all ICU4J release files for distribution with versioned file names">
<!-- binaries -->
<move file="${release.dir}/${icu4j.jar.file}" tofile="${release.dir}/${icu4j.jar.versioned.file}"/>
<move file="${release.dir}/${icu4j-charset.jar.file}" tofile="${release.dir}/${icu4j-charset.jar.versioned.file}"/>
<move file="${release.dir}/${icu4j-localespi.jar.file}" tofile="${release.dir}/${icu4j-localespi.jar.versioned.file}"/>
<!-- source jars -->
<move file="${release.dir}/${icu4j-src.jar.file}" tofile="${release.dir}/${icu4j-src.jar.versioned.file}"/>
<move file="${release.dir}/${icu4j-charset-src.jar.file}" tofile="${release.dir}/${icu4j-charset-src.jar.versioned.file}"/>
<move file="${release.dir}/${icu4j-localespi-src.jar.file}" tofile="${release.dir}/${icu4j-localespi-src.jar.versioned.file}"/>
<!-- docs -->
<move file="${release.dir}/${icu4jdocs.jar.file}" tofile="${release.dir}/${icu4jdocs.jar.versioned.file}"/>
<!-- package archive -->
<move file="${release.dir}/${icu4jsrc.tgz.file}" tofile="${release.dir}/${icu4jsrc.tgz.versioned.file}"/>
<!-- md5 checksum file -->
<mkdir dir="${out.dir}/checksum"/>
<delete dir="${out.dir}/checksum" includes="**/*"/>
<checksum todir="${out.dir}/checksum" format="MD5SUM">
<fileset dir="${release.dir}">
<include name="*.jar"/>
<include name="*.tgz"/>
</fileset>
</checksum>
<concat destfile="${release.dir}/icu4j-${release.file.ver}.md5">
<fileset dir="${out.dir}/checksum" includes="*"/>
<filterchain>
<fixcrlf eol="lf"/>
</filterchain>
</concat>
<antcall target="_verify_config_for_release"/>
</target>
<target name="release" depends="info, releaseBinaries, releaseSrcJars, releaseDocs, releaseSourceArchiveTgz" description="Build all ICU4J release files for distribution">
<mkdir dir="${out.dir}/checksum"/>
<delete dir="${out.dir}/checksum" includes="**/*"/>
<checksum todir="${out.dir}/checksum" format="MD5SUM">
<fileset dir="${release.dir}">
<include name="*.jar"/>
<include name="*.tgz"/>
</fileset>
</checksum>
<concat destfile="${release.dir}/icu4j.md5">
<fileset dir="${out.dir}/checksum" includes="*"/>
<filterchain>
<fixcrlf eol="lf"/>
</filterchain>
</concat>
<antcall target="_verify_config_for_release"/>
</target>
<target name="releaseBinaries" depends="icu4jJar, charset, localespi" description="Build ICU4J binary files for distribution">
<mkdir dir="${release.dir}"/>
<copy file="${icu4j.jar.file}" tofile="${release.dir}/${icu4j.jar.file}"/>
<copy file="${icu4j.charset.jar}" tofile="${release.dir}/${icu4j-charset.jar.file}"/>
<copy file="${icu4j.localespi.jar}" tofile="${release.dir}/${icu4j-localespi.jar.file}"/>
</target>
<target name="releaseSrcJars" depends="icu4jSrcJar" description="Build ICU4J src jar files for distribution">
<mkdir dir="${release.dir}"/>
<!-- icu4j src-jar -->
<copy file="${icu4j-src.jar.file}" tofile="${release.dir}/${icu4j-src.jar.file}"/>
<!-- charset/localespi src-jar -->
<ant dir="${icu4j.charset.dir}" target="src-jar" inheritAll="false"/>
<ant dir="${icu4j.localespi.dir}" target="src-jar" inheritAll="false"/>
<copy file="${icu4j.charset.dir}/${out.dir}/lib/${icu4j-charset-src.jar.file}" tofile="${release.dir}/${icu4j-charset-src.jar.file}"/>
<copy file="${icu4j.localespi.dir}/${out.dir}/lib/${icu4j-localespi-src.jar.file}" tofile="${release.dir}/${icu4j-localespi-src.jar.file}"/>
</target>
<target name="releaseDocs" depends="docs" description="Build ICU4J API reference doc jar file for distribution">
<mkdir dir="${release.dir}"/>
<jar jarfile="${release.dir}/${icu4jdocs.jar.file}" compress="true" basedir="${doc.dir}"/>
</target>
<property name="src.release.wrk.dir" value="${out.dir}/tmpsrc"/>
<target name="releaseSourceArchiveZip" description="Build ICU4J source release archive (.zip)">
<delete dir="${src.release.wrk.dir}"/>
<delete file="${icu4jsrc.zip.file}"/>
<mkdir dir="${src.release.wrk.dir}"/>
<fixcrlf srcdir="."
destdir="${src.release.wrk.dir}"
encoding="UTF-8"
eol="crlf">
<include name="demos/**/*"/>
<include name="main/**/*"/>
<include name="perf-tests/**/*"/>
<include name="samples/**/*"/>
<include name="tools/**/*"/>
<include name="*.html"/>
<include name="*.xml"/>
<include name="*.properties"/>
<include name="*.css"/>
<include name="*.stub"/>
<exclude name="**/out/**/*"/>
<exclude name="**/*.jar"/>
<exclude name="**/build-local.properties"/>
<exclude name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
<exclude name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
<exclude name="tools/build/icu4j*.api*.gz"/>
</fixcrlf>
<mkdir dir="${release.dir}"/>
<zip destfile="${release.dir}/${icu4jsrc.zip.file}">
<fileset dir="${src.release.wrk.dir}" includes="**/*"/>
<fileset dir="${basedir}">
<include name="main/shared/data/*.jar"/>
<include name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
<include name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
<include name="tools/build/icu4j*.api*.gz"/>
</fileset>
</zip>
<delete dir="${src.release.wrk.dir}"/>
</target>
<target name="releaseSourceArchiveTgz" description="Build ICU4J source release archive (.tgz)">
<delete dir="${src.release.wrk.dir}"/>
<delete file="${icu4jsrc.tgz.file}"/>
<mkdir dir="${src.release.wrk.dir}"/>
<fixcrlf srcdir="."
destdir="${src.release.wrk.dir}"
encoding="UTF-8"
eol="lf">
<include name="demos/**/*"/>
<include name="main/**/*"/>
<include name="maven/**/*"/>
<include name="perf-tests/**/*"/>
<include name="samples/**/*"/>
<include name="tools/**/*"/>
<include name="*.html"/>
<include name="*.xml"/>
<include name="*.properties"/>
<include name="*.css"/>
<include name="*.stub"/>
<exclude name="**/out/**/*"/>
<exclude name="**/*.jar"/>
<exclude name="**/build-local.properties"/>
<exclude name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
<exclude name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
<exclude name="tools/build/icu4j*.api*.gz"/>
</fixcrlf>
<property name="icu4jsrc.tar" value="${out.dir}/icu4jsrc.tar"/>
<tar destfile="${icu4jsrc.tar}" longfile="gnu">
<fileset dir="${src.release.wrk.dir}" includes="**/*"/>
<fileset dir="${basedir}">
<include name="main/shared/data/*.jar"/>
<include name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
<include name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
<include name="tools/build/icu4j*.api*.gz"/>
</fileset>
</tar>
<mkdir dir="${release.dir}"/>
<gzip destfile="${release.dir}/${icu4jsrc.tgz.file}" src="${icu4jsrc.tar}"/>
<delete dir="${src.release.wrk.dir}"/>
<delete file="${icu4jsrc.tar}"/>
</target>
<!-- findbugs targets -->
<target name="findbugs" description="Run FindBugs on all library sub projects.">
<property name="findbugs.out.dir" value="${out.dir}/findbugs"/>
<mkdir dir="${findbugs.out.dir}"/>
<ant dir="${icu4j.core.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.core.dir}/${out.dir}/fb-core.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.collate.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.collate.dir}/${out.dir}/fb-collate.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.currdata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.currdata.dir}/${out.dir}/fb-currdata.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.langdata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.langdata.dir}/${out.dir}/fb-langdata.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.regiondata.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.regiondata.dir}/${out.dir}/fb-regiondata.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.translit.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.translit.dir}/${out.dir}/fb-translit.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.charset.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.charset.dir}/${out.dir}/fb-charset.html" todir="${findbugs.out.dir}"/>
<ant dir="${icu4j.localespi.dir}" inheritAll="false" target="findbugs"/>
<copy file="${icu4j.localespi.dir}/${out.dir}/fb-localespi.html" todir="${findbugs.out.dir}"/>
</target>
<!-- compile targets -->
<target name="core" description="Build core classes">
<ant dir="${icu4j.core.dir}" inheritAll="false"/>
</target>
<target name="collate" depends="core" description="Build collation classes">
<ant dir="${icu4j.collate.dir}" inheritAll="false"/>
</target>
<target name="charset" depends="core" description="Build charset classes">
<ant dir="${icu4j.charset.dir}" inheritAll="false"/>
</target>
<target name="currdata" depends="core" description="Build currency data classes">
<ant dir="${icu4j.currdata.dir}" inheritAll="false"/>
</target>
<target name="langdata" depends="core" description="Build language data classes">
<ant dir="${icu4j.langdata.dir}" inheritAll="false"/>
</target>
<target name="localespi" depends="core, collate, currdata, langdata, regiondata" description="Build Locale SPI classes">
<ant dir="${icu4j.localespi.dir}" inheritAll="false"/>
</target>
<target name="regiondata" depends="core" description="Build region data classes">
<ant dir="${icu4j.regiondata.dir}" inheritAll="false"/>
</target>
<target name="translit" depends="core" description="Build translit classes">
<ant dir="${icu4j.translit.dir}" inheritAll="false"/>
</target>
<target name="test-framework" depends="core, init" description="Build test framework classes">
<ant dir="${icu4j.test-framework.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="core-tests" depends="core, test-framework, tools" description="Build core tests">
<ant dir="${icu4j.core-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="collate-tests" depends="collate, test-framework" description="Build core tests">
<ant dir="${icu4j.collate-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="charset-tests" depends="charset, test-framework" description="Build charset tests">
<ant dir="${icu4j.charset-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="localespi-tests" depends="localespi, test-framework" description="Build Locale SPI tests">
<ant dir="${icu4j.localespi-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="packaging-tests" depends="test-framework" description="Build packaging tests">
<ant dir="${icu4j.packaging-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="translit-tests" depends="translit, test-framework" description="Build translit tests">
<ant dir="${icu4j.translit-tests.dir}" inheritAll="false">
<reference refid="junit.jars"/>
</ant>
</target>
<target name="demos" depends="core, charset, translit" description="Build demo classes">
<ant dir="${icu4j.demos.dir}" inheritAll="false"/>
</target>
<target name="samples" depends="core, charset, collate, translit" description="Build sample classes">
<ant dir="${icu4j.samples.dir}" inheritAll="false"/>
</target>
<target name="_checkBuildToolsSupported" unless="is.java8">
<fail>JDK8 is required to build build-tools.</fail>
</target>
<target name="build-tools" depends="_checkBuildToolsSupported" description="Build build-tool classes">
<ant dir="${icu4j.build-tools.dir}" inheritAll="false"/>
</target>
<target name="tools" depends="core, collate, translit" description="Build tool classes">
<ant dir="${icu4j.tools.dir}" inheritAll="false"/>
</target>
<target name="perf-tests" depends="core, charset, collate, tools" description="Build performance test classes">
<ant dir="${icu4j.perf-tests.dir}" inheritAll="false"/>
</target>
<!-- doc targets -->
<target name="docs" depends="info, build-tools, _checkJCite, _docsWithJCite, _docsWithoutJCite" description="Build API documents"/>
<target name="docsStrict" description="Build API documents with all doclint check enabled">
<condition property="doclint.option" value="-Xdoclint:all">
<isset property="is.java8.plus"/>
</condition>
<antcall target="docs"/>
</target>
<target name="_checkJCite" if="env.JCITE_DIR">
<fileset dir="${env.JCITE_DIR}" id="jcite.files">
<include name="build/*.jar"/>
<include name="lib/*.jar"/>
</fileset>
<pathconvert property="jcite.libs" refid="jcite.files"/>
<dirset dir="${basedir}" id="jcite.src.dirs">
<include name="samples/src"/>
<include name="demos/src"/>
<include name="main/tests/*/src"/>
</dirset>
<pathconvert property="jcite.addl.src" refid="jcite.src.dirs"/>
</target>
<target name="_docsOptions">
<property name="docs.style.sheet" value="stylesheet8.css"/>
<property name="doclint.option" value="-Xdoclint:reference,html"/>
</target>
<target name="_docsWithJCite" depends="_checkJCite, _docsOptions" if="jcite.libs">
<echo message="Javadoc lint option: ${doclint.option}"/>
<echo message="JCite library path: ${jcite.libs}"/>
<echo message="JCite additional source path: ${jcite.addl.src}"/>
<echo message="Custom stylesheet: ${docs.style.sheet}"/>
<javadoc
destdir="${doc.dir}"
nodeprecatedlist="true"
windowtitle="${icu4j.api.doc.window.title}"
doctitle="${icu4j.api.doc.title}"
header="${icu4j.api.doc.header}"
encoding="${java.src.encoding}"
docencoding="UTF-8"
charset="UTF-8"
bottom="${icu4j.api.doc.copyright.footer}"
additionalparam="${doclint.option} -breakiterator -use -tagletpath ${icu4j.build-tools.jar}${path.separator}${jcite.libs} -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -taglet ch.arrenbrecht.jcite.JCiteTaglet -J-Djcitesourcepath=${jcite.addl.src} -J-Dfile.encoding=UTF-8"
link="${icu4j.api.doc.jdk.link}"
source="${javac.source}"
stylesheetfile="${docs.style.sheet}"
failonerror="true">
<packageset dir="${icu4j.core.dir}/src">
<include name="com/ibm/icu/lang/**"/>
<include name="com/ibm/icu/math/**"/>
<include name="com/ibm/icu/message2/**"/>
<include name="com/ibm/icu/number/**"/>
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<packageset dir="${icu4j.translit.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</packageset>
</javadoc>
</target>
<target name="_docsWithoutJCite" depends="_checkJCite, _docsOptions" unless="jcite.libs">
<echo message="Javadoc lint option: ${doclint.option}"/>
<javadoc
destdir="${doc.dir}"
nodeprecatedlist="true"
windowtitle="${icu4j.api.doc.window.title}"
doctitle="${icu4j.api.doc.title}"
header="${icu4j.api.doc.header}"
encoding="${java.src.encoding}"
docencoding="UTF-8"
charset="UTF-8"
bottom="${icu4j.api.doc.copyright.footer}"
additionalparam="${doclint.option} -breakiterator -use -tagletpath ${icu4j.build-tools.jar} -taglet com.ibm.icu.dev.tool.docs.ICUTaglet"
link="${icu4j.api.doc.jdk.link}"
source="${javac.source}"
failonerror="true">
<packageset dir="${icu4j.core.dir}/src">
<include name="com/ibm/icu/lang/**"/>
<include name="com/ibm/icu/math/**"/>
<include name="com/ibm/icu/message2/**"/>
<include name="com/ibm/icu/number/**"/>
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<packageset dir="${icu4j.translit.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</packageset>
</javadoc>
</target>
<!-- Component document targets, only used for Maven repository releases -->
<target name="docsMaven" depends="info, build-tools, _checkJCite, _mavenIcu4jDoc, _mavenCharsetDoc, _mavenLocalespiDoc"
description="Build API docs for each ICU4J maven artifact"/>
<target name="_mavenIcu4jDoc" depends="_docsOptions">
<fail message="JCite must be configured." unless="jcite.libs"/>
<delete dir="${maven.doc.base.dir}/icu4j"/>
<echo message="Javadoc lint option: ${doclint.option}"/>
<echo message="JCite library path: ${jcite.libs}"/>
<echo message="JCite additional source path: ${jcite.addl.src}"/>
<echo message="Custom stylesheet: ${docs.style.sheet}"/>
<javadoc
destdir="${maven.doc.base.dir}/icu4j"
nodeprecatedlist="true"
windowtitle="${icu4j.main.api.doc.window.title}"
doctitle="${icu4j.main.api.doc.title}"
header="${icu4j.main.api.doc.header}"
encoding="${java.src.encoding}"
docencoding="UTF-8"
charset="UTF-8"
bottom="${icu4j.api.doc.copyright.footer}"
additionalparam="${doclint.option} -breakiterator -use -tagletpath ${icu4j.build-tools.jar}${path.separator}${jcite.libs} -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -taglet ch.arrenbrecht.jcite.JCiteTaglet -J-Djcitesourcepath=${jcite.addl.src} -J-Dfile.encoding=UTF-8"
link="${icu4j.api.doc.jdk.link}"
source="${javac.source}"
stylesheetfile="${docs.style.sheet}"
failonerror="true">
<packageset dir="${icu4j.core.dir}/src">
<include name="com/ibm/icu/lang/**"/>
<include name="com/ibm/icu/math/**"/>
<include name="com/ibm/icu/message2/**"/>
<include name="com/ibm/icu/number/**"/>
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<packageset dir="${icu4j.translit.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
</javadoc>
</target>
<target name="_mavenCharsetDoc" depends="_docsOptions, icu4jJar">
<fail message="JCite must be configured." unless="jcite.libs"/>
<delete dir="${maven.doc.base.dir}/charset"/>
<echo message="Javadoc lint option: ${doclint.option}"/>
<echo message="JCite library path: ${jcite.libs}"/>
<echo message="JCite additional source path: ${jcite.addl.src}"/>
<echo message="Custom stylesheet: ${docs.style.sheet}"/>
<javadoc
destdir="${maven.doc.base.dir}/charset"
nodeprecatedlist="true"
windowtitle="${icu4j.charset.api.doc.window.title}"
doctitle="${icu4j.charset.api.doc.title}"
header="${icu4j.charset.api.doc.header}"
encoding="${java.src.encoding}"
docencoding="UTF-8"
charset="UTF-8"
bottom="${icu4j.api.doc.copyright.footer}"
additionalparam="${doclint.option} -breakiterator -use -tagletpath ${icu4j.build-tools.jar}${path.separator}${jcite.libs} -taglet com.ibm.icu.dev.tool.docs.ICUTaglet -taglet ch.arrenbrecht.jcite.JCiteTaglet -J-Djcitesourcepath=${jcite.addl.src} -J-Dfile.encoding=UTF-8"
link="${icu4j.api.doc.jdk.link}"
source="${javac.source}"
stylesheetfile="${docs.style.sheet}"
failonerror="true"
classpath="${icu4j.jar.file}">
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</packageset>
</javadoc>
</target>
<target name="_mavenLocalespiDoc" depends="_docsOptions">
<delete dir="${maven.doc.base.dir}/localespi"/>
<echo message="Javadoc lint option: ${doclint.option}"/>
<echo message="Custom stylesheet: ${docs.style.sheet}"/>
<javadoc
destdir="${maven.doc.base.dir}/localespi"
nodeprecatedlist="true"
windowtitle="${icu4j.localespi.api.doc.window.title}"
doctitle="${icu4j.localespi.api.doc.title}"
header="${icu4j.localespi.api.doc.header}"
encoding="${java.src.encoding}"
docencoding="UTF-8"
charset="UTF-8"
bottom="${icu4j.api.doc.copyright.footer}"
additionalparam="${doclint.option} -breakiterator -use"
link="${icu4j.api.doc.jdk.link}"
source="${javac.source}"
failonerror="true"
classpath="${icu4j.jar.file}">
<packageset dir="${icu4j.localespi.dir}/src">
<include name="com/ibm/icu/impl/javaspi"/>
</packageset>
</javadoc>
</target>
<!-- JaCoCo code coverage target -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" onerror="ignore">
<classpath path="${env.JACOCO_DIR}/lib/jacocoant.jar"/>
</taskdef>
<target name="coverageJaCoCo" depends="build-tools, jar, tests" description="Run the ICU4J unit tests and generate code coverage report">
<property name="jacoco.out.dir" value="${out.dir}/jacoco"/>
<property name="jacoco.exec.data.file" value="${jacoco.out.dir}/jacoco.exec"/>
<property name="jacoco.report.html.zip" value="${jacoco.out.dir}/report_html.zip"/>
<property name="jacoco.report.xml" value="${jacoco.out.dir}/report.xml"/>
<property name="jacoco.report.csv" value="${jacoco.out.dir}/report.csv"/>
<property name="jacoco.exclusion.txt" value="coverage-exclusion.txt"/>
<delete dir="${jacoco.out.dir}"/>
<mkdir dir="${jacoco.out.dir}"/>
<!-- core -->
<jacoco:coverage destfile="${jacoco.exec.data.file}">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="junit.jars"/>
<path refid="junit.icu.jars"/>
</classpath>
<batchtest todir="${junit.out.dir}/core">
<fileset dir="${icu4j.core-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<!-- charset -->
<jacoco:coverage destfile="${jacoco.exec.data.file}">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="junit.jars"/>
<path refid="junit.icu.jars"/>
</classpath>
<batchtest todir="${junit.out.dir}/charset">
<fileset dir="${icu4j.charset-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<!-- collate -->
<jacoco:coverage destfile="${jacoco.exec.data.file}">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="junit.jars"/>
<path refid="junit.icu.jars"/>
</classpath>
<batchtest todir="${junit.out.dir}/collate">
<fileset dir="${icu4j.collate-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<!-- translit -->
<jacoco:coverage destfile="${jacoco.exec.data.file}">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
<jvmarg value="-ea"/>
<jvmarg value="-Djava.awt.headless=true"/>
<classpath>
<path refid="junit.jars"/>
<path refid="junit.icu.jars"/>
</classpath>
<batchtest todir="${junit.out.dir}/translit">
<fileset dir="${icu4j.translit-tests.dir}/${bin.dir}">
<patternset refid="test-classes-patternset"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
<jacoco:report>
<executiondata>
<file file="${jacoco.exec.data.file}"/>
</executiondata>
<structure name="ICU4J Project">
<classfiles>
<fileset dir=".">
<include name="${icu4j.jar.file}"/>
<include name="${icu4j-charset.jar.file}"/>
</fileset>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="${icu4j.core.dir}/src"/>
<fileset dir="${icu4j.collate.dir}/src"/>
<fileset dir="${icu4j.currdata.dir}/src"/>
<fileset dir="${icu4j.langdata.dir}/src"/>
<fileset dir="${icu4j.regiondata.dir}/src"/>
<fileset dir="${icu4j.translit.dir}/src"/>
<fileset dir="${icu4j.charset.dir}/src"/>
</sourcefiles>
</structure>
<html destfile="${jacoco.report.html.zip}"/>
<xml destfile="${jacoco.report.xml}"/>
<csv destfile="${jacoco.report.csv}"/>
</jacoco:report>
<java classname="com.ibm.icu.dev.tool.coverage.JacocoReportCheck" failonerror="true">
<arg line="${jacoco.report.xml} ${jacoco.exclusion.txt}"/>
<classpath>
<pathelement location="${icu4j.build-tools.jar}"/>
</classpath>
</java>
</target>
<!-- Release management targets -->
<target name="checktags" depends="info, build-tools" description="Check API tags before release - This is currently not working as designed">
<javadoc source="${javac.source}"
encoding="${java.src.encoding}">
<packageset dir="${icu4j.core.dir}/src">
<include name="com/ibm/icu/lang/**"/>
<include name="com/ibm/icu/math/**"/>
<include name="com/ibm/icu/message2/**"/>
<include name="com/ibm/icu/number/**"/>
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</packageset>
<doclet name="com.ibm.icu.dev.tool.docs.CheckTags" path="${icu4j.build-tools.jar}"/>
</javadoc>
</target>
<target name="gatherapi" depends="info, build-tools" description="Run API database generator tool">
<mkdir dir="${out.dir}"/>
<javadoc source="${javac.source}"
encoding="${java.src.encoding}">
<packageset dir="${icu4j.core.dir}/src">
<include name="com/ibm/icu/lang/**"/>
<include name="com/ibm/icu/math/**"/>
<include name="com/ibm/icu/message2/**"/>
<include name="com/ibm/icu/number/**"/>
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.collate.dir}/src">
<include name="com/ibm/icu/text/**"/>
<include name="com/ibm/icu/util/**"/>
</packageset>
<packageset dir="${icu4j.charset.dir}/src">
<include name="com/ibm/icu/charset/**"/>
</packageset>
<packageset dir="${icu4j.translit.dir}/src">
<include name="com/ibm/icu/text/**"/>
</packageset>
<doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${icu4j.build-tools.jar}">
<param name="-name" value="ICU4J ${icu4j.impl.version}"/>
<param name="-output" value="${out.dir}/icu4j${api.report.version}.api3"/>
<param name="-internal"/>
<param name="-version"/>
<param name="-gzip"/>
</doclet>
</javadoc>
</target>
<target name="apireport" depends="info, gatherapi" description="Run API report generator tool">
<java classname="com.ibm.icu.dev.tool.docs.ReportAPI"
classpath="${icu4j.build-tools.jar}"
failonerror="true">
<arg value="-old:" />
<arg value="${icu4j.build-tools.dir}/icu4j${api.report.prev.version}.api3.gz" />
<arg value="-new:" />
<arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
<arg value="-html" />
<arg value="-out:" />
<arg value="${out.dir}/icu4j_compare_${api.report.prev.version}_${api.report.version}.html" />
</java>
</target>
<target name="checkDeprecated" depends="info, build-tools, gatherapi, main"
description="Check consistency between javadoc @deprecated and @Deprecated annotation">
<java classname="com.ibm.icu.dev.tool.docs.DeprecatedAPIChecker"
failonerror="true">
<arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
<classpath>
<pathelement location="${icu4j.build-tools.jar}"/>
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.currdata.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
<pathelement location="${icu4j.translit.jar}"/>
</classpath>
</java>
</target>
<target name="checkAPIStatusConsistency" depends="info, build-tools, gatherapi"
description="Check consistency between API class status and methods overriding java.lang.Object">
<!--
If you need classes excluded from this check, define following property in build-local.properties.
e.g. checkAPIStatusConsistency.skip.classes=com.ibm.icu.text.Normalizer;com.ibm.icu.util.ULocale
-->
<property name="checkAPIStatusConsistency.skip.classes" value=""/>
<java classname="com.ibm.icu.dev.tool.docs.APIStatusConsistencyChecker"
failonerror="true">
<arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
<arg value="${checkAPIStatusConsistency.skip.classes}" />
<classpath>
<pathelement location="${icu4j.build-tools.jar}"/>
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.currdata.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
<pathelement location="${icu4j.translit.jar}"/>
</classpath>
</java>
</target>
<target name="checkAPIStatus" depends="checkAPIStatusConsistency, checkDeprecated"/>
<target name="draftAPIs" depends="info, gatherapi" description="Run API collector tool and generate draft API report in html">
<java classname="com.ibm.icu.dev.tool.docs.CollectAPI"
classpath="${icu4j.build-tools.jar}"
failonerror="true">
<arg value="-f"/>
<arg value="Draft"/>
<arg value="-o"/>
<arg value="${out.dir}/draftAPIs.html"/>
<arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
</java>
</target>
<target name="draftAPIsTSV" depends="info, gatherapi" description="Run API collector tool and generate draft API report in TSV">
<java classname="com.ibm.icu.dev.tool.docs.CollectAPI"
classpath="${icu4j.build-tools.jar}"
failonerror="true">
<arg value="-f"/>
<arg value="Draft"/>
<arg value="-o"/>
<arg value="${out.dir}/draftAPIs.tsv"/>
<arg value="-t"/>
<arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
</java>
</target>
<target name="serialTestData" depends="main, tests">
<property name="serial.test.data.dir" value="${out.dir}/serialTestData"/>
<delete dir="${serial.test.data.dir}"/>
<mkdir dir="${serial.test.data.dir}"/>
<java classname="com.ibm.icu.dev.test.serializable.SerializableWriter" fork="yes" failonerror="true">
<arg line="${serial.test.data.dir}"/>
<classpath>
<pathelement location="${icu4j.core.jar}"/>
<pathelement location="${icu4j.collate.jar}"/>
<pathelement location="${icu4j.charset.jar}"/>
<pathelement location="${icu4j.currdata.jar}"/>
<pathelement location="${icu4j.langdata.jar}"/>
<pathelement location="${icu4j.regiondata.jar}"/>
<pathelement location="${icu4j.translit.jar}"/>
<pathelement location="${icu4j.test-framework.jar}"/>
<pathelement location="${icu4j.core-tests.jar}"/>
</classpath>
</java>
<echo message="Note: The serialization compatibility test data files were"/>
<echo message="created in ${serial.test.data.dir}. Once you confirm"/>
<echo message="the test runs clean, you should copy the data file directory to"/>
<echo message="main/tests/core/src/com/ibm/icu/dev/test/serializable/data."/>
</target>
<!-- Special packaging targets -->
<target name="translitIMEJar" depends="info" description="Build transliterator IME 'icutransime.jar' jar file">
<property name="translit.ime.out.dir" value="${out.dir}/translit_ime"/>
<mkdir dir="${translit.ime.out.dir}/bin"/>
<javac destdir="${translit.ime.out.dir}/bin"
source="${javac.source}"
target="${javac.target}"
encoding="${java.src.encoding}"
debug="on" deprecation="off">
<src path="${icu4j.core.dir}/src"/>
<src path="${icu4j.translit.dir}/src"/>
<src path="${icu4j.tools.dir}/src"/>
<include name="com/ibm/icu/dev/tool/ime/translit/*.java"/>
</javac>
<copy file="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit/Transliterator.properties"
todir="${translit.ime.out.dir}/bin/com/ibm/icu/dev/tool/ime/translit"/>
<mkdir dir="${translit.ime.out.dir}/lib"/>
<jar jarfile="${translit.ime.out.dir}/lib/icutransime.jar"
compress="true"
basedir="${translit.ime.out.dir}/bin"
includes="com/ibm/icu/dev/tool/ime/translit/**/*"
manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit/manifest.stub">
<metainf dir="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit" includes="services/*" />
</jar>
</target>
<target name="indicIMEJar" depends="info" description="Build indic IME 'icuindicime.jar' jar file">
<property name="indic.ime.out.dir" value="${out.dir}/indic_ime"/>
<mkdir dir="${indic.ime.out.dir}/bin"/>
<javac destdir="${indic.ime.out.dir}/bin"
source="${javac.source}"
target="${javac.target}"
encoding="${java.src.encoding}"
debug="on" deprecation="off">
<src path="${icu4j.core.dir}/src"/>
<src path="${icu4j.tools.dir}/src"/>
<include name="com/ibm/icu/dev/tool/ime/indic/*.java"/>
</javac>
<copy file="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic/DisplayNames.properties"
todir="${indic.ime.out.dir}/bin/com/ibm/icu/dev/tool/ime/indic"/>
<mkdir dir="${indic.ime.out.dir}/lib"/>
<jar jarfile="${indic.ime.out.dir}/lib/icuindicime.jar"
compress="true"
basedir="${indic.ime.out.dir}/bin"
includes="com/ibm/icu/dev/tool/ime/indic/**/*"
manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic/manifest.stub">
<metainf dir="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic" includes="services/*" />
</jar>
</target>
<target name="cldrUtil" depends="icu4jJar" description="Build Utilities for CLDR tooling">
<mkdir dir="${cldr.util.out.dir}/bin"/>
<javac destdir="${cldr.util.out.dir}/bin"
source="${javac.source}"
target="${javac.target}"
encoding="${java.src.encoding}"
debug="on" deprecation="off"
classpath="${icu4j.jar.file}">
<src path="${icu4j.tools.dir}/src"/>
<src path="${icu4j.test-framework.dir}/src"/>
<include name="com/ibm/icu/dev/util/CollectionUtilities.java" />
<include name="com/ibm/icu/dev/util/ElapsedTimer.java" />
<include name="com/ibm/icu/dev/util/UnicodeMap.java" />
<include name="com/ibm/icu/dev/util/UnicodeMapIterator.java" />
<include name="com/ibm/icu/dev/tool/UOption.java" />
</javac>
<mkdir dir="${cldr.util.out.dir}/lib"/>
<copy file="tools/build/manifest-utilities.stub" todir="${out.dir}">
<filterset>
<filter token="SPECVERSION" value="${jar.spec.version}"/>
<filter token="IMPLVERSION" value="${jar.impl.version}"/>
<filter token="COPYRIGHT" value="${jar.copyright.info}"/>
<filter token="EXECENV" value="${jar.exec.env}"/>
</filterset>
</copy>
<jar jarfile="${cldr.util.out.dir}/lib/utilities.jar"
compress="true"
manifest="${out.dir}/manifest-utilities.stub"
basedir="${cldr.util.out.dir}/bin">
<include name="com/ibm/icu/dev/util/*.class"/>
<include name="com/ibm/icu/dev/tool/UOption*.class"/>
</jar>
</target>
<target name="releaseCLDR" depends="icu4jJar,icu4jSrcJar,cldrUtil" description="Build release files for CLDR tooling">
<mkdir dir="${cldr.release.dir}"/>
<!-- icu4j.jar -->
<copy file="${icu4j.jar.file}" todir="${cldr.release.dir}"/>
<!-- icu4j-src.jar -->
<copy file="${icu4j-src.jar.file}" todir="${cldr.release.dir}"/>
<!-- utilities.jar -->
<copy file="${cldr.util.out.dir}/lib/utilities.jar" todir="${cldr.release.dir}"/>
<!-- utilities-src.jar -->
<jar jarfile="${cldr.release.dir}/utilities-src.jar" compress="true">
<fileset dir="${icu4j.test-framework.dir}/${src.dir}">
<include name="com/ibm/icu/dev/util/CollectionUtilities.java" />
<include name="com/ibm/icu/dev/util/ElapsedTimer.java" />
<include name="com/ibm/icu/dev/util/UnicodeMap.java" />
<include name="com/ibm/icu/dev/util/UnicodeMapIterator.java" />
</fileset>
<fileset dir="${icu4j.tools.dir}/${src.dir}" includes="com/ibm/icu/dev/tool/UOption.java"/>
</jar>
</target>
<target name="xliff" description="Build xliff converter tool">
<property name="xliff.out.dir" value="${out.dir}/xliff"/>
<mkdir dir="${xliff.out.dir}/bin"/>
<javac destdir="${xliff.out.dir}/bin"
source="1.3"
target="1.3"
encoding="${java.src.encoding}"
debug="on" deprecation="off">
<src path="${icu4j.tools.dir}/src"/>
<include name="com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java"/>
<include name="com/ibm/icu/dev/tool/localeconverter/XLIFF2ICUConverter.java"/>
<include name="com/ibm/icu/dev/tool/UOption.java"/>
</javac>
<mkdir dir="${xliff.out.dir}/lib"/>
<jar jarfile="${xliff.out.dir}/lib/xliff-src.jar"
compress="true"
basedir="${icu4j.tools.dir}/src">
<include name="com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java"/>
<include name="com/ibm/icu/dev/tool/localeconverter/XLIFF2ICUConverter.java"/>
<include name="com/ibm/icu/dev/tool/UOption.java"/>
</jar>
<jar jarfile="${xliff.out.dir}/lib/xliff.jar"
compress="true"
basedir="${xliff.out.dir}/bin"
manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/localeconverter/manifest.stub"/>
</target>
</project>