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