common-targets.xml revision 7935b1839a081ed19ae0d33029ad3c09632a2caa
1<!--
2*******************************************************************************
3* Copyright (C) 2009-2014, International Business Machines Corporation and    *
4* others. All Rights Reserved.                                                *
5*******************************************************************************
6-->
7<project name="common-targets" basedir=".">
8    <dirname property="common-targets.dir" file="${ant.file.common-targets}"/>
9    <property file="${common-targets.dir}/locations.properties"/>
10    <property file="${common-targets.dir}/common.properties"/>
11    <property environment="env"/>
12
13    <!-- common targets -->
14
15    <target name="@clean">
16        <delete dir="${out.dir}"/>
17    </target>
18
19    <target name="@compile">
20        <echo message="--- java compiler arguments ------------------------"/>
21        <echo message="source dir:     ${basedir}/${src.dir}"/>
22        <echo message="output dir:     ${basedir}/${bin.dir}"/>
23        <echo message="classpath:      ${toString:javac.classpathref}"/>
24        <echo message="source:         ${javac.source}"/>
25        <echo message="target:         ${javac.target}"/>
26        <echo message="debug:          ${javac.debug}"/>
27        <echo message="encoding:       ${java.src.encoding}"/>
28        <echo message="compiler arg:   ${javac.compilerarg}"/>
29        <echo message="----------------------------------------------------"/>
30
31        <mkdir dir="${bin.dir}"/>
32        <javac
33            srcdir="${src.dir}"
34            destdir="${bin.dir}"
35            classpathref="javac.classpathref"
36            source="${javac.source}"
37            target="${javac.target}"
38            debug="${javac.debug}"
39            encoding="${java.src.encoding}"
40            includeAntRuntime="no">
41            <compilerarg value="${javac.compilerarg}"/>
42        </javac>
43    </target>
44
45    <target name="@copy">
46        <mkdir dir="${bin.dir}"/>
47        <copy todir="${bin.dir}">
48            <fileset dir="${src.dir}" defaultexcludes="yes">
49                <exclude name="**/*.java"/>
50            </fileset>
51        </copy>
52    </target>
53
54    <target name="@jar">
55        <mkdir dir="${jar.dir}"/>
56
57        <copy file="manifest.stub" todir="${out.dir}">
58            <filterset>
59                <filter token="SPECVERSION" value="${jar.spec.version}"/>
60                <filter token="IMPLVERSION" value="${jar.impl.version}"/>
61                <filter token="COPYRIGHT" value="${jar.copyright.info}"/>
62                <filter token="EXECENV" value="${jar.exec.env}"/>
63            </filterset>
64        </copy>
65
66        <jar jarfile="${jar.dir}/${jar.name}" manifest="${out.dir}/manifest.stub" compress="true">
67            <fileset dir="${bin.dir}" includes="**/*"/>
68            <fileset dir="${shared.dir}/licenses">
69                <include name="license.html"/>
70            </fileset>
71        </jar>
72    </target>
73
74    <target name="@src-jar">
75        <mkdir dir="${jar.dir}"/>
76        <jar jarfile="${jar.dir}/${src.jar.name}" compress="true">
77            <fileset dir="${src.dir}" includes="**/*.java"/>
78            <fileset dir="${shared.dir}/licenses">
79                <include name="license.html"/>
80            </fileset>
81        </jar>
82    </target>
83
84    <target name="@build-all">
85        <antcall target="_all.${ant.project.name}"/>
86    </target>
87
88    <target name="@full-locale-names">
89        <echo message="Generating ${res.dir}/fullLocaleNames.lst"/>
90        <pathconvert pathsep="${line.separator}" property="full.locale.names">
91            <fileset dir="${res.dir}">
92                <include name="??.res"/>
93                <include name="??_*.res"/>
94                <include name="???.res"/>
95                <include name="???_*.res"/>
96                <include name="root.res"/>
97                <exclude name="res_index.res"/>
98            </fileset>
99            <chainedmapper>
100                <flattenmapper/>
101                <globmapper from="*.res" to="*"/>
102            </chainedmapper>
103        </pathconvert>
104        <echo message="${full.locale.names}" file="${res.dir}/fullLocaleNames.lst"/>
105    </target>
106
107    <!-- FindBugs targets -->
108    <target name="_findbugs_init">
109        <property name="findbugs.home" value="${env.FINDBUGS_HOME}"/>
110        <echo message="----------------------------------------------------"/>
111        <echo message="findbugs.home:  ${findbugs.home}"/>
112        <echo message="----------------------------------------------------"/>
113
114        <fail message="FindBugs task not found. Set environment variable FINDBUGS_HOME properly.">
115            <condition>
116                <not>
117                    <or>
118                        <available classname="edu.umd.cs.findbugs.anttask.FindBugsTask" property="_findbugs.task.available" />
119                        <available file="${findbugs.home}/lib/findbugs-ant.jar" />
120                    </or>
121                </not>
122            </condition>
123        </fail>
124        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
125            classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
126
127        <property name="aux.classpath" value="${toString:javac.classpathref}"/>
128        <condition property="empty.aux.classpath">
129            <length string="${aux.classpath}" when="eq" length="0"/>
130        </condition>
131    </target>
132
133    <target name="_findbugs_empty_aux_classpath" if="empty.aux.classpath">
134        <findbugs
135            home="${findbugs.home}"
136            output="html"
137            outputFile="${out.dir}/fb-${ant.project.name}.html"
138            excludeFilter="findbugs-exclude.xml">
139 
140            <sourcePath path="${src.dir}"/>
141            <class location="${jar.dir}/${jar.name}"/>
142        </findbugs>
143    </target>
144
145    <target name="_findbugs_non_empty_aux_classpath" unless="empty.aux.classpath">
146        <findbugs
147            home="${findbugs.home}"
148            output="html"
149            outputFile="${out.dir}/fb-${ant.project.name}.html"
150            excludeFilter="findbugs-exclude.xml">
151 
152            <sourcePath path="${src.dir}"/>
153            <class location="${jar.dir}/${jar.name}"/>
154            <auxClasspath path="${aux.classpath}"/>
155        </findbugs>
156    </target>
157
158    <target name="@findbugs" depends="_findbugs_init, @build-all, _findbugs_empty_aux_classpath, _findbugs_non_empty_aux_classpath"/>
159
160    <!-- Dependencies -->
161
162    <!-- collate -->
163    <path id="javac.classpathref.collate">
164        <pathelement location="${icu4j.core.jar}"/>
165    </path>
166
167    <target name="_all.collate" depends="_all.core">
168        <ant dir="${icu4j.collate.dir}" inheritAll="false"/>
169    </target>
170
171    <!-- core -->
172    <path id="javac.classpathref.core"/>
173
174    <target name="_all.core">
175        <ant dir="${icu4j.core.dir}" inheritAll="false"/>
176    </target>
177
178    <!-- charset -->
179    <path id="javac.classpathref.charset">
180        <pathelement location="${icu4j.core.jar}"/>
181    </path>
182
183    <target name="_all.charset" depends="_all.core">
184        <ant dir="${icu4j.charset.dir}" inheritAll="false"/>
185    </target>
186
187    <!-- currdata -->
188    <path id="javac.classpathref.currdata">
189        <pathelement location="${icu4j.core.jar}"/>
190    </path>
191
192    <target name="_all.currdata" depends="_all.core">
193        <ant dir="${icu4j.currdata.dir}" inheritAll="false"/>
194    </target>
195
196    <!-- langdata -->
197    <path id="javac.classpathref.langdata">
198        <pathelement location="${icu4j.core.jar}"/>
199    </path>
200
201    <target name="_all.langdata" depends="_all.core">
202        <ant dir="${icu4j.langdata.dir}" inheritAll="false"/>
203    </target>
204
205    <!-- localespi -->
206    <path id="javac.classpathref.localespi">
207        <pathelement location="${icu4j.core.jar}"/>
208        <pathelement location="${icu4j.collate.jar}"/>
209    </path>
210
211    <target name="_all.localespi" depends="_all.core, _all.collate">
212        <ant dir="${icu4j.localespi.dir}" inheritAll="false"/>
213    </target>
214
215    <!-- regiondata -->
216    <path id="javac.classpathref.regiondata">
217        <pathelement location="${icu4j.core.jar}"/>
218    </path>
219
220    <target name="_all.regiondata" depends="_all.core">
221        <ant dir="${icu4j.regiondata.dir}" inheritAll="false"/>
222    </target>
223
224    <!-- translit -->
225    <path id="javac.classpathref.translit">
226        <pathelement location="${icu4j.core.jar}"/>
227        <pathelement location="${icu4j.translit.jar}"/>
228    </path>
229
230    <target name="_all.translit" depends="_all.core">
231        <ant dir="${icu4j.translit.dir}" inheritAll="false"/>
232    </target>
233
234    <!-- test-framework -->
235    <path id="javac.classpathref.test-framework">
236        <pathelement location="${icu4j.core.jar}"/>
237    </path>
238
239    <target name="_all.test-framework" depends="_all.core">
240        <ant dir="${icu4j.test-framework.dir}" inheritAll = "false"/>
241    </target>
242
243    <!-- core-tests -->
244    <path id="javac.classpathref.core-tests">
245        <pathelement location="${icu4j.core.jar}"/>
246        <pathelement location="${icu4j.test-framework.jar}"/>
247    </path>
248
249    <target name="_all.core-tests" depends="_all.core, _all.test-framework">
250        <ant dir="${icu4j.core-tests.dir}" inheritAll="false"/>
251    </target>
252
253    <!-- collate-tests -->
254    <path id="javac.classpathref.collate-tests">
255        <pathelement location="${icu4j.core.jar}"/>
256        <pathelement location="${icu4j.collate.jar}"/>
257        <pathelement location="${icu4j.test-framework.jar}"/>
258    </path>
259
260    <target name="_all.collate-tests" depends="_all.core, _all.collate, _all.test-framework">
261        <ant dir="${icu4j.collate-tests.dir}" inheritAll="false"/>
262    </target>
263
264    <!-- charset-tests -->
265    <path id="javac.classpathref.charset-tests">
266        <pathelement location="${icu4j.core.jar}"/>
267        <pathelement location="${icu4j.charset.jar}"/>
268        <pathelement location="${icu4j.test-framework.jar}"/>
269    </path>
270
271    <target name="_all.charset-tests" depends="_all.core, _all.charset, _all.test-framework">
272        <ant dir="${icu4j.charset-tests.dir}" inheritAll="false"/>
273    </target>
274
275    <!-- localespi-tests -->
276    <path id="javac.classpathref.localespi-tests">
277        <pathelement location="${icu4j.core.jar}"/>
278	<pathelement location="${icu4j.collate.jar}"/>
279        <pathelement location="${icu4j.localespi.jar}"/>
280        <pathelement location="${icu4j.test-framework.jar}"/>
281    </path>
282
283    <target name="_all.localespi-tests" depends="_all.core, _all.collate, _all.localespi, _all.test-framework">
284        <ant dir="${icu4j.localespi-tests.dir}" inheritAll="false"/>
285    </target>
286
287    <!-- packaging-tests -->
288    <path id="javac.classpathref.packaging-tests">
289        <pathelement location="${icu4j.core.jar}"/>
290        <pathelement location="${icu4j.charset.jar}"/>
291        <pathelement location="${icu4j.test-framework.jar}"/>
292    </path>
293
294    <target name="_all.packaging-tests" depends="_all.core, _all.charset, _all.test-framework">
295        <ant dir="${icu4j.packaging-tests.dir}" inheritAll="false"/>
296    </target>
297
298    <!-- translit-tests -->
299    <path id="javac.classpathref.translit-tests">
300        <pathelement location="${icu4j.core.jar}"/>
301        <pathelement location="${icu4j.translit.jar}"/>
302        <pathelement location="${icu4j.test-framework.jar}"/>
303    </path>
304
305    <target name="_all.translit-tests" depends="_all.core, _all.translit, _all.test-framework">
306        <ant dir="${icu4j.translit-tests.dir}" inheritAll="false"/>
307    </target>
308
309    <!-- testall -->
310    <path id="javac.classpathref.testall">
311        <pathelement location="${icu4j.core.jar}"/>
312        <pathelement location="${icu4j.test-framework.jar}"/>
313    </path>
314
315    <target name="_all.testall" depends="_all.core, _all.test-framework">
316        <ant dir="${icu4j.testall.dir}" inheritAll="false"/>
317    </target>
318
319
320    <!-- build-tools -->
321    <path id="javac.classpathref.build-tools">
322        <pathelement location="${env.JAVA_HOME}/lib/tools.jar"/>
323    </path>
324
325    <target name="_all.build-tools">
326        <ant dir="${icu4j.build-tools.dir}" inheritAll="false"/>
327    </target>
328
329    <!-- tools -->
330    <path id="javac.classpathref.tools">
331        <pathelement location="${icu4j.core.jar}"/>
332        <pathelement location="${icu4j.collate.jar}"/>
333        <pathelement location="${icu4j.translit.jar}"/>
334        <pathelement location="${icu4j.test-framework.jar}"/>
335        <pathelement location="${icu4j.core-tests.jar}"/>
336        <pathelement location="${icu4j.translit-tests.jar}"/>
337    </path>
338
339    <target name="_all.tools" depends="_all.core, _all.collate, _all.translit, _all.test-framework, _all.core-tests, _all.translit-tests">
340        <ant dir="${icu4j.tools.dir}" inheritAll="false"/>
341    </target>
342
343    <!-- demos -->
344    <path id="javac.classpathref.demos">
345        <pathelement location="${icu4j.core.jar}"/>
346        <pathelement location="${icu4j.translit.jar}"/>
347        <pathelement location="${icu4j.charset.jar}"/>
348    </path>
349
350    <target name="_all.demos" depends="_all.core, _all.translit, _all.charset">
351        <ant dir="${icu4j.demos.dir}" inheritAll="false"/>
352    </target>
353
354    <!-- samples -->
355    <path id="javac.classpathref.samples">
356        <pathelement location="${icu4j.core.jar}"/>
357        <pathelement location="${icu4j.collate.jar}"/>
358        <pathelement location="${icu4j.translit.jar}"/>
359        <pathelement location="${icu4j.charset.jar}"/>
360    </path>
361
362    <target name="_all.samples" depends="_all.core, _all.collate, _all.translit, _all.charset">
363        <ant dir="${icu4j.samples.dir}" inheritAll="false"/>
364    </target>
365
366    <!-- perf -->
367    <path id="javac.classpathref.perf-tests">
368        <pathelement location="${icu4j.core.jar}"/>
369        <pathelement location="${icu4j.charset.jar}"/>
370        <pathelement location="${icu4j.collate.jar}"/>
371        <pathelement location="${icu4j.tools.jar}"/>
372    </path>
373
374    <target name="_all.perf-tests" depends="_all.core, _all.charset, _all.collate, _all.tools">
375        <ant dir="${icu4j.perf-tests.dir}" inheritAll="false"/>
376    </target>
377
378</project>
379