1<!--
2* © 2016 and later: Unicode, Inc. and others.
3* License & terms of use: http://www.unicode.org/copyright.html#License
4*******************************************************************************
5* Copyright (C) 1997-2016, International Business Machines Corporation and    *
6* others. All Rights Reserved.                                                *
7*******************************************************************************
8-->
9<project name="icu4j" default="jar" basedir="."
10    xmlns:jacoco="antlib:org.jacoco.ant"
11    xmlns:ivy="antlib:org.apache.ivy.ant">
12
13    <property file="build-local.properties"/>
14    <property file="build.properties"/>
15
16    <property name="shared.dir" value="main/shared"/>
17    <import file="${shared.dir}/build/common-targets.xml"/>
18
19    <property environment="env"/>
20
21    <!-- icu4j binaries -->
22    <property name="icu4j.jar.file" value="icu4j.jar"/>
23    <property name="icu4jtests.jar.file" value="icu4jtests.jar"/>
24    <property name="icu4j-charset.jar.file" value="icu4j-charset.jar"/>
25    <property name="icu4j-localespi.jar.file" value="icu4j-localespi.jar"/>
26
27    <property name="icu4jdemos.jar.file" value="icu4jdemos.jar"/>
28
29    <!-- icu4j API doc jar file -->
30    <property name="icu4jdocs.jar.file" value="icu4j-docs.jar"/>
31
32    <!-- icu4j src jar files -->
33    <property name="icu4j-src.jar.file" value="icu4j-src.jar"/>
34    <property name="icu4j-charset-src.jar.file" value="icu4j-charset-src.jar"/>
35    <property name="icu4j-localespi-src.jar.file" value="icu4j-localespi-src.jar"/>
36
37    <!-- icu4j source package archive files -->
38    <property name="icu4jsrc.zip.file" value="icu4j.zip"/>
39    <property name="icu4jsrc.tgz.file" value="icu4j.tgz"/>
40
41    <!-- icu4j versioned release files -->
42    <property name="icu4j.jar.versioned.file" value="icu4j-${release.file.ver}.jar"/>
43    <property name="icu4j-charset.jar.versioned.file" value="icu4j-charset-${release.file.ver}.jar"/>
44    <property name="icu4j-localespi.jar.versioned.file" value="icu4j-localespi-${release.file.ver}.jar"/>
45
46    <property name="icu4j-src.jar.versioned.file" value="icu4j-${release.file.ver}-src.jar"/>
47    <property name="icu4j-charset-src.jar.versioned.file" value="icu4j-charset-${release.file.ver}-src.jar"/>
48    <property name="icu4j-localespi-src.jar.versioned.file" value="icu4j-localespi-${release.file.ver}-src.jar"/>
49
50    <property name="icu4jdocs.jar.versioned.file" value="icu4j-${release.file.ver}-docs.jar"/>
51
52    <!-- <property name="icu4jsrc.zip.versioned.file" value="icu4j-${release.file.ver}.zip"/> -->
53    <property name="icu4jsrc.tgz.versioned.file" value="icu4j-${release.file.ver}.tgz"/>
54
55    <!-- API doc -->
56    <property name="icu4j.api.doc.title" value="ICU4J ${api.doc.version} API Specification"/>
57    <property name="icu4j.api.doc.window.title" value="ICU4J ${api.doc.version}"/>
58    <property name="icu4j.api.doc.header" value="ICU4J ${api.doc.version}"/>
59    <property name="icu4j.api.doc.jdk.link" value="http://docs.oracle.com/javase/8/docs/api/"/>
60
61    <!-- directories -->
62    <property name="release.dir" value="release"/>
63    <property name="doc.dir" value="doc"/>
64    <property name="cldr.util.out.dir" value="${out.dir}/cldr_util"/>
65    <property name="cldr.release.dir" value="release_cldr"/>
66    <property name="external-jars" value="lib"/>
67
68    <!-- Java version check -->
69    <condition property="is.java6.plus">
70        <or>
71            <contains string="${java.version}" substring="1.6."/>
72            <contains string="${java.version}" substring="1.7."/>
73            <contains string="${java.version}" substring="1.8."/>
74            <contains string="${java.version}" substring="1.9."/>
75        </or>
76    </condition>
77    <fail message="The JDK version is too old or unknown.">
78        <condition>
79            <not>
80                <isset property="is.java6.plus"/>
81            </not>
82        </condition>
83    </fail>
84
85    <condition property="is.java6">
86            <contains string="${java.version}" substring="1.6."/>
87    </condition>
88
89    <condition property="is.java7">
90            <contains string="${java.version}" substring="1.7."/>
91    </condition>
92
93    <condition property="is.java8">
94            <contains string="${java.version}" substring="1.8."/>
95    </condition>
96
97    <condition property="is.java9">
98            <contains string="${java.version}" substring="1.9."/>
99    </condition>
100
101    <condition property="is.java7.plus">
102        <or>
103            <isset property="is.java7"/>
104            <isset property="is.java8"/>
105            <isset property="is.java9"/>
106        </or>
107    </condition>
108
109    <condition property="is.java8.plus">
110        <or>
111            <isset property="is.java8"/>
112            <isset property="is.java9"/>
113        </or>
114    </condition>
115
116    <!-- Build environment info -->
117    <property name="env.COMPUTERNAME" value="${env.HOSTNAME}"/>
118    <target name="info" description="Display the build environment information">
119        <echo message="----- Build Environment Information -------------------"/>
120        <echo message="Java Home:    ${java.home}"/>
121        <echo message="Java Version: ${java.version}"/>
122        <echo message="Ant Home:     ${ant.home}"/>
123        <echo message="Ant Version:  ${ant.version}"/>
124        <echo message="OS:           ${os.name}"/>
125        <echo message="OS Version:   ${os.version}"/>
126        <echo message="OS Arch:      ${os.arch}"/>
127        <echo message="Host:         ${env.COMPUTERNAME}"/>
128        <echo message="-------------------------------------------------------"/>
129    </target>
130
131    <target name="clean" description="Clean up build outputs">
132        <ant dir="${icu4j.core.dir}" target="clean" inheritAll="false"/>
133        <ant dir="${icu4j.collate.dir}" target="clean" inheritAll="false"/>
134        <ant dir="${icu4j.charset.dir}" target="clean" inheritAll="false"/>
135        <ant dir="${icu4j.currdata.dir}" target="clean" inheritAll="false"/>
136        <ant dir="${icu4j.langdata.dir}" target="clean" inheritAll="false"/>
137        <ant dir="${icu4j.localespi.dir}" target="clean" inheritAll="false"/>
138        <ant dir="${icu4j.regiondata.dir}" target="clean" inheritAll="false"/>
139        <ant dir="${icu4j.translit.dir}" target="clean" inheritAll="false"/>
140        <ant dir="${icu4j.test-framework.dir}" target="clean" inheritAll="false"/>
141        <ant dir="${icu4j.core-tests.dir}" target="clean" inheritAll="false"/>
142        <ant dir="${icu4j.collate-tests.dir}" target="clean" inheritAll="false"/>
143        <ant dir="${icu4j.charset-tests.dir}" target="clean" inheritAll="false"/>
144        <ant dir="${icu4j.localespi-tests.dir}" target="clean" inheritAll="false"/>
145        <ant dir="${icu4j.packaging-tests.dir}" target="clean" inheritAll="false"/>
146        <ant dir="${icu4j.translit-tests.dir}" target="clean" inheritAll="false"/>
147        <ant dir="${icu4j.build-tools.dir}" target="clean" inheritAll="false"/>
148        <ant dir="${icu4j.tools.dir}" target="clean" inheritAll="false"/>
149        <ant dir="${icu4j.demos.dir}" target="clean" inheritAll="false"/>
150        <ant dir="${icu4j.samples.dir}" target="clean" inheritAll="false"/>
151        <ant dir="${icu4j.perf-tests.dir}" target="clean" inheritAll="false"/>
152
153        <!-- delete all .jar files root directory -->
154        <delete>
155            <fileset dir="." includes="icu4j*.jar"/>
156        </delete>
157
158        <delete dir="${release.dir}"/>
159        <delete dir="${doc.dir}"/>
160        <delete dir="${out.dir}"/>
161        <delete dir="${module.dir}"/>
162        <delete dir="${cldr.release.dir}"/>
163
164        <available file="eclipse-build" type="dir" property="eclipse-build.dir.present"/>
165        <antcall target="_clean.eclipse-build"/>
166    </target>
167
168    <target name="_clean.eclipse-build" if="eclipse-build.dir.present">
169        <ant dir="eclipse-build" target="clean" inheritAll="false"/>
170    </target>
171
172    <target name="ivy-clean">
173        <ivy:cleancache/>
174    </target>
175
176    <!-- Ivy Targets -->
177    <property name="ivy.install.version" value="2.1.0-rc2" />
178    <condition property="ivy.home" value="${env.IVY_HOME}">
179        <isset property="env.IVY_HOME" />
180    </condition>
181    <property name="ivy.home" value="${user.home}/.ant" />
182    <property name="ivy.jar.dir" value="${ivy.home}/lib" />
183    <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
184
185    <target name="download-ivy" unless="offline">
186        <mkdir dir="${ivy.jar.dir}"/>
187        <!-- download Ivy from web site so that it can be used even without any special installation -->
188        <get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
189             dest="${ivy.jar.file}" usetimestamp="true"/>
190    </target>
191
192    <target name="init-ivy" depends="download-ivy">
193      <!-- try to load ivy here from ivy home, in case the user has not already dropped
194              it into ant's lib dir (note that the latter copy will always take precedence).
195              We will not fail as long as local lib dir exists (it may be empty) and
196              ivy is in at least one of ant's lib dir or the local lib dir. -->
197        <path id="ivy.lib.path">
198            <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
199        </path>
200        <taskdef resource="org/apache/ivy/ant/antlib.xml"
201                 uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
202    </target>
203
204    <target name="test-init-junit-dependency" depends="init-ivy">
205        <ivy:retrieve/>
206    </target>
207
208    <target name="init" depends="test-init-junit-dependency"
209        description="Initialize the environment for build and test. May require internet access."/>
210
211    <!-- Junit Targets -->
212    <macrodef name="icu-junit">
213        <attribute name="testdir"/>
214        <attribute name="output"/>
215        <attribute name="jvm-options" default=""/>
216        <attribute name="test-patternset" default="test-classes-patternset"/>
217        <attribute name="classpath" default="junit.icu.jars"/>
218        <attribute name="failure-status" default="ignore"/>
219        <element name="junit-parameters" optional="true"/>
220        <sequential>
221            <!--set the property - if it was set before it won't override-->
222            <property name="user-jvm-options" value=""/>
223            <property name="internal-jvm-options" value=""/>
224            <delete dir="${junit.out.dir}/@{output}"/>
225            <mkdir  dir="${junit.out.dir}/@{output}"/>
226
227            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no" failureproperty="@{failure-status}">
228                <jvmarg value="-Xss4m"/>
229                <jvmarg value="-ea"/>
230                <jvmarg value="-Djava.awt.headless=true"/>
231                <jvmarg line="${user-jvm-options}"/>
232                <jvmarg line="@{jvm-options}"/>
233                <jvmarg line="${internal-jvm-options}"/>
234                <junit-parameters/>
235                <classpath>
236                    <path refid="junit.jars"/>
237                    <path refid="@{classpath}"/>
238                </classpath>
239                <formatter type="plain"/>
240                <formatter type="xml"/>
241
242                <batchtest todir="${junit.out.dir}/@{output}">
243                    <fileset dir="@{testdir}/${bin.dir}">
244                        <patternset refid="@{test-patternset}"/>
245                    </fileset>
246                </batchtest>
247            </junit>
248
249            <junitreport tofile="@{output}-TestSuite.xml" todir="${junit.out.dir}/@{output}">
250                <fileset dir="${junit.out.dir}/@{output}">
251                    <include name="*.xml"/>
252                </fileset>
253                <report format="frames" todir="${junit.out.dir}/@{output}/html"/>
254            </junitreport>
255
256            <fail message="test failed: @{testdir}" if="@{failure-status}" />
257
258        </sequential>
259    </macrodef>
260
261    <property name="junit.out.dir" value="${out.dir}/junit-results"/>
262    <property name="junit.core.jar" value="${external-jars}/junit-4.12.jar"/>
263    <property name="junit.hamcrest.jar" value="${external-jars}/hamcrest-core-1.3.jar"/>
264    <property name="junit.junitparams.jar" value="${external-jars}/JUnitParams-1.0.5.jar"/>
265    <path id="junit.jars">
266        <pathelement path="${junit.core.jar}"/>
267        <pathelement path="${junit.hamcrest.jar}"/>
268        <pathelement path="${junit.junitparams.jar}"/>
269    </path>
270
271    <path id="junit.icu.jars">
272        <pathelement location="${icu4j.core.jar}"/>
273        <pathelement location="${icu4j.collate.jar}"/>
274        <pathelement location="${icu4j.charset.jar}"/>
275        <pathelement location="${icu4j.currdata.jar}"/>
276        <pathelement location="${icu4j.langdata.jar}"/>
277        <pathelement location="${icu4j.regiondata.jar}"/>
278        <pathelement location="${icu4j.translit.jar}"/>
279        <pathelement location="${icu4j.test-framework.jar}"/>
280        <pathelement location="${icu4j.core-tests.jar}"/>
281        <pathelement location="${icu4j.collate-tests.jar}"/>
282        <pathelement location="${icu4j.charset-tests.jar}"/>
283        <pathelement location="${icu4j.translit-tests.jar}"/>
284        <pathelement location="${icu4j.localespi-tests.jar}"/>
285        <pathelement location="${icu4j.packaging-tests.jar}"/>
286        <pathelement location="${icu4j.regiondata.jar}"/>
287    </path>
288
289    <!--Class names that will be included/excluded as tests-->
290    <patternset id="test-classes-patternset">
291        <include name="**/*Test*"/>
292        <exclude name="**/*Fmwk*"/>
293        <exclude name="**/*TestUtility*"/>
294        <exclude name="**/*TestCase*"/>
295        <exclude name="**/*TestData*"/>
296        <exclude name="**/*TestSample*"/>
297        <exclude name="**/*$*.class"/>
298        <exclude name="**/data/**"/>
299    </patternset>
300
301    <!--Class names that will be included/excluded as tests for time zone check-->
302    <patternset id="timeZoneCheck-patternset">
303        <include name="**/TimeZoneFormatTest*"/>
304        <exclude name="**/*$*.class"/>
305    </patternset>
306
307    <!--Class names that will be included/excluded as tests for packaging check-->
308    <patternset id="packagingCheck-patternset">
309        <include name="**/TestLocaleNamePackaging*"/>
310        <exclude name="**/*$*.class"/>
311    </patternset>
312
313    <!--Class names that will be included/excluded as tests for locale SPI check-->
314    <patternset id="localespiCheck-patternset">
315        <include name="**/*Test*"/>
316        <exclude name="com/ibm/icu/dev/test/localespi/TestUtil.*"/>
317        <exclude name="**/*$*.class"/>
318    </patternset>
319
320    <!-- meta build targets -->
321    <target name="all" depends="info, main, tests, build-tools, tools, demos, samples, perf-tests, jar, docs" description="Build all primary targets"/>
322    <target name="main" depends="info, core, collate, charset, currdata, langdata, regiondata, translit, localespi" description="Build ICU4J runtime library classes"/>
323    <target name="tests" depends="info, core-tests, charset-tests, collate-tests, packaging-tests, translit-tests, localespi-tests" description="Build ICU4J test classes"/>
324
325    <target name="secure" depends="icu4jJar" description="(Deprecated)Build ICU4J API and test classes for running the ICU4J test suite with Java security manager enabled"/>
326
327    <!-- Check to see if JVM_OPTIONS enviroment variable is set. This can be use to set the heap size. -->
328    <property name="env.JVM_OPTIONS" value=""/>
329    <property name="jvm_options" value="${env.JVM_OPTIONS}"/>
330
331    <target name="_check">
332        <antcall target="_charsetCheck"/>
333        <antcall target="_collateCheck"/>
334        <antcall target="_coreCheck"/>
335        <antcall target="_translitCheck"/>
336    </target>
337
338    <target name="exhaustiveCheck" description="Run the standard ICU4J test suite in exhaustive mode">
339        <antcall target="check">
340            <param name="internal-jvm-options" value="-DICU.exhaustive=10"/>
341        </antcall>
342        <fail message="test failed" if="icu-junit-failure" />
343    </target>
344
345    <target name="check" depends="main, tests" description="Run the standard ICU4J test suite">
346        <antcall target="_check"/>
347        <fail message="test failed" if="icu-junit-failure" />
348    </target>
349
350    <target name="runTest" description="Run the standard ICU4J test suite without calling any other build targets">
351        <antcall target="_check"/>
352        <fail message="test failed" if="icu-junit-failure" />
353    </target>
354
355    <target name="timeZoneCheck" description="Run the complete test for TimeZoneRoundTripAll">
356        <icu-junit
357            testdir="${icu4j.core-tests.dir}" output="timeZoneCheck"
358            test-patternset="timeZoneCheck-patternset"
359            jvm-options="-DTimeZoneRoundTripAll=true"
360            failure-status="icu-junit-failure"
361        />
362        <fail message="test failed" if="icu-junit-failure" />
363    </target>
364
365    <target name="jdktzCheck" description="Run the standard ICU4J test suite with JDK TimeZone">
366        <antcall target="check">
367            <param name="internal-jvm-options" value="-Dcom.ibm.icu.util.TimeZone.DefaultTimeZoneType=JDK"/>
368        </antcall>
369    </target>
370
371    <path id="junit.icu.jars.PackagingCheckNoLangData">
372        <pathelement location="${icu4j.core.jar}"/>
373        <pathelement location="${icu4j.charset.jar}"/>
374        <pathelement location="${icu4j.test-framework.jar}"/>
375        <pathelement location="${icu4j.packaging-tests.jar}"/>
376        <pathelement location="${icu4j.regiondata.jar}"/>
377    </path>
378
379    <path id="junit.icu.jars.PackagingCheckNoRegionData">
380        <pathelement location="${icu4j.core.jar}"/>
381        <pathelement location="${icu4j.charset.jar}"/>
382        <pathelement location="${icu4j.test-framework.jar}"/>
383        <pathelement location="${icu4j.packaging-tests.jar}"/>
384        <pathelement location="${icu4j.langdata.jar}"/>
385    </path>
386
387    <path id="junit.icu.jars.PackagingCheckNoLangNorRegionData">
388        <pathelement location="${icu4j.core.jar}"/>
389        <pathelement location="${icu4j.charset.jar}"/>
390        <pathelement location="${icu4j.test-framework.jar}"/>
391        <pathelement location="${icu4j.packaging-tests.jar}"/>
392    </path>
393
394    <target name="_packagingCheckNoLangData">
395        <!-- region data but no language data -->
396        <icu-junit testdir="${icu4j.packaging-tests.dir}" output="packaging/NoLangData"
397            test-patternset="packagingCheck-patternset"
398            classpath="junit.icu.jars.PackagingCheckNoLangData"
399            failure-status="icu-junit-failure"
400        />
401    </target>
402
403    <target name="_packagingCheckNoRegionData">
404        <!-- language data but no region data -->
405        <icu-junit testdir="${icu4j.packaging-tests.dir}" output="packaging/NoRegionData"
406            test-patternset="packagingCheck-patternset"
407            classpath="junit.icu.jars.PackagingCheckNoRegionData"
408            failure-status="icu-junit-failure"
409        />
410    </target>
411
412    <target name="_packagingCheckNoLangNorRegionData">
413        <!-- neither region nor language data -->
414        <icu-junit testdir="${icu4j.packaging-tests.dir}" output="packaging/NoLangNorRegionData"
415            test-patternset="packagingCheck-patternset"
416            classpath="junit.icu.jars.PackagingCheckNoLangNorRegionData"
417            failure-status="icu-junit-failure"
418        />
419    </target>
420
421    <target name="packagingCheck" depends="info, core, packaging-tests" description="Run packaging tests">
422        <antcall target="_packagingCheckNoLangData"/>
423        <antcall target="_packagingCheckNoRegionData"/>
424        <antcall target="_packagingCheckNoLangNorRegionData"/>
425        <fail message="test failed" if="icu-junit-failure" />
426    </target>
427
428    <target name="_coreCheck">
429        <icu-junit testdir="${icu4j.core-tests.dir}" output="core"
430            failure-status="icu-junit-failure"
431        />
432    </target>
433
434    <target name="coreCheck" depends="info, core, currdata, langdata, regiondata, core-tests" description="Run only the core tests">
435        <antcall target="_coreCheck"/>
436        <fail message="test failed" if="icu-junit-failure" />
437    </target>
438
439    <target name="_charsetCheck">
440        <icu-junit testdir="${icu4j.charset-tests.dir}" output="charset"
441            failure-status="icu-junit-failure"
442        />
443    </target>
444
445    <target name="charsetCheck" depends="info, core, charset, currdata, langdata, regiondata, core-tests, charset-tests" description="Run only the charset tests">
446        <antcall target="_charsetCheck"/>
447        <fail message="test failed" if="icu-junit-failure" />
448    </target>
449
450    <target name="_collateCheck">
451        <icu-junit testdir="${icu4j.collate-tests.dir}" output="collate"
452            failure-status="icu-junit-failure"
453        />
454    </target>
455
456    <target name="collateCheck" depends="info, core, collate, currdata, langdata, regiondata, core-tests, collate-tests" description="Run only the collation tests">
457        <antcall target="_collateCheck"/>
458        <fail message="test failed" if="icu-junit-failure" />
459    </target>
460
461    <target name="_translitCheck">
462        <icu-junit testdir="${icu4j.translit-tests.dir}" output="translit"
463            failure-status="icu-junit-failure"
464        />
465    </target>
466
467    <target name="translitCheck" depends="info, core, translit, translit-tests" description="Run the ICU4J Translit test suite">
468        <antcall target="_translitCheck"/>
469        <fail message="test failed" if="icu-junit-failure" />
470    </target>
471
472    <target name="_localespiCheck">
473        <icu-junit testdir="${icu4j.localespi-tests.dir}" output="localespi"
474            test-patternset="localespiCheck-patternset"
475            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}"
476            failure-status="icu-junit-failure"
477        />
478    </target>
479
480    <target name="localespiCheck" if="is.java6.plus" depends="info, localespi, localespi-tests" description="Run the ICU4J Locale SPI test suite">
481        <antcall target="_localespiCheck"/>
482        <fail message="test failed" if="icu-junit-failure" />
483    </target>
484
485    <target name="secureCheck" description="Run the secure (applet-like) ICU4J test suite">
486        <antcall target="check">
487            <param name="internal-jvm-options" value="-DICU.securitypolicy=${shared.dir}/data/security.policy"/>
488        </antcall>
489    </target>
490
491    <!-- jar targets -->
492    <target name="jar" depends="icu4jJar, charset, localespi" description="Build ICU4J runtime library jar files">
493        <copy file="${icu4j.charset.jar}" tofile="${icu4j-charset.jar.file}"/>
494        <copy file="${icu4j.localespi.jar}" tofile="${icu4j-localespi.jar.file}" failonerror="false"/>
495    </target>
496
497    <target name="icu4jJar" depends="info, core, collate, currdata, langdata, regiondata, translit" description="Build ICU4J all-in-one core jar">
498        <mkdir dir="${out.dir}"/>
499
500        <!-- manifest -->
501        <copy file="manifest.stub" todir="${out.dir}">
502            <filterset>
503                <filter token="SPECVERSION" value="${jar.spec.version}"/>
504                <filter token="IMPLVERSION" value="${jar.impl.version}"/>
505                <filter token="COPYRIGHT" value="${jar.copyright.info}"/>
506                <filter token="EXECENV" value="${jar.exec.env}"/>
507            </filterset>
508        </copy>
509
510        <!-- jar -->
511        <jar jarfile="${icu4j.jar.file}"
512                compress="true"
513                manifest="${out.dir}/manifest.stub">
514            <fileset dir="${icu4j.core.dir}/${bin.dir}" includes="**/*"/>
515            <fileset dir="${icu4j.collate.dir}/${bin.dir}" includes="**/*"/>
516            <fileset dir="${icu4j.currdata.dir}/${bin.dir}" includes="**/*"/>
517            <fileset dir="${icu4j.langdata.dir}/${bin.dir}" includes="**/*"/>
518            <fileset dir="${icu4j.regiondata.dir}/${bin.dir}" includes="**/*"/>
519            <fileset dir="${icu4j.translit.dir}/${bin.dir}" includes="**/*"/>
520            <fileset dir="${shared.dir}/licenses">
521                <include name="LICENSE"/>
522            </fileset>
523        </jar>
524    </target>
525
526    <target name="icu4jSrcJar" description="Build icu4j-src.jar">
527        <jar jarfile="${icu4j-src.jar.file}"
528                compress="true">
529            <fileset dir="${icu4j.core.dir}/${src.dir}" includes="**/*.java"/>
530            <fileset dir="${icu4j.collate.dir}/${src.dir}" includes="**/*.java"/>
531            <fileset dir="${icu4j.currdata.dir}/${src.dir}" includes="**/*.java"/>
532            <fileset dir="${icu4j.langdata.dir}/${src.dir}" includes="**/*.java"/>
533            <fileset dir="${icu4j.regiondata.dir}/${src.dir}" includes="**/*.java"/>
534            <fileset dir="${icu4j.translit.dir}/${src.dir}" includes="**/*.java"/>
535            <fileset dir="${shared.dir}/licenses">
536                <include name="LICENSE"/>
537            </fileset>
538        </jar>
539    </target>
540
541    <target name="icu4jtestsJar" depends="info, tests" description="Build ICU4J all-in-one test jar">
542        <jar jarfile="${icu4jtests.jar.file}"
543                compress="true">
544            <fileset dir="${icu4j.test-framework.dir}/${bin.dir}" includes="**/*"/>
545            <fileset dir="${icu4j.core-tests.dir}/${bin.dir}" includes="**/*"/>
546            <fileset dir="${icu4j.collate-tests.dir}/${bin.dir}" includes="**/*"/>
547            <fileset dir="${icu4j.translit-tests.dir}/${bin.dir}" includes="**/*"/>
548            <fileset dir="${icu4j.charset-tests.dir}/${bin.dir}" includes="**/*"/>
549        </jar>
550    </target>
551
552    <target name="jarDemos" depends="icu4jJar, demos" description="Build ICU4J demo jar file">
553        <copy file="${icu4j.demos.jar}" tofile="${icu4jdemos.jar.file}"/>
554    </target>
555
556
557    <!-- release targets -->
558    <target name="_check_config_for_release" depends="_checkJCite">
559        <condition property="release.build.config.ok">
560            <and>
561                <isset property="is.java8"/>
562                <isset property="java6.bootclasspath"/>
563                <isset property="jcite.libs"/>
564            </and>
565        </condition>
566    </target>
567
568    <target name="_verify_config_for_release" depends="_check_config_for_release" unless="release.build.config.ok">
569        <condition property="disp.is.java8" value="${java.version}" else="${java.version} - Must be 1.8!">
570            <isset property="is.java8"/>
571        </condition>
572        <condition property="disp.java6.bootclasspath" value="${java6.bootclasspath}" else="Not Defined!">
573            <isset property="java6.bootclasspath"/>
574        </condition>
575        <condition property="disp.jcite.libs" value="${jcite.libs}" else="Not Defined!">
576            <isset property="jcite.libs"/>
577        </condition>
578
579        <echo message="################################################################"/>
580        <echo message="[WARNING] Insufficient Build Configuration for ICU4J Release"/>
581        <echo message="JDK Tools Version:              ${disp.is.java8}"/>
582        <echo message="JRE 6 System Library Path:      ${disp.java6.bootclasspath}"/>
583        <echo message="JCite Library Path:             ${disp.jcite.libs}"/>
584        <echo message="################################################################"/>
585    </target>
586
587    <target name="releaseVer" depends="info, releaseBinaries, releaseSrcJars, releaseDocs, releaseSourceArchiveTgz"
588            description="Build all ICU4J release files for distribution with versioned file names">
589        <!-- binaries -->
590        <move file="${release.dir}/${icu4j.jar.file}" tofile="${release.dir}/${icu4j.jar.versioned.file}"/>
591        <move file="${release.dir}/${icu4j-charset.jar.file}" tofile="${release.dir}/${icu4j-charset.jar.versioned.file}"/>
592        <move file="${release.dir}/${icu4j-localespi.jar.file}" tofile="${release.dir}/${icu4j-localespi.jar.versioned.file}"/>
593
594        <!-- source jars -->
595        <move file="${release.dir}/${icu4j-src.jar.file}" tofile="${release.dir}/${icu4j-src.jar.versioned.file}"/>
596        <move file="${release.dir}/${icu4j-charset-src.jar.file}" tofile="${release.dir}/${icu4j-charset-src.jar.versioned.file}"/>
597        <move file="${release.dir}/${icu4j-localespi-src.jar.file}" tofile="${release.dir}/${icu4j-localespi-src.jar.versioned.file}"/>
598
599        <!-- docs -->
600        <move file="${release.dir}/${icu4jdocs.jar.file}" tofile="${release.dir}/${icu4jdocs.jar.versioned.file}"/>
601
602        <!-- package archive -->
603        <move file="${release.dir}/${icu4jsrc.tgz.file}" tofile="${release.dir}/${icu4jsrc.tgz.versioned.file}"/>
604
605        <!-- md5 checksum file -->
606        <mkdir dir="${out.dir}/checksum"/>
607        <delete dir="${out.dir}/checksum" includes="**/*"/>
608
609        <checksum todir="${out.dir}/checksum" format="MD5SUM">
610            <fileset dir="${release.dir}">
611                <include name="*.jar"/>
612                <include name="*.tgz"/>
613            </fileset>
614        </checksum>
615
616        <concat destfile="${release.dir}/icu4j-${release.file.ver}.md5">
617            <fileset dir="${out.dir}/checksum" includes="*"/>
618            <filterchain>
619                <fixcrlf eol="lf"/>
620            </filterchain>
621        </concat>
622
623        <antcall target="_verify_config_for_release"/>
624    </target>
625
626    <target name="release" depends="info, releaseBinaries, releaseSrcJars, releaseDocs, releaseSourceArchiveTgz" description="Build all ICU4J release files for distribution">
627        <mkdir dir="${out.dir}/checksum"/>
628        <delete dir="${out.dir}/checksum" includes="**/*"/>
629
630        <checksum todir="${out.dir}/checksum" format="MD5SUM">
631            <fileset dir="${release.dir}">
632                <include name="*.jar"/>
633                <include name="*.tgz"/>
634            </fileset>
635        </checksum>
636
637        <concat destfile="${release.dir}/icu4j.md5">
638            <fileset dir="${out.dir}/checksum" includes="*"/>
639            <filterchain>
640                <fixcrlf eol="lf"/>
641            </filterchain>
642        </concat>
643
644        <antcall target="_verify_config_for_release"/>
645    </target>
646
647    <target name="releaseBinaries" depends="icu4jJar, charset, localespi" description="Build ICU4J binary files for distribution">
648        <mkdir dir="${release.dir}"/>
649        <copy file="${icu4j.jar.file}" tofile="${release.dir}/${icu4j.jar.file}"/>
650        <copy file="${icu4j.charset.jar}" tofile="${release.dir}/${icu4j-charset.jar.file}"/>
651        <copy file="${icu4j.localespi.jar}" tofile="${release.dir}/${icu4j-localespi.jar.file}"/>
652    </target>
653
654    <target name="releaseSrcJars" depends="icu4jSrcJar" description="Build ICU4J src jar files for distribution">
655        <mkdir dir="${release.dir}"/>
656
657        <!-- icu4j src-jar -->
658        <copy file="${icu4j-src.jar.file}" tofile="${release.dir}/${icu4j-src.jar.file}"/>
659
660        <!-- charset/localespi src-jar -->
661        <ant dir="${icu4j.charset.dir}" target="src-jar" inheritAll="false"/>
662        <ant dir="${icu4j.localespi.dir}" target="src-jar" inheritAll="false"/>
663
664        <copy file="${icu4j.charset.dir}/${out.dir}/lib/${icu4j-charset-src.jar.file}" tofile="${release.dir}/${icu4j-charset-src.jar.file}"/>
665        <copy file="${icu4j.localespi.dir}/${out.dir}/lib/${icu4j-localespi-src.jar.file}" tofile="${release.dir}/${icu4j-localespi-src.jar.file}"/>
666    </target>
667
668
669    <target name="releaseDocs" depends="docs" description="Build ICU4J API reference doc jar file for distribution">
670        <mkdir dir="${release.dir}"/>
671        <jar jarfile="${release.dir}/${icu4jdocs.jar.file}" compress="true" basedir="${doc.dir}"/>
672    </target>
673
674    <property name="src.release.wrk.dir" value="${out.dir}/tmpsrc"/>
675
676    <target name="releaseSourceArchiveZip" description="Build ICU4J source release archive (.zip)">
677        <delete dir="${src.release.wrk.dir}"/>
678        <delete file="${icu4jsrc.zip.file}"/>
679
680        <mkdir dir="${src.release.wrk.dir}"/>
681
682        <fixcrlf srcdir="."
683                destdir="${src.release.wrk.dir}"
684                encoding="UTF-8"
685                eol="crlf">
686            <include name="demos/**/*"/>
687            <include name="main/**/*"/>
688            <include name="perf-tests/**/*"/>
689            <include name="samples/**/*"/>
690            <include name="tools/**/*"/>
691            <include name="*.html"/>
692            <include name="*.xml"/>
693            <include name="*.properties"/>
694            <include name="*.css"/>
695            <include name="*.stub"/>
696            <exclude name="**/out/**/*"/>
697            <exclude name="**/*.jar"/>
698            <exclude name="**/build-local.properties"/>
699            <exclude name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
700            <exclude name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
701            <exclude name="tools/build/icu4j*.api*.gz"/>
702        </fixcrlf>
703
704        <mkdir dir="${release.dir}"/>
705        <zip destfile="${release.dir}/${icu4jsrc.zip.file}">
706            <fileset dir="${src.release.wrk.dir}" includes="**/*"/>
707            <fileset dir="${basedir}">
708                <include name="main/shared/data/*.jar"/>
709                <include name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
710                <include name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
711                <include name="tools/build/icu4j*.api*.gz"/>
712            </fileset>
713        </zip>
714
715        <delete dir="${src.release.wrk.dir}"/>
716    </target>
717
718    <target name="releaseSourceArchiveTgz" description="Build ICU4J source release archive (.tgz)">
719        <delete dir="${src.release.wrk.dir}"/>
720        <delete file="${icu4jsrc.tgz.file}"/>
721
722        <mkdir dir="${src.release.wrk.dir}"/>
723
724        <fixcrlf srcdir="."
725                destdir="${src.release.wrk.dir}"
726                encoding="UTF-8"
727                eol="lf">
728            <include name="demos/**/*"/>
729            <include name="main/**/*"/>
730            <include name="perf-tests/**/*"/>
731            <include name="samples/**/*"/>
732            <include name="tools/**/*"/>
733            <include name="*.html"/>
734            <include name="*.xml"/>
735            <include name="*.properties"/>
736            <include name="*.css"/>
737            <include name="*.stub"/>
738            <exclude name="**/out/**/*"/>
739            <exclude name="**/*.jar"/>
740            <exclude name="**/build-local.properties"/>
741            <exclude name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
742            <exclude name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
743            <exclude name="tools/build/icu4j*.api*.gz"/>
744        </fixcrlf>
745
746        <property name="icu4jsrc.tar" value="${out.dir}/icu4jsrc.tar"/>
747
748        <tar destfile="${icu4jsrc.tar}" longfile="gnu">
749            <fileset dir="${src.release.wrk.dir}" includes="**/*"/>
750            <fileset dir="${basedir}">
751                <include name="main/shared/data/*.jar"/>
752                <include name="main/tests/core/src/com/ibm/icu/dev/test/serializable/data/**/*.dat"/>
753                <include name="main/tests/core/src/com/ibm/icu/dev/test/util/Trie2Test.*.tri2"/>
754                <include name="tools/build/icu4j*.api*.gz"/>
755            </fileset>
756        </tar>
757
758        <mkdir dir="${release.dir}"/>
759        <gzip destfile="${release.dir}/${icu4jsrc.tgz.file}" src="${icu4jsrc.tar}"/>
760
761        <delete dir="${src.release.wrk.dir}"/>
762        <delete file="${icu4jsrc.tar}"/>
763    </target>
764
765    <!-- findbugs targets -->
766
767    <target name="findbugs" description="Run FindBugs on all library sub projects.">
768        <property name="findbugs.out.dir" value="${out.dir}/findbugs"/>
769        <mkdir dir="${findbugs.out.dir}"/>
770
771        <ant dir="${icu4j.core.dir}" inheritAll="false" target="findbugs"/>
772        <copy file="${icu4j.core.dir}/${out.dir}/fb-core.html" todir="${findbugs.out.dir}"/>
773
774        <ant dir="${icu4j.collate.dir}" inheritAll="false" target="findbugs"/>
775        <copy file="${icu4j.collate.dir}/${out.dir}/fb-collate.html" todir="${findbugs.out.dir}"/>
776
777        <ant dir="${icu4j.currdata.dir}" inheritAll="false" target="findbugs"/>
778        <copy file="${icu4j.currdata.dir}/${out.dir}/fb-currdata.html" todir="${findbugs.out.dir}"/>
779
780        <ant dir="${icu4j.langdata.dir}" inheritAll="false" target="findbugs"/>
781        <copy file="${icu4j.langdata.dir}/${out.dir}/fb-langdata.html" todir="${findbugs.out.dir}"/>
782
783        <ant dir="${icu4j.regiondata.dir}" inheritAll="false" target="findbugs"/>
784        <copy file="${icu4j.regiondata.dir}/${out.dir}/fb-regiondata.html" todir="${findbugs.out.dir}"/>
785
786        <ant dir="${icu4j.translit.dir}" inheritAll="false" target="findbugs"/>
787        <copy file="${icu4j.translit.dir}/${out.dir}/fb-translit.html" todir="${findbugs.out.dir}"/>
788
789
790        <ant dir="${icu4j.charset.dir}" inheritAll="false" target="findbugs"/>
791        <copy file="${icu4j.charset.dir}/${out.dir}/fb-charset.html" todir="${findbugs.out.dir}"/>
792
793        <ant dir="${icu4j.localespi.dir}" inheritAll="false" target="findbugs"/>
794        <copy file="${icu4j.localespi.dir}/${out.dir}/fb-localespi.html" todir="${findbugs.out.dir}"/>
795    </target>
796
797    <!-- compile targets -->
798    <target name="core" description="Build core classes">
799        <ant dir="${icu4j.core.dir}" inheritAll="false"/>
800    </target>
801
802    <target name="collate" depends="core" description="Build collation classes">
803        <ant dir="${icu4j.collate.dir}" inheritAll="false"/>
804    </target>
805
806    <target name="charset" depends="core" description="Build charset classes">
807        <ant dir="${icu4j.charset.dir}" inheritAll="false"/>
808    </target>
809
810    <target name="currdata" depends="core" description="Build currency data classes">
811        <ant dir="${icu4j.currdata.dir}" inheritAll="false"/>
812    </target>
813
814    <target name="langdata" depends="core" description="Build language data classes">
815        <ant dir="${icu4j.langdata.dir}" inheritAll="false"/>
816    </target>
817
818    <target name="localespi" if="is.java6.plus" description="Build Locale SPI classes">
819        <antcall target="_build-localespi"/>
820    </target>
821
822    <target name="_build-localespi" depends="core, collate, currdata, langdata, regiondata">
823        <ant dir="${icu4j.localespi.dir}" inheritAll="false"/>
824    </target>
825
826    <target name="regiondata" depends="core" description="Build region data classes">
827        <ant dir="${icu4j.regiondata.dir}" inheritAll="false"/>
828    </target>
829
830    <target name="translit" depends="core" description="Build translit classes">
831        <ant dir="${icu4j.translit.dir}" inheritAll="false"/>
832    </target>
833
834    <target name="test-framework" depends="core, init" description="Build test framework classes">
835        <ant dir="${icu4j.test-framework.dir}" inheritAll="false">
836            <reference refid="junit.jars"/>
837        </ant>
838    </target>
839
840    <target name="core-tests" depends="core, test-framework" description="Build core tests">
841        <ant dir="${icu4j.core-tests.dir}" inheritAll="false">
842            <reference refid="junit.jars"/>
843        </ant>
844    </target>
845
846    <target name="collate-tests" depends="collate, test-framework" description="Build core tests">
847        <ant dir="${icu4j.collate-tests.dir}" inheritAll="false">
848            <reference refid="junit.jars"/>
849        </ant>
850    </target>
851
852    <target name="charset-tests" depends="charset, test-framework" description="Build charset tests">
853        <ant dir="${icu4j.charset-tests.dir}" inheritAll="false">
854            <reference refid="junit.jars"/>
855        </ant>
856    </target>
857
858    <target name="localespi-tests" if="is.java6.plus" description="Build Locale SPI tests">
859        <antcall target="_build-localespi-tests"/>
860    </target>
861
862    <target name="_build-localespi-tests" depends="localespi, test-framework">
863        <ant dir="${icu4j.localespi-tests.dir}" inheritAll="false">
864            <reference refid="junit.jars"/>
865        </ant>
866    </target>
867
868    <target name="packaging-tests" depends="test-framework" description="Build packaging tests">
869        <ant dir="${icu4j.packaging-tests.dir}" inheritAll="false">
870            <reference refid="junit.jars"/>
871        </ant>
872    </target>
873
874    <target name="translit-tests" depends="translit, test-framework" description="Build translit tests">
875        <ant dir="${icu4j.translit-tests.dir}" inheritAll="false">
876            <reference refid="junit.jars"/>
877        </ant>
878    </target>
879
880    <target name="demos" depends="core, charset, translit" description="Build demo classes">
881        <ant dir="${icu4j.demos.dir}" inheritAll="false"/>
882    </target>
883
884    <target name="samples" depends="core, charset, collate, translit" description="Build sample classes">
885        <ant dir="${icu4j.samples.dir}" inheritAll="false"/>
886    </target>
887
888    <target name="build-tools" description="Build build-tool classes">
889        <ant dir="${icu4j.build-tools.dir}" inheritAll="false"/>
890    </target>
891
892    <target name="tools" depends="core, core-tests, collate, translit, translit-tests" description="Build tool classes">
893        <ant dir="${icu4j.tools.dir}" inheritAll="false"/>
894    </target>
895
896    <target name="perf-tests" if="is.java6.plus" depends="core, charset, collate, tools" description="Build performance test classes">
897        <ant dir="${icu4j.perf-tests.dir}" inheritAll="false"/>
898    </target>
899
900    <!-- doc targets -->
901    <target name="docs" depends="info, build-tools, _checkJCite, _docsWithJCite, _docsWithoutJCite" description="Build API documents"/>
902
903    <target name="docsStrict" description="Build API documents with all doclint check enabled">
904        <condition property="doclint.option" value="-Xdoclint:all">
905            <isset property="is.java8.plus"/>
906        </condition>
907        <antcall target="docs"/>
908    </target>
909
910    <target name="_checkJCite" if="env.JCITE_DIR">
911        <fileset dir="${env.JCITE_DIR}" id="jcite.files">
912            <include name="build/*.jar"/>
913            <include name="lib/*.jar"/>
914        </fileset>
915        <pathconvert property="jcite.libs" refid="jcite.files"/>
916
917        <dirset dir="${basedir}" id="jcite.src.dirs">
918            <include name="samples/src"/>
919            <include name="demos/src"/>
920            <include name="main/tests/*/src"/>
921        </dirset>
922        <pathconvert property="jcite.addl.src" refid="jcite.src.dirs"/>
923    </target>
924
925    <target name="_docsStyleSheet">
926        <condition property="docs.style.sheet" value="stylesheet6.css">
927            <isset property="is.java6"/>
928        </condition>
929        <condition property="docs.style.sheet" value="stylesheet7.css">
930            <isset property="is.java7"/>
931        </condition>
932        <!-- all other cases -->
933        <property name="docs.style.sheet" value="stylesheet8.css"/>
934    </target>
935
936    <target name="_docsLintOption" unless="doclint.options">
937        <!-- syntax check is disabled because JCite tag name "@.jcite" is invalidated -->
938        <condition property="doclint.option" value="-Xdoclint:reference,html" else="">
939            <isset property="is.java8.plus"/>
940        </condition>
941    </target>
942
943    <target name="_docsWithJCite" depends="_docsStyleSheet, _docsLintOption" if="jcite.libs">
944        <echo message="Javadoc lint option:            ${doclint.option}"/>
945        <echo message="JCite library path:             ${jcite.libs}"/>
946        <echo message="JCite additional source path:   ${jcite.addl.src}"/>
947        <echo message="Custom stylesheet:              ${docs.style.sheet}"/>
948        <javadoc
949                destdir="${doc.dir}"
950                nodeprecatedlist="true"
951                windowtitle="${icu4j.api.doc.window.title}"
952                doctitle="${icu4j.api.doc.title}"
953                header="${icu4j.api.doc.header}"
954                encoding="${java.src.encoding}"
955                docencoding="UTF-8"
956                charset="UTF-8"
957                bottom="&lt;font size=-1&gt;Copyright (c) ${current.year} IBM Corporation and others.&lt;/font&gt;"
958                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"
959                link="${icu4j.api.doc.jdk.link}"
960                source="1.5"
961                stylesheetfile="${docs.style.sheet}"
962                failonerror="true">
963            <packageset dir="${icu4j.core.dir}/src">
964                <include name="com/ibm/icu/lang/**"/>
965                <include name="com/ibm/icu/math/**"/>
966                <include name="com/ibm/icu/text/**"/>
967                <include name="com/ibm/icu/util/**"/>
968            </packageset>
969            <packageset dir="${icu4j.collate.dir}/src">
970                <include name="com/ibm/icu/text/**"/>
971            </packageset>
972            <packageset dir="${icu4j.translit.dir}/src">
973                <include name="com/ibm/icu/text/**"/>
974            </packageset>
975            <packageset dir="${icu4j.charset.dir}/src">
976                <include name="com/ibm/icu/charset/**"/>
977            </packageset>
978        </javadoc>
979    </target>
980
981    <target name="_docsWithoutJCite" depends="_docsStyleSheet, _docsLintOption" unless="jcite.libs">
982        <echo message="Javadoc lint option:            ${doclint.option}"/>
983        <javadoc
984                destdir="${doc.dir}"
985                nodeprecatedlist="true"
986                windowtitle="${icu4j.api.doc.window.title}"
987                doctitle="${icu4j.api.doc.title}"
988                header="${icu4j.api.doc.header}"
989                encoding="${java.src.encoding}"
990                docencoding="UTF-8"
991                charset="UTF-8"
992                bottom="&lt;font size=-1&gt;Copyright (c) ${current.year} IBM Corporation and others.&lt;/font&gt;"
993                additionalparam="${doclint.option} -breakiterator -use -tagletpath ${icu4j.build-tools.jar} -taglet com.ibm.icu.dev.tool.docs.ICUTaglet"
994                link="${icu4j.api.doc.jdk.link}"
995                source="1.5"
996                failonerror="true">
997            <packageset dir="${icu4j.core.dir}/src">
998                <include name="com/ibm/icu/lang/**"/>
999                <include name="com/ibm/icu/math/**"/>
1000                <include name="com/ibm/icu/text/**"/>
1001                <include name="com/ibm/icu/util/**"/>
1002            </packageset>
1003            <packageset dir="${icu4j.collate.dir}/src">
1004                <include name="com/ibm/icu/text/**"/>
1005            </packageset>
1006            <packageset dir="${icu4j.translit.dir}/src">
1007                <include name="com/ibm/icu/text/**"/>
1008            </packageset>
1009            <packageset dir="${icu4j.charset.dir}/src">
1010                <include name="com/ibm/icu/charset/**"/>
1011            </packageset>
1012        </javadoc>
1013    </target>
1014
1015    <!-- JaCoCo code coverage target -->
1016    <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" onerror="ignore">
1017        <classpath path="${env.JACOCO_DIR}/lib/jacocoant.jar"/>
1018    </taskdef>
1019
1020    <target name="coverageJaCoCo" depends="build-tools, jar, tests" description="Run the ICU4J unit tests and generate code coverage report">
1021        <property name="jacoco.out.dir" value="${out.dir}/jacoco"/>
1022        <property name="jacoco.exec.data.file" value="${jacoco.out.dir}/jacoco.exec"/>
1023        <property name="jacoco.report.html.zip" value="${jacoco.out.dir}/report_html.zip"/>
1024        <property name="jacoco.report.xml" value="${jacoco.out.dir}/report.xml"/>
1025        <property name="jacoco.report.csv" value="${jacoco.out.dir}/report.csv"/>
1026        <property name="jacoco.exclusion.txt" value="coverage-exclusion.txt"/>
1027
1028        <delete dir="${jacoco.out.dir}"/>
1029        <mkdir dir="${jacoco.out.dir}"/>
1030
1031        <!-- core -->
1032        <jacoco:coverage destfile="${jacoco.exec.data.file}">
1033            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
1034                <jvmarg value="-ea"/>
1035                <jvmarg value="-Djava.awt.headless=true"/>
1036                <classpath>
1037                    <path refid="junit.jars"/>
1038                    <path refid="junit.icu.jars"/>
1039                </classpath>
1040
1041                <batchtest todir="${junit.out.dir}/core">
1042                    <fileset dir="${icu4j.core-tests.dir}/${bin.dir}">
1043                        <patternset refid="test-classes-patternset"/>
1044                    </fileset>
1045                </batchtest>
1046            </junit>
1047        </jacoco:coverage>
1048
1049        <!-- charset -->
1050        <jacoco:coverage destfile="${jacoco.exec.data.file}">
1051            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
1052                <jvmarg value="-ea"/>
1053                <jvmarg value="-Djava.awt.headless=true"/>
1054                <classpath>
1055                    <path refid="junit.jars"/>
1056                    <path refid="junit.icu.jars"/>
1057                </classpath>
1058
1059                <batchtest todir="${junit.out.dir}/charset">
1060                    <fileset dir="${icu4j.charset-tests.dir}/${bin.dir}">
1061                        <patternset refid="test-classes-patternset"/>
1062                    </fileset>
1063                </batchtest>
1064            </junit>
1065        </jacoco:coverage>
1066
1067        <!-- collate -->
1068        <jacoco:coverage destfile="${jacoco.exec.data.file}">
1069            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
1070                <jvmarg value="-ea"/>
1071                <jvmarg value="-Djava.awt.headless=true"/>
1072                <classpath>
1073                    <path refid="junit.jars"/>
1074                    <path refid="junit.icu.jars"/>
1075                </classpath>
1076
1077                <batchtest todir="${junit.out.dir}/collate">
1078                    <fileset dir="${icu4j.collate-tests.dir}/${bin.dir}">
1079                        <patternset refid="test-classes-patternset"/>
1080                    </fileset>
1081                </batchtest>
1082            </junit>
1083        </jacoco:coverage>
1084
1085        <!-- translit -->
1086        <jacoco:coverage destfile="${jacoco.exec.data.file}">
1087            <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="no">
1088                <jvmarg value="-ea"/>
1089                <jvmarg value="-Djava.awt.headless=true"/>
1090                <classpath>
1091                    <path refid="junit.jars"/>
1092                    <path refid="junit.icu.jars"/>
1093                </classpath>
1094
1095                <batchtest todir="${junit.out.dir}/translit">
1096                    <fileset dir="${icu4j.translit-tests.dir}/${bin.dir}">
1097                        <patternset refid="test-classes-patternset"/>
1098                    </fileset>
1099                </batchtest>
1100            </junit>
1101        </jacoco:coverage>
1102
1103        <jacoco:report>
1104            <executiondata>
1105                <file file="${jacoco.exec.data.file}"/>
1106            </executiondata>
1107
1108            <structure name="ICU4J Project">
1109                <classfiles>
1110                    <fileset dir=".">
1111                        <include name="${icu4j.jar.file}"/>
1112                        <include name="${icu4j-charset.jar.file}"/>
1113                    </fileset>
1114                </classfiles>
1115                <sourcefiles encoding="UTF-8">
1116                    <fileset dir="${icu4j.core.dir}/src"/>
1117                    <fileset dir="${icu4j.collate.dir}/src"/>
1118                    <fileset dir="${icu4j.currdata.dir}/src"/>
1119                    <fileset dir="${icu4j.langdata.dir}/src"/>
1120                    <fileset dir="${icu4j.regiondata.dir}/src"/>
1121                    <fileset dir="${icu4j.translit.dir}/src"/>
1122
1123                    <fileset dir="${icu4j.charset.dir}/src"/>
1124                </sourcefiles>
1125            </structure>
1126
1127            <html destfile="${jacoco.report.html.zip}"/>
1128            <xml destfile="${jacoco.report.xml}"/>
1129            <csv destfile="${jacoco.report.csv}"/>
1130        </jacoco:report>
1131
1132        <java classname="com.ibm.icu.dev.tool.coverage.JacocoReportCheck" failonerror="true">
1133            <arg line="${jacoco.report.xml}  ${jacoco.exclusion.txt}"/>
1134            <classpath>
1135                <pathelement location="${icu4j.build-tools.jar}"/>
1136            </classpath>
1137        </java>
1138
1139    </target>
1140
1141    <!-- Clover code coverage target -->
1142    <property name="clover.out.dir" value="${out.dir}/clover"/>
1143    <property name="clover.jar" location="${env.CLOVER_DIR}/clover.jar"/>
1144    <taskdef resource="cloverlib.xml" classpath="${clover.jar}" onerror="ignore"/>
1145
1146    <target name="codeCoverage" depends="clean" description="Generate code coverage report with clover">
1147        <!-- Set up clover -->
1148        <mkdir dir="${clover.out.dir}"/>
1149        <clover-setup initstring="${clover.out.dir}/clover.db">
1150            <files>
1151                <exclude name="**/dev/**/*.java"/>
1152            </files>
1153            <methodContext name="API" regexp="(.* )?public .*"/>
1154        </clover-setup>
1155
1156        <!-- Build components with clover instrumentation -->
1157        <ant dir="${icu4j.core.dir}" inheritAll="false" inheritRefs="true">
1158            <property name="build.compiler" value="${build.compiler}"/>
1159        </ant>
1160        <ant dir="${icu4j.collate.dir}" inheritAll="false" inheritRefs="true">
1161            <property name="build.compiler" value="${build.compiler}"/>
1162        </ant>
1163        <ant dir="${icu4j.charset.dir}" inheritAll="false" inheritRefs="true">
1164            <property name="build.compiler" value="${build.compiler}"/>
1165        </ant>
1166        <ant dir="${icu4j.currdata.dir}" inheritAll="false" inheritRefs="true">
1167            <property name="build.compiler" value="${build.compiler}"/>
1168        </ant>
1169        <ant dir="${icu4j.langdata.dir}" inheritAll="false" inheritRefs="true">
1170            <property name="build.compiler" value="${build.compiler}"/>
1171        </ant>
1172        <ant dir="${icu4j.regiondata.dir}" inheritAll="false" inheritRefs="true">
1173            <property name="build.compiler" value="${build.compiler}"/>
1174        </ant>
1175        <ant dir="${icu4j.translit.dir}" inheritAll="false" inheritRefs="true">
1176            <property name="build.compiler" value="${build.compiler}"/>
1177        </ant>
1178        <ant dir="${icu4j.test-framework.dir}" inheritAll="false" inheritRefs="true">
1179            <property name="build.compiler" value="${build.compiler}"/>
1180        </ant>
1181        <ant dir="${icu4j.core-tests.dir}" inheritAll="false" inheritRefs="true">
1182            <property name="build.compiler" value="${build.compiler}"/>
1183        </ant>
1184        <ant dir="${icu4j.collate-tests.dir}" inheritAll="false" inheritRefs="true">
1185            <property name="build.compiler" value="${build.compiler}"/>
1186        </ant>
1187        <ant dir="${icu4j.charset-tests.dir}" inheritAll="false" inheritRefs="true">
1188            <property name="build.compiler" value="${build.compiler}"/>
1189        </ant>
1190        <ant dir="${icu4j.translit-tests.dir}" inheritAll="false" inheritRefs="true">
1191            <property name="build.compiler" value="${build.compiler}"/>
1192        </ant>
1193
1194        <!-- Run the test suites -->
1195        <java classname="com.ibm.icu.dev.test.TestAll" fork="yes" failonerror="true">
1196            <classpath>
1197                <pathelement location="${icu4j.core.jar}"/>
1198                <pathelement location="${icu4j.collate.jar}"/>
1199                <pathelement location="${icu4j.charset.jar}"/>
1200                <pathelement location="${icu4j.currdata.jar}"/>
1201                <pathelement location="${icu4j.langdata.jar}"/>
1202                <pathelement location="${icu4j.regiondata.jar}"/>
1203                <pathelement location="${icu4j.translit.jar}"/>
1204                <pathelement location="${icu4j.test-framework.jar}"/>
1205                <pathelement location="${icu4j.core-tests.jar}"/>
1206                <pathelement location="${icu4j.collate-tests.jar}"/>
1207                <pathelement location="${icu4j.charset-tests.jar}"/>
1208                <pathelement location="${icu4j.translit-tests.jar}"/>
1209                <pathelement location="${icu4j.testall.jar}"/>
1210                <pathelement location="${clover.jar}"/>
1211            </classpath>
1212        </java>
1213
1214        <!-- Generate HTML coverage report -->
1215        <!-- <clover-html-report outdir="${clover.out.dir}/html" title="ICU4J Code Coverage"/> -->
1216        <clover-report>
1217            <current outfile="${clover.out.dir}/html" title="ICU4J Code Coverage">
1218                <format type="html" filter="assert" />
1219            </current>
1220        </clover-report>
1221    </target>
1222
1223    <!-- Release management targets -->
1224    <target name="checktags" depends="info, build-tools" description="Check API tags before release">
1225        <javadoc source="1.6"
1226                 bootclasspath="${java6.bootclasspath}"
1227                 encoding="${java.src.encoding}">
1228            <packageset dir="${icu4j.core.dir}/src">
1229                <include name="com/ibm/icu/lang/**"/>
1230                <include name="com/ibm/icu/math/**"/>
1231                <include name="com/ibm/icu/text/**"/>
1232                <include name="com/ibm/icu/util/**"/>
1233            </packageset>
1234            <packageset dir="${icu4j.collate.dir}/src">
1235                <include name="com/ibm/icu/**"/>
1236            </packageset>
1237            <packageset dir="${icu4j.charset.dir}/src">
1238                <include name="com/ibm/icu/charset/**"/>
1239            </packageset>
1240            <doclet name="com.ibm.icu.dev.tool.docs.CheckTags" path="${icu4j.build-tools.jar}"/>
1241        </javadoc>
1242    </target>
1243
1244    <target name="gatherapi" depends="info, build-tools" description="Run API database generator tool">
1245        <mkdir dir="${out.dir}"/>
1246        <javadoc source="1.6"
1247                 bootclasspath="${java6.bootclasspath}"
1248                 encoding="${java.src.encoding}">
1249            <packageset dir="${icu4j.core.dir}/src">
1250                <include name="com/ibm/icu/lang/**"/>
1251                <include name="com/ibm/icu/math/**"/>
1252                <include name="com/ibm/icu/text/**"/>
1253                <include name="com/ibm/icu/util/**"/>
1254            </packageset>
1255            <packageset dir="${icu4j.collate.dir}/src">
1256                <include name="com/ibm/icu/text/**"/>
1257                <include name="com/ibm/icu/util/**"/>
1258            </packageset>
1259            <packageset dir="${icu4j.charset.dir}/src">
1260                <include name="com/ibm/icu/charset/**"/>
1261            </packageset>
1262            <packageset dir="${icu4j.translit.dir}/src">
1263                <include name="com/ibm/icu/text/**"/>
1264            </packageset>
1265            <doclet name="com.ibm.icu.dev.tool.docs.GatherAPIData" path="${icu4j.build-tools.jar}">
1266                <param name="-name" value="ICU4J ${icu4j.impl.version}"/>
1267                <param name="-output" value="${out.dir}/icu4j${api.report.version}.api3"/>
1268                <param name="-internal"/>
1269                <param name="-version"/>
1270                <param name="-gzip"/>
1271            </doclet>
1272        </javadoc>
1273    </target>
1274
1275    <target name="apireport" depends="info, gatherapi" description="Run API report generator tool">
1276        <java classname="com.ibm.icu.dev.tool.docs.ReportAPI"
1277                classpath="${icu4j.build-tools.jar}"
1278                failonerror="true">
1279            <arg value="-old:" />
1280            <arg value="${icu4j.build-tools.dir}/icu4j${api.report.prev.version}.api3.gz" />
1281            <arg value="-new:" />
1282            <arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
1283            <arg value="-html" />
1284            <arg value="-out:" />
1285            <arg value="${out.dir}/icu4j_compare_${api.report.prev.version}_${api.report.version}.html" />
1286        </java>
1287    </target>
1288
1289    <target name="gatherapiOld" depends="info, build-tools" description="Run API database generator tool (Pre Java 5 style)">
1290        <mkdir dir="${out.dir}"/>
1291        <javadoc source="1.6"
1292                 bootclasspath="${java6.bootclasspath}"
1293                 encoding="${java.src.encoding}">
1294            <packageset dir="${icu4j.core.dir}/src">
1295                <include name="com/ibm/icu/lang/**"/>
1296                <include name="com/ibm/icu/math/**"/>
1297                <include name="com/ibm/icu/text/**"/>
1298                <include name="com/ibm/icu/util/**"/>
1299            </packageset>
1300            <packageset dir="${icu4j.collate.dir}/src">
1301                <include name="com/ibm/icu/text/**"/>
1302                <include name="com/ibm/icu/util/**"/>
1303            </packageset>
1304            <packageset dir="${icu4j.charset.dir}/src">
1305                <include name="com/ibm/icu/charset/**"/>
1306            </packageset>
1307            <packageset dir="${icu4j.translit.dir}/src">
1308                <include name="com/ibm/icu/text/**"/>
1309            </packageset>
1310            <doclet name="com.ibm.icu.dev.tool.docs.GatherAPIDataOld" path="${icu4j.build-tools.jar}">
1311                <param name="-name" value="ICU4J ${icu4j.impl.version}"/>
1312                <param name="-output" value="${out.dir}/icu4j${api.report.version}.api"/>
1313                <param name="-internal"/>
1314                <param name="-gzip"/>
1315            </doclet>
1316        </javadoc>
1317    </target>
1318
1319    <target name="apireportOld" depends="info, gatherapiOld" description="Run API report generator tool (Pre Java 5 Style)">
1320        <java classname="com.ibm.icu.dev.tool.docs.ReportAPI"
1321                classpath="${icu4j.build-tools.jar}"
1322                failonerror="true">
1323            <arg value="-old:" />
1324            <arg value="${icu4j.build-tools.dir}/icu4j${api.report.prev.version}.api.gz" />
1325            <arg value="-new:" />
1326            <arg value="${out.dir}/icu4j${api.report.version}.api.gz" />
1327            <arg value="-html" />
1328            <arg value="-internal" />
1329            <arg value="-out:" />
1330            <arg value="${out.dir}/icu4j_compare_${api.report.prev.version}_${api.report.version}.html" />
1331        </java>
1332    </target>
1333
1334    <target name="checkDeprecated" depends="info, build-tools, gatherapi, main"
1335        description="Check consistency between javadoc @deprecated and @Deprecated annotation">
1336        <java classname="com.ibm.icu.dev.tool.docs.DeprecatedAPIChecker"
1337                failonerror="true">
1338            <arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
1339            <classpath>
1340                <pathelement location="${icu4j.build-tools.jar}"/>
1341                <pathelement location="${icu4j.core.jar}"/>
1342                <pathelement location="${icu4j.collate.jar}"/>
1343                <pathelement location="${icu4j.charset.jar}"/>
1344                <pathelement location="${icu4j.currdata.jar}"/>
1345                <pathelement location="${icu4j.langdata.jar}"/>
1346                <pathelement location="${icu4j.regiondata.jar}"/>
1347                <pathelement location="${icu4j.translit.jar}"/>
1348            </classpath>
1349        </java>
1350    </target>
1351
1352    <target name="draftAPIs" depends="info, gatherapi" description="Run API collector tool and generate draft API report">
1353        <java classname="com.ibm.icu.dev.tool.docs.CollectAPI"
1354                classpath="${icu4j.build-tools.jar}"
1355                failonerror="true">
1356            <arg value="-f"/>
1357            <arg value="Draft"/>
1358            <arg value="-o"/>
1359            <arg value="${out.dir}/draftAPIs.html"/>
1360            <arg value="${out.dir}/icu4j${api.report.version}.api3.gz" />
1361        </java>
1362    </target>
1363
1364    <target name="swatDeprecated" depends="build-tools" description="Convert @deprecated @draft tags to @provisional">
1365        <antcall target="_runSwatDeprecated">
1366            <param name="swat.deprecated.opt" value="-dep"/>
1367        </antcall>
1368    </target>
1369
1370    <target name="swatProvisional" depends="build-tools" description="Convert @provisional tags to @deprecated @draft">
1371        <antcall target="_runSwatDeprecated">
1372            <param name="swat.deprecated.opt" value="-prov"/>
1373        </antcall>
1374    </target>
1375
1376    <target name="_runSwatDeprecated">
1377        <java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated"
1378                classpath="${icu4j.build-tools.jar}"
1379                failonerror="true">
1380            <arg value="${swat.deprecated.opt}"/>
1381            <arg value="-src"/>
1382            <arg value="${icu4j.core.dir}/src"/>
1383            <arg value="-dst"/>
1384            <arg value="${icu4j.core.dir}/src"/>
1385            <arg value="-overwrite"/>
1386            <arg value="-verbose"/>
1387        </java>
1388        <java classname="com.ibm.icu.dev.tool.docs.SwatDeprecated"
1389                classpath="${icu4j.build-tools.jar}"
1390                failonerror="true">
1391            <arg value="${swat.deprecated.opt}"/>
1392            <arg value="-src"/>
1393            <arg value="${icu4j.charset.dir}/src"/>
1394            <arg value="-dst"/>
1395            <arg value="${icu4j.charset.dir}/src"/>
1396            <arg value="-overwrite"/>
1397            <arg value="-verbose"/>
1398        </java>
1399    </target>
1400
1401    <target name="serialTestData" depends="main, tests">
1402        <property name="serial.test.data.dir" value="${out.dir}/serialTestData"/>
1403        <delete dir="${serial.test.data.dir}"/>
1404        <mkdir dir="${serial.test.data.dir}"/>
1405        <java classname="com.ibm.icu.dev.test.serializable.SerializableWriter" fork="yes" failonerror="true">
1406            <arg line="${serial.test.data.dir}"/>
1407            <classpath>
1408                <pathelement location="${icu4j.core.jar}"/>
1409                <pathelement location="${icu4j.collate.jar}"/>
1410                <pathelement location="${icu4j.charset.jar}"/>
1411                <pathelement location="${icu4j.currdata.jar}"/>
1412                <pathelement location="${icu4j.langdata.jar}"/>
1413                <pathelement location="${icu4j.regiondata.jar}"/>
1414                <pathelement location="${icu4j.translit.jar}"/>
1415                <pathelement location="${icu4j.test-framework.jar}"/>
1416                <pathelement location="${icu4j.core-tests.jar}"/>
1417            </classpath>
1418        </java>
1419        <echo message="Note: The serialization compatibility test data files were"/>
1420        <echo message="created in ${serial.test.data.dir}. Once you confirm"/>
1421        <echo message="the test runs clean, you should copy the data file directory to"/>
1422        <echo message="main/tests/core/src/com/ibm/icu/dev/test/serializable/data."/>
1423    </target>
1424
1425    <!-- Special packaging targets -->
1426    <target name="translitIMEJar" depends="info" description="Build transliterator IME 'icutransime.jar' jar file">
1427        <property name="translit.ime.out.dir" value="${out.dir}/translit_ime"/>
1428
1429        <mkdir dir="${translit.ime.out.dir}/bin"/>
1430        <javac destdir="${translit.ime.out.dir}/bin"
1431                source="${javac.source}"
1432                target="${javac.target}"
1433                encoding="${java.src.encoding}"
1434                debug="on" deprecation="off">
1435            <src path="${icu4j.core.dir}/src"/>
1436            <src path="${icu4j.translit.dir}/src"/>
1437            <src path="${icu4j.tools.dir}/src"/>
1438            <include name="com/ibm/icu/dev/tool/ime/translit/*.java"/>
1439        </javac>
1440
1441        <copy file="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit/Transliterator.properties"
1442                todir="${translit.ime.out.dir}/bin/com/ibm/icu/dev/tool/ime/translit"/>
1443
1444        <mkdir dir="${translit.ime.out.dir}/lib"/>
1445        <jar jarfile="${translit.ime.out.dir}/lib/icutransime.jar"
1446                compress="true"
1447                basedir="${translit.ime.out.dir}/bin"
1448                includes="com/ibm/icu/dev/tool/ime/translit/**/*"
1449                manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit/manifest.stub">
1450            <metainf dir="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/translit" includes="services/*" />
1451        </jar>
1452    </target>
1453
1454    <target name="indicIMEJar" depends="info" description="Build indic IME 'icuindicime.jar' jar file">
1455        <property name="indic.ime.out.dir" value="${out.dir}/indic_ime"/>
1456
1457        <mkdir dir="${indic.ime.out.dir}/bin"/>
1458        <javac destdir="${indic.ime.out.dir}/bin"
1459                source="${javac.source}"
1460                target="${javac.target}"
1461                encoding="${java.src.encoding}"
1462                debug="on" deprecation="off">
1463            <src path="${icu4j.core.dir}/src"/>
1464            <src path="${icu4j.tools.dir}/src"/>
1465            <include name="com/ibm/icu/dev/tool/ime/indic/*.java"/>
1466        </javac>
1467
1468        <copy file="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic/DisplayNames.properties"
1469                todir="${indic.ime.out.dir}/bin/com/ibm/icu/dev/tool/ime/indic"/>
1470
1471        <mkdir dir="${indic.ime.out.dir}/lib"/>
1472        <jar jarfile="${indic.ime.out.dir}/lib/icuindicime.jar"
1473                compress="true"
1474                basedir="${indic.ime.out.dir}/bin"
1475                includes="com/ibm/icu/dev/tool/ime/indic/**/*"
1476                manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic/manifest.stub">
1477            <metainf dir="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/ime/indic" includes="services/*" />
1478        </jar>
1479    </target>
1480
1481    <target name="cldrUtil" depends="icu4jJar" description="Build Utilities for CLDR tooling">
1482        <mkdir dir="${cldr.util.out.dir}/bin"/>
1483        <javac destdir="${cldr.util.out.dir}/bin"
1484                source="${javac.source}"
1485                target="${javac.target}"
1486                encoding="${java.src.encoding}"
1487                debug="on" deprecation="off"
1488                classpath="${icu4j.jar.file}">
1489
1490            <src path="${icu4j.tools.dir}/src"/>
1491            <src path="${icu4j.translit-tests.dir}/src"/>
1492            <src path="${icu4j.test-framework.dir}/src"/>
1493
1494            <include name="com/ibm/icu/dev/test/TestFmwk.java" />
1495            <include name="com/ibm/icu/dev/util/*.java" />
1496            <include name="com/ibm/icu/dev/tool/UOption.java" />
1497        </javac>
1498
1499        <mkdir dir="${cldr.util.out.dir}/lib"/>
1500        <jar jarfile="${cldr.util.out.dir}/lib/utilities.jar"
1501                compress="true"
1502                basedir="${cldr.util.out.dir}/bin">
1503            <include name="com/ibm/icu/dev/test/*.class"/>
1504            <include name="com/ibm/icu/dev/util/*.class"/>
1505            <include name="com/ibm/icu/dev/tool/UOption*.class"/>
1506        </jar>
1507    </target>
1508
1509    <target name="releaseCLDR" depends="icu4jJar,icu4jSrcJar,cldrUtil" description="Build release files for CLDR tooling">
1510        <mkdir dir="${cldr.release.dir}"/>
1511        <!-- icu4j.jar -->
1512        <copy file="${icu4j.jar.file}" todir="${cldr.release.dir}"/>
1513        <!-- icu4j-src.jar -->
1514        <copy file="${icu4j-src.jar.file}" todir="${cldr.release.dir}"/>
1515        <!-- utilities.jar -->
1516        <copy file="${cldr.util.out.dir}/lib/utilities.jar" todir="${cldr.release.dir}"/>
1517        <!-- utilities-src.jar -->
1518        <jar jarfile="${cldr.release.dir}/utilities-src.jar" compress="true">
1519            <fileset dir="${icu4j.test-framework.dir}/${src.dir}">
1520                <include name="com/ibm/icu/dev/test/TestFmwk.java"/>
1521                <include name="com/ibm/icu/dev/test/*Log*.java"/>
1522                <include name="com/ibm/icu/dev/test/TestUtil.java"/>
1523                <include name="com/ibm/icu/dev/test/UTF16Util.java"/>
1524            </fileset>
1525            <fileset dir="${icu4j.test-framework.dir}/${src.dir}" includes="com/ibm/icu/dev/util/*.java"/>
1526            <fileset dir="${icu4j.translit-tests.dir}/${src.dir}" includes="com/ibm/icu/dev/util/*.java"/>
1527            <fileset dir="${icu4j.tools.dir}/${src.dir}" includes="com/ibm/icu/dev/tool/UOption.java"/>
1528       </jar>
1529    </target>
1530
1531    <target name="xliff" description="Build xliff converter tool">
1532        <property name="xliff.out.dir" value="${out.dir}/xliff"/>
1533
1534        <mkdir dir="${xliff.out.dir}/bin"/>
1535        <javac destdir="${xliff.out.dir}/bin"
1536                source="1.3"
1537                target="1.3"
1538                encoding="${java.src.encoding}"
1539                debug="on" deprecation="off">
1540            <src path="${icu4j.tools.dir}/src"/>
1541            <include name="com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java"/>
1542            <include name="com/ibm/icu/dev/tool/localeconverter/XLIFF2ICUConverter.java"/>
1543            <include name="com/ibm/icu/dev/tool/UOption.java"/>
1544       </javac>
1545
1546        <mkdir dir="${xliff.out.dir}/lib"/>
1547
1548        <jar jarfile="${xliff.out.dir}/lib/xliff-src.jar"
1549                compress="true"
1550                basedir="${icu4j.tools.dir}/src">
1551            <include name="com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java"/>
1552            <include name="com/ibm/icu/dev/tool/localeconverter/XLIFF2ICUConverter.java"/>
1553            <include name="com/ibm/icu/dev/tool/UOption.java"/>
1554        </jar>
1555
1556        <jar jarfile="${xliff.out.dir}/lib/xliff.jar"
1557                compress="true"
1558                basedir="${xliff.out.dir}/bin"
1559                manifest="${icu4j.tools.dir}/src/com/ibm/icu/dev/tool/localeconverter/manifest.stub"/>
1560    </target>
1561
1562    <target name="publishToMavenRepo" depends="releaseVer">
1563        <!--
1564            Publish libraries to Maven repositories, snapshot or release depending on current
1565            version in pom.xml.
1566
1567            Prerequisites
1568
1569            1) Apache Maven Ant tasks - http://maven.apache.org/ant-tasks
1570            2) GnuPG
1571            3) Put build-local.properties to specify followings
1572
1573                maven-ant-tasks.jar = [location of maven ant tasks jar file]
1574                gpg.user = ICU Project
1575                gpg.passphrase = [passprase for ICU Project's PGP key]
1576
1577            4) Maven configuration file ~/.m2/settings.xml
1578                <settings>
1579                    <servers>
1580                        <server>
1581                            <id>icu4j-releases</id>
1582                            <username>[your JIRA/Nexus ID]</username>
1583                            <password>[your JIRA/Nexus password]</password>
1584                        </server>
1585                        <server>
1586                            <id>icu4j-snapshots</id>
1587                            <username>[your JIRA/Nexus ID]</username>
1588                            <password>[your JIRA/Nexus password]</password>
1589                        </server>
1590                    </servers>
1591                </settings>
1592
1593            Note: For now, charset.jar and localespi.jar are excluded.
1594        -->
1595        <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"/>
1596        <condition property="no_maven-ant-tasks">
1597            <available file="${maven-ant-tasks.jar}"/>
1598        </condition>
1599        <fail message="Maven Ant Tasks not found at ${maven-ant-tasks.jar}" unless="no_maven-ant-tasks"/>
1600
1601        <path id="maven-ant-tasks.classpath" path="${maven-ant-tasks.jar}"/>
1602        <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
1603            classpathref="maven-ant-tasks.classpath"/>
1604
1605        <xmlproperty file="pom.xml" prefix="pom.xml"/>
1606
1607        <!-- copy release files -->
1608        <property name="maven.release.dir" value="${release.dir}/maven"/>
1609
1610        <property name="maven.icu4j.jar.versioned.file" value="icu4j-${pom.xml.project.version}.jar"/>
1611        <property name="maven.icu4j-src.jar.versioned.file" value="icu4j-${pom.xml.project.version}-src.jar"/>
1612        <property name="maven.icu4jdocs.jar.file" value="icu4j-${pom.xml.project.version}-javadoc.jar"/>
1613
1614        <mkdir dir="${maven.release.dir}"/>
1615
1616        <copy file="${release.dir}/${icu4j.jar.versioned.file}" tofile="${maven.release.dir}/${maven.icu4j.jar.versioned.file}"/>
1617        <copy file="${release.dir}/${icu4j-src.jar.versioned.file}" tofile="${maven.release.dir}/${maven.icu4j-src.jar.versioned.file}"/>
1618        <copy file="${release.dir}/${icu4jdocs.jar.versioned.file}" tofile="${maven.release.dir}/${maven.icu4jdocs.jar.file}"/>
1619
1620        <copy file="pom.xml" todir="${maven.release.dir}"/>
1621
1622        <!-- sign release files-->
1623        <macrodef name="gpg">
1624            <attribute name="file"/>
1625            <sequential>
1626                <delete file="@{file}.asc" failonerror="false"/>
1627                <exec executable="gpg">
1628                    <arg value="-u"/>
1629                    <arg value="${gpg.user}"/>
1630                    <arg value="-ab"/>
1631                    <arg value="--passphrase"/>
1632                    <arg value="${gpg.passphrase}"/>
1633                    <arg value="-o"/>
1634                    <arg value="@{file}.asc"/>
1635                    <arg value="@{file}"/>
1636                </exec>
1637            </sequential>
1638        </macrodef>
1639
1640        <gpg file="${maven.release.dir}/${maven.icu4j.jar.versioned.file}"/>
1641        <gpg file="${maven.release.dir}/${maven.icu4j-src.jar.versioned.file}"/>
1642        <gpg file="${maven.release.dir}/${maven.icu4jdocs.jar.file}"/>
1643
1644        <gpg file="${maven.release.dir}/pom.xml"/>
1645
1646        <!-- deploy files to the repository -->
1647        <deploy xmlns="urn:maven-artifact-ant" file="${maven.release.dir}/${maven.icu4j.jar.versioned.file}">
1648            <pom file="${maven.release.dir}/pom.xml"/>
1649            <attach file="${maven.release.dir}/pom.xml.asc" type="pom.asc"/>
1650
1651            <attach file="${maven.release.dir}/${maven.icu4j.jar.versioned.file}.asc" type="jar.asc"/>
1652            <attach file="${maven.release.dir}/${maven.icu4j-src.jar.versioned.file}" classifier="sources"/>
1653            <attach file="${maven.release.dir}/${maven.icu4j-src.jar.versioned.file}.asc" classifier="sources" type="jar.asc"/>
1654            <attach file="${maven.release.dir}/${maven.icu4jdocs.jar.file}" classifier="javadoc"/>
1655            <attach file="${maven.release.dir}/${maven.icu4jdocs.jar.file}.asc" classifier="javadoc" type="jar.asc"/>
1656        </deploy>
1657
1658        <antcall target="_verify_config_for_release"/>
1659    </target>
1660
1661</project>
1662