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