Ticket #28732: build.xml

File build.xml, 13.5 KB (added by matt@…, 14 years ago)
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2
3<!--build.xml generated by maven from project.xml version 1.2.1
4  on date September 5 2007, time 1015-->
5
6<project default="jar" name="commons-fileupload" basedir=".">
7  <!--Load local and user build preferences-->
8
9  <property file="build.properties">
10  </property>
11  <property file="${user.home}/build.properties">
12  </property>
13  <!--Build properties-->
14
15  <property name="defaulttargetdir" value="${basedir}/target">
16  </property>
17  <property name="libdir" value="${user.home}/.maven/repository">
18  </property>
19  <property name="classesdir" value="${basedir}/target/classes">
20  </property>
21  <property name="testclassesdir" value="${basedir}/target/test-classes">
22  </property>
23  <property name="testreportdir" value="${basedir}/target/test-reports">
24  </property>
25  <property name="distdir" value="${basedir}/dist">
26  </property>
27  <property name="javadocdir" value="${basedir}/dist/docs/api">
28  </property>
29  <property name="final.name" value="commons-fileupload-1.2.1">
30  </property>
31  <property name="proxy.host" value="">
32  </property>
33  <property name="proxy.port" value="">
34  </property>
35  <property name="proxy.username" value="">
36  </property>
37  <property name="proxy.password" value="">
38  </property>
39  <path id="build.classpath">
40    <pathelement location="${libdir}/commons-io/jars/commons-io-1.3.2.jar">
41    </pathelement>
42    <pathelement location="${libdir}/javax.servlet/jars/servlet-api-2.4.jar">
43    </pathelement>
44    <pathelement location="${libdir}/javax.portlet/jars/portlet-api-1.0.jar">
45    </pathelement>
46    <pathelement location="${libdir}/junit/jars/junit-3.8.1.jar">
47    </pathelement>
48    <pathelement location="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar">
49    </pathelement>
50    <pathelement location="${libdir}/maven/plugins/maven-changelog-plugin-1.9.1.jar">
51    </pathelement>
52  </path>
53  <target name="init" description="o Initializes some properties">
54    <mkdir dir="${libdir}">
55    </mkdir>
56    <condition property="noget">
57      <equals arg2="only" arg1="${build.sysclasspath}">
58      </equals>
59    </condition>
60    <!--Test if JUNIT is present in ANT classpath-->
61
62    <available property="Junit.present" classname="junit.framework.Test">
63    </available>
64    <!--Test if user defined a proxy-->
65
66    <condition property="useProxy">
67      <and>
68        <isset property="proxy.host">
69        </isset>
70        <not>
71          <equals trim="true" arg2="" arg1="${proxy.host}">
72          </equals>
73        </not>
74      </and>
75    </condition>
76  </target>
77  <target name="compile" description="o Compile the code" depends="get-deps">
78    <mkdir dir="${classesdir}">
79    </mkdir>
80    <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
81      <src>
82        <pathelement location="${basedir}/src/java">
83        </pathelement>
84      </src>
85      <classpath refid="build.classpath">
86      </classpath>
87    </javac>
88    <mkdir dir="${classesdir}/META-INF">
89    </mkdir>
90    <copy todir="${classesdir}/META-INF">
91      <fileset dir="${basedir}/.">
92        <include name="NOTICE.txt">
93        </include>
94      </fileset>
95    </copy>
96  </target>
97  <target name="jar" description="o Create the jar" depends="compile,test">
98    <jar jarfile="${defaulttargetdir}/${final.name}.jar" excludes="**/package.html" basedir="${classesdir}">
99    </jar>
100  </target>
101  <target name="clean" description="o Clean up the generated directories">
102    <delete dir="${defaulttargetdir}">
103    </delete>
104    <delete dir="${distdir}">
105    </delete>
106  </target>
107  <target name="dist" description="o Create a distribution" depends="jar, javadoc">
108    <mkdir dir="dist">
109    </mkdir>
110    <copy todir="dist">
111      <fileset dir="${defaulttargetdir}" includes="*.jar">
112      </fileset>
113      <fileset dir="${basedir}" includes="LICENSE*, README*">
114      </fileset>
115    </copy>
116  </target>
117  <target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
118    <fail message="There were test failures.">
119    </fail>
120  </target>
121  <target name="internal-test" if="Junit.present" depends="junit-present,compile-tests">
122    <mkdir dir="${testreportdir}">
123    </mkdir>
124    <junit dir="${basedir}" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
125      <sysproperty key="basedir" value=".">
126      </sysproperty>
127      <formatter type="xml">
128      </formatter>
129      <formatter usefile="false" type="plain">
130      </formatter>
131      <classpath>
132        <path refid="build.classpath">
133        </path>
134        <pathelement path="${ant.home}/lib/xml-apis.jar:${ant.home}/lib/xercesImpl.jar"/>
135        <pathelement path="${testclassesdir}">
136        </pathelement>
137        <pathelement path="${classesdir}">
138        </pathelement>
139      </classpath>
140      <batchtest todir="${testreportdir}">
141        <fileset dir="${basedir}/src/test">
142          <include name="**/*Test.java">
143          </include>
144        </fileset>
145      </batchtest>
146    </junit>
147  </target>
148  <target name="junit-present" unless="Junit.present" depends="init">
149    <echo>================================= WARNING ================================</echo>
150    <echo>Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.</echo>
151    <echo>==========================================================================</echo>
152  </target>
153  <target name="compile-tests" if="Junit.present" depends="junit-present,compile">
154    <mkdir dir="${testclassesdir}">
155    </mkdir>
156    <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
157      <src>
158        <pathelement location="${basedir}/src/test">
159        </pathelement>
160      </src>
161      <classpath>
162        <path refid="build.classpath">
163        </path>
164        <pathelement path="${classesdir}">
165        </pathelement>
166      </classpath>
167    </javac>
168    <copy todir="${testclassesdir}">
169      <fileset dir="${basedir}/src/test">
170        <include name="**/*.xml">
171        </include>
172      </fileset>
173    </copy>
174  </target>
175  <target name="javadoc" description="o Generate javadoc" depends="get-deps">
176    <mkdir dir="${javadocdir}">
177    </mkdir>
178    <tstamp>
179      <format pattern="2002-yyyy" property="year">
180      </format>
181    </tstamp>
182    <property name="copyright" value="Copyright &amp;copy;  The Apache Software Foundation. All Rights Reserved.">
183    </property>
184    <property name="title" value="FileUpload 1.2.1 API">
185    </property>
186    <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="${basedir}/src/java" packagenames="org.apache.commons.fileupload.*">
187      <classpath>
188        <path refid="build.classpath">
189        </path>
190      </classpath>
191    </javadoc>
192  </target>
193  <target name="get-dep-commons-io.jar" description="o Download the dependency : commons-io.jar" unless="commons-io.jar" depends="init,setProxy,noProxy,get-custom-dep-commons-io.jar">
194    <mkdir dir="${libdir}/commons-io/jars/">
195    </mkdir>
196    <get dest="${libdir}/commons-io/jars/commons-io-1.3.2.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/commons-io/commons-io/1.3.2/commons-io-1.3.2.jar">
197    </get>
198    <get dest="${libdir}/commons-io/jars/commons-io-1.3.2.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/commons-io/jars/commons-io-1.3.2.jar">
199    </get>
200  </target>
201  <target name="get-custom-dep-commons-io.jar" if="commons-io.jar" depends="init,setProxy,noProxy">
202    <mkdir dir="${libdir}/commons-io/jars/">
203    </mkdir>
204    <get dest="${libdir}/commons-io/jars/commons-io-1.3.2.jar" usetimestamp="true" ignoreerrors="true" src="${commons-io.jar}">
205    </get>
206  </target>
207  <target name="get-dep-servlet-api.jar" description="o Download the dependency : servlet-api.jar" unless="servlet-api.jar" depends="init,setProxy,noProxy,get-custom-dep-servlet-api.jar">
208    <mkdir dir="${libdir}/javax.servlet/jars/">
209    </mkdir>
210    <get dest="${libdir}/javax.servlet/jars/servlet-api-2.4.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar">
211    </get>
212    <get dest="${libdir}/javax.servlet/jars/servlet-api-2.4.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/javax.servlet/jars/servlet-api-2.4.jar">
213    </get>
214  </target>
215  <target name="get-custom-dep-servlet-api.jar" if="servlet-api.jar" depends="init,setProxy,noProxy">
216    <mkdir dir="${libdir}/javax.servlet/jars/">
217    </mkdir>
218    <get dest="${libdir}/javax.servlet/jars/servlet-api-2.4.jar" usetimestamp="true" ignoreerrors="true" src="${servlet-api.jar}">
219    </get>
220  </target>
221  <target name="get-dep-portlet-api.jar" description="o Download the dependency : portlet-api.jar" unless="portlet-api.jar" depends="init,setProxy,noProxy,get-custom-dep-portlet-api.jar">
222    <mkdir dir="${libdir}/javax.portlet/jars/">
223    </mkdir>
224    <get dest="${libdir}/javax.portlet/jars/portlet-api-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/javax/portlet/portlet-api/1.0/portlet-api-1.0.jar">
225    </get>
226    <get dest="${libdir}/javax.portlet/jars/portlet-api-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/javax.portlet/jars/portlet-api-1.0.jar">
227    </get>
228  </target>
229  <target name="get-custom-dep-portlet-api.jar" if="portlet-api.jar" depends="init,setProxy,noProxy">
230    <mkdir dir="${libdir}/javax.portlet/jars/">
231    </mkdir>
232    <get dest="${libdir}/javax.portlet/jars/portlet-api-1.0.jar" usetimestamp="true" ignoreerrors="true" src="${portlet-api.jar}">
233    </get>
234  </target>
235  <target name="get-dep-junit.jar" description="o Download the dependency : junit.jar" unless="junit.jar" depends="init,setProxy,noProxy,get-custom-dep-junit.jar">
236    <mkdir dir="${libdir}/junit/jars/">
237    </mkdir>
238    <get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar">
239    </get>
240    <get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/junit/jars/junit-3.8.1.jar">
241    </get>
242  </target>
243  <target name="get-custom-dep-junit.jar" if="junit.jar" depends="init,setProxy,noProxy">
244    <mkdir dir="${libdir}/junit/jars/">
245    </mkdir>
246    <get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="${junit.jar}">
247    </get>
248  </target>
249  <target name="get-dep-maven-xdoc-plugin.jar" description="o Download the dependency : maven-xdoc-plugin.jar" unless="maven-xdoc-plugin.jar" depends="init,setProxy,noProxy,get-custom-dep-maven-xdoc-plugin.jar">
250    <mkdir dir="${libdir}/maven/plugins/">
251    </mkdir>
252    <get dest="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/maven/maven-xdoc-plugin/1.9.2/maven-xdoc-plugin-1.9.2.jar">
253    </get>
254    <get dest="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/maven/plugins/maven-xdoc-plugin-1.9.2.jar">
255    </get>
256  </target>
257  <target name="get-custom-dep-maven-xdoc-plugin.jar" if="maven-xdoc-plugin.jar" depends="init,setProxy,noProxy">
258    <mkdir dir="${libdir}/maven/plugins/">
259    </mkdir>
260    <get dest="${libdir}/maven/plugins/maven-xdoc-plugin-1.9.2.jar" usetimestamp="true" ignoreerrors="true" src="${maven-xdoc-plugin.jar}">
261    </get>
262  </target>
263  <target name="get-dep-maven-changelog-plugin.jar" description="o Download the dependency : maven-changelog-plugin.jar" unless="maven-changelog-plugin.jar" depends="init,setProxy,noProxy,get-custom-dep-maven-changelog-plugin.jar">
264    <mkdir dir="${libdir}/maven/plugins/">
265    </mkdir>
266    <get dest="${libdir}/maven/plugins/maven-changelog-plugin-1.9.1.jar" usetimestamp="true" ignoreerrors="true" src="http://repo1.maven.org/maven2/maven/maven-changelog-plugin/1.9.1/maven-changelog-plugin-1.9.1.jar">
267    </get>
268    <get dest="${libdir}/maven/plugins/maven-changelog-plugin-1.9.1.jar" usetimestamp="true" ignoreerrors="true" src="http://people.apache.org/repo/m1-snapshot-repository/maven/plugins/maven-changelog-plugin-1.9.1.jar">
269    </get>
270  </target>
271  <target name="get-custom-dep-maven-changelog-plugin.jar" if="maven-changelog-plugin.jar" depends="init,setProxy,noProxy">
272    <mkdir dir="${libdir}/maven/plugins/">
273    </mkdir>
274    <get dest="${libdir}/maven/plugins/maven-changelog-plugin-1.9.1.jar" usetimestamp="true" ignoreerrors="true" src="${maven-changelog-plugin.jar}">
275    </get>
276  </target>
277  <target name="get-deps" unless="noget" depends="get-dep-commons-io.jar,get-dep-servlet-api.jar,get-dep-portlet-api.jar,get-dep-junit.jar,get-dep-maven-xdoc-plugin.jar,get-dep-maven-changelog-plugin.jar">
278  </target>
279  <target name="setProxy" if="useProxy" depends="init">
280    <!--Proxy settings works only with a JDK 1.2 and higher.-->
281
282    <echo>Proxy used :</echo>
283    <echo>Proxy host [${proxy.host}]</echo>
284    <echo>Proxy port [${proxy.port}]</echo>
285    <echo>Proxy user [${proxy.username}]</echo>
286    <setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}" proxyhost="${proxy.host}">
287    </setproxy>
288  </target>
289  <target name="noProxy" unless="useProxy" depends="init">
290    <echo>Proxy not used.</echo>
291  </target>
292  <target name="install-maven">
293    <get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
294    </get>
295    <unjar dest="${maven.home}" src="${user.home}/maven-install-latest.jar">
296    </unjar>
297  </target>
298</project>