1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454
|
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="Commons IO" default="jar" basedir=".">
<!--
"IO" component of the Apache Commons Subproject
$Id: build.xml 612689 2008-01-17 03:04:28Z niallp $
$Revision: 612689 $ $Date: 2008-01-17 03:04:28 +0000 (Thu, 17 Jan 2008) $
-->
<!-- ========== Initialize Properties ===================================== -->
<property file="project.properties"/> <!-- Project local -->
<property file="build.properties"/> <!-- Component local -->
<property file="${user.home}/build.properties"/> <!-- User local -->
<!-- ========== External Dependencies ===================================== -->
<!-- The directories corresponding to your necessary dependencies -->
<property name="junit.home" value="/usr/local/junit3.8.1"/>
<property name="junit.jar" value="${junit.home}/junit.jar"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="commons-io"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.io"/>
<!-- The title of this component -->
<property name="component.title" value="Commons IO"/>
<!-- The current version number of this component -->
<property name="component.version" value="1.4"/>
<!-- The base directory for component sources -->
<property name="source.home" value="src/java"/>
<!-- The base directory for unit test sources -->
<property name="test.home" value="src/test"/>
<!-- Download lib dir -->
<property name="download.lib.dir" value="lib"/>
<!-- The base directory for compilation targets -->
<property name="build.home" value="target"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="${build.home}/dist"/>
<!-- Base file name for dist files -->
<property name="final.name" value="${component.name}-${component.version}"/>
<!-- Directory where binary release files are staged -->
<property name="stage.bin.dir" value="${dist.home}/stage-bin"/>
<!-- Directory where source release files are staged -->
<property name="stage.src.dir" value="${dist.home}/stage-src"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<!-- Should Java compilations set the 'deprecation' compiler option? -->
<property name="compile.deprecation" value="false"/>
<!-- Should Java compilations set the 'optimize' compiler option? -->
<property name="compile.optimize" value="true"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${build.home}/classes"/>
</path>
<!-- Construct compile classpath -->
<path id="downloaded.lib.classpath">
<pathelement location="${download.lib.dir}/junit.jar"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/test-classes"/>
<pathelement location="${junit.jar}"/>
<path refid="downloaded.lib.classpath"/>
</path>
<!-- Should all tests fail if one does? -->
<property name="test.failonerror" value="true"/>
<!-- The test runner to execute -->
<property name="test.runner" value="junit.textui.TestRunner"/>
<!-- ========== Executable Targets ======================================== -->
<target name="clean" description="Clean build and distribution directories">
<delete dir="${build.home}"/>
<delete dir="test"/>
</target>
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="-------- ${component.title} ${component.version} --------"/>
<filter token="name" value="${component.name}"/>
<filter token="package" value="${component.package}"/>
<filter token="version" value="${component.version}"/>
<filter token="compilesource" value="${compile.source}"/>
<filter token="compiletarget" value="${compile.target}"/>
<tstamp/>
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/test-classes"/>
</target>
<!-- ========== Compile Targets =========================================== -->
<target name="compile" depends="init" description="Compile dependant on JDK version">
<condition property="is.jdk13">
<equals arg1="${ant.java.version}" arg2="1.3" />
</condition>
<condition property="not.jdk13">
<not><equals arg1="${ant.java.version}" arg2="1.3" /></not>
</condition>
<antcall target="compile.jdk13" />
<antcall target="compile.all" />
</target>
<!-- Compile all classes -->
<target name="compile.all" unless="is.jdk13"
description="Compile ALL classes">
<echo message="*** Compiling all classes ***" />
<!-- check JDK 1.4 -->
<fail message="switch to JDK 1.4+">
<condition>
<equals arg1="${ant.java.version}" arg2="1.3" />
</condition>
</fail>
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
source="${maven.compile.source}"
target="${maven.compile.target}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<!-- Compile excluding JDK 1.4 classes -->
<target name="compile.jdk13" unless="not.jdk13"
description="Compile ONLY JDK 1.3 compatible classes ">
<echo message="*** Compiling ONLY JDK 1.3 compatible classes ***" />
<!-- check JDK 1.3 -->
<fail message="switch to JDK 1.3">
<condition>
<not><equals arg1="${ant.java.version}" arg2="1.3" /></not>
</condition>
</fail>
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
<include name="**/*.java"/>
<exclude name="**/CharSequenceReader.java"/>
<exclude name="**/IOExceptionWithCause.java"/>
<exclude name="**/RegexFileFilter.java"/>
<exclude name="**/FileWriterWithEncoding.java"/>
</javac>
</target>
<!-- ========== Unit Test Targets ========================================= -->
<target name="compile.tests" depends="compile, download-dependencies" description="Compile unit test cases dependant on JDK version">
<antcall target="compile.tests.jdk13" />
<antcall target="compile.tests.all" />
</target>
<!-- Compile all classes -->
<target name="compile.tests.all" unless="is.jdk13"
description="Compile ALL test classes">
<echo message="*** Compiling all test classes ***" />
<!-- check JDK 1.4 -->
<fail message="switch to JDK 1.4+">
<condition>
<equals arg1="${ant.java.version}" arg2="1.3" />
</condition>
</fail>
<javac srcdir="${test.home}"
destdir="${build.home}/test-classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
</javac>
</target>
<!-- Compile excluding JDK 1.4 classes -->
<target name="compile.tests.jdk13" unless="not.jdk13"
description="Compile ONLY JDK 1.3 compatible test classes ">
<echo message="*** Compiling ONLY JDK 1.3 compatible test classes ***" />
<fail message="switch to JDK 1.3">
<condition>
<not><equals arg1="${ant.java.version}" arg2="1.3" /></not>
</condition>
</fail>
<javac srcdir="${test.home}"
destdir="${build.home}/test-classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
<include name="**/*.java"/>
<exclude name="**/RegexFileFilterTestCase.java"/>
<exclude name="**/FileWriterWithEncodingTest.java"/>
<exclude name="**/IOExceptionWithCauseTestCase.java"/>
<exclude name="**/CharSequenceReaderTest.java"/>
</javac>
</target>
<target name="test" depends="compile.tests"
description="Run all unit test cases">
<antcall target="run.tests.jdk13" />
<antcall target="run.tests.jdk14" />
</target>
<target name="run.tests.jdk13"
description="Run ONLY JDK 1.3 compatible test classes ">
<echo message="**** Running JDK 1.3 compatible test classes ****"/>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.PackageTestSuite"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.comparator.PackageTestSuite"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.filefilter.PackageTestSuite"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.input.PackageTestSuite"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.output.PackageTestSuite"/></antcall>
</target>
<target name="run.tests.jdk14" unless="is.jdk13"
description="Run ONLY tests requiring JDK 1.4">
<echo message="**** Running tests requiring JDK 1.4 ****"/>
<!-- check JDK 1.4 -->
<fail message="switch to JDK 1.4+">
<condition>
<equals arg1="${ant.java.version}" arg2="1.3" />
</condition>
</fail>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.IOExceptionWithCauseTestCase"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.filefilter.RegexFileFilterTestCase"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.input.CharSequenceReaderTest"/></antcall>
<antcall target="exec.test"><param name="testclass" value="org.apache.commons.io.output.FileWriterWithEncodingTest"/></antcall>
</target>
<target name="exec.test" description="Run a unit test case">
<echo message="Running Test ${testclass} ..."/>
<java classname="${test.runner}" fork="yes"
failonerror="${test.failonerror}">
<arg value="${testclass}"/>
<classpath refid="test.classpath"/>
</java>
</target>
<!-- ========== Produce JavaDocs ========================================== -->
<target name="javadoc" depends="compile" description="Create component Javadoc documentation">
<mkdir dir="${build.home}/apidocs"/>
<tstamp>
<format property="current.year" pattern="yyyy"/>
</tstamp>
<javadoc sourcepath="${source.home}"
destdir="${build.home}/apidocs"
packagenames="org.apache.commons.*"
author="true"
private="true"
version="true"
doctitle="<h1>${component.title} ${component.version}</h1>"
windowtitle="${component.title} ${component.version}"
bottom="Copyright (c) 2002-${current.year} Apache Software Foundation"
classpathref="compile.classpath" />
</target>
<!-- ========== Create Jar ================================================ -->
<target name="jar" depends="compile" description="Create jar file">
<mkdir dir="${build.home}/classes/META-INF"/>
<copy file="LICENSE.txt" tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt" tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
<manifest file="${build.home}/MANIFEST.MF">
<attribute name="Specification-Title" value="${component.title}"/>
<attribute name="Specification-Version" value="${component.version}"/>
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="${component.title}"/>
<attribute name="Implementation-Version" value="${component.version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="X-Compile-Source-JDK" value="${maven.compile.source}"/>
<attribute name="X-Compile-Target-JDK" value="${maven.compile.target}"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="Apache Commons-IO"/>
<attribute name="Bundle-Vendor" value="Apache Software Foundation"/>
<attribute name="Bundle-SymbolicName" value="org.apache.commons.io"/>
<attribute name="Bundle-Version" value="${component.version}"/>
<attribute name="Export-Package" value="org.apache.commons.io,org.apache.commons.io.comparator,org.apache.commons.io.filefilter,org.apache.commons.io.input,org.apache.commons.io.output"/>
</manifest>
<jar jarfile="${build.home}/${final.name}.jar"
basedir="${build.home}/classes"
manifest="${build.home}/MANIFEST.MF"/>
</target>
<!-- ========== Distribution Target =========================================== -->
<target name="dist" depends="clean,jar,javadoc" description="Create distribution artifacts">
<mkdir dir="${dist.home}"/>
<!-- jar(s) -->
<copy todir="${dist.home}">
<fileset dir=".">
<include name="RELEASE-NOTES.txt"/>
</fileset>
<fileset dir="${build.home}">
<include name="*.jar"/>
</fileset>
</copy>
<!-- Binary Distro -->
<mkdir dir="${stage.bin.dir}/${final.name}"/>
<copy todir="${stage.bin.dir}/${final.name}">
<fileset dir=".">
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
<include name="RELEASE-NOTES.txt"/>
</fileset>
<fileset dir="${build.home}">
<include name="*.jar"/>
</fileset>
</copy>
<copy todir="${stage.bin.dir}/${final.name}/apidocs">
<fileset dir="${build.home}/apidocs" />
</copy>
<!-- Source Distro -->
<mkdir dir="${stage.src.dir}/${final.name}-src"/>
<copy todir="${stage.src.dir}/${final.name}-src">
<fileset dir=".">
<include name="build.xml"/>
<include name="build-check-jdk13.xml"/>
<include name="checkstyle.xml"/>
<include name="LICENSE.txt"/>
<include name="maven.xml"/>
<include name="NOTICE.txt"/>
<include name="pom.xml"/>
<include name="project.properties"/>
<include name="project.xml"/>
<include name="PROPOSAL.html"/>
<include name="RELEASE-NOTES.txt"/>
</fileset>
</copy>
<copy todir="${stage.src.dir}/${final.name}-src/src">
<fileset dir="src" />
</copy>
<copy todir="${stage.src.dir}/${final.name}-src/xdocs">
<fileset dir="xdocs" />
</copy>
<zip zipfile="${dist.home}/${final.name}.zip" basedir="${stage.bin.dir}"/>
<zip zipfile="${dist.home}/${final.name}-src.zip" basedir="${stage.src.dir}"/>
<tar tarfile="${dist.home}/${final.name}.tar" basedir="${stage.bin.dir}" longfile="gnu"/>
<tar tarfile="${dist.home}/${final.name}-src.tar" basedir="${stage.src.dir}" longfile="gnu"/>
<gzip src="${dist.home}/${final.name}.tar" zipfile="${dist.home}/${final.name}.tar.gz"/>
<gzip src="${dist.home}/${final.name}-src.tar" zipfile="${dist.home}/${final.name}-src.tar.gz"/>
<!-- clean up staging directories -->
<delete dir="${stage.bin.dir}"/>
<delete dir="${stage.src.dir}"/>
</target>
<!-- ========== Gump Target ===================================================== -->
<target name="gump" depends="clean,test,javadoc,jar" description="Gump Target - clean,test,javadoc,jar"/>
<!-- ========== Download Dependencies =========================================== -->
<target name="download-dependencies"
depends="check-availability" unless="skip.download">
<echo message="doing download-dependencies..." />
<antcall target="download-junit" />
</target>
<target name="check-availability">
<echo message="doing check-availability..." />
<available file="${junit.jar}" property="junit.found"/>
</target>
<target name="download-junit" unless="junit.found">
<echo message="Downloading junit..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/junit.jar"
usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar"/>
</target>
</project>
|