~ubuntu-branches/ubuntu/quantal/commons-io/quantal

« back to all changes in this revision

Viewing changes to build.xml

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2008-02-21 13:26:43 UTC
  • mfrom: (1.1.3 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080221132643-p4c8f8lhb9rnqnlo
Tags: 1.4-1
* New upstream release
* Bump Standards-Version to 3.7.3
* Bump up debhelper compat to 6
* Replace XS-Vcs headers with Vcs
* debian/patches:
  - remove 01_no_ext_links.dpatch - not required
  - remove 02_no_mkdir_in_homedir.dpatch - not required
* Remove dpatch from Build-Depends
* Update debian/rules and debian/libcommons-io-java-doc.install
  with new target dirs
* debian/copyright: add copyright notice

Show diffs side-by-side

added added

removed removed

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