Skip to content

Commit a0343ea

Browse files
committed
Updating the build file
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@382955 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5743200 commit a0343ea

1 file changed

Lines changed: 115 additions & 47 deletions

File tree

build.xml

Lines changed: 115 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,88 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!--build.xml generated by maven from project.xml version 2.0
4-
on date August 18 2004, time 1029-->
3+
<!--build.xml generated by maven from project.xml version 2.0-SNAPSHOT
4+
on date March 3 2006, time 1447-->
55

66
<project default="jar" name="commons-cli" basedir=".">
7-
<property name="defaulttargetdir" value="target">
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">
818
</property>
9-
<property name="libdir" value="${defaulttargetdir}/lib">
19+
<property name="classesdir" value="${basedir}/target/classes">
1020
</property>
11-
<property name="classesdir" value="${defaulttargetdir}/classes">
21+
<property name="testclassesdir" value="${basedir}/target/test-classes">
1222
</property>
13-
<property name="testclassesdir" value="${defaulttargetdir}/test-classes">
23+
<property name="testreportdir" value="${basedir}/target/test-reports">
1424
</property>
15-
<property name="testclassesdir" value="${defaulttargetdir}/test-classes">
25+
<property name="distdir" value="${basedir}/dist">
1626
</property>
17-
<property name="testreportdir" value="${defaulttargetdir}/test-reports">
27+
<property name="javadocdir" value="${basedir}/dist/docs/api">
1828
</property>
19-
<property name="distdir" value="dist">
29+
<property name="final.name" value="commons-cli-2.0-SNAPSHOT">
2030
</property>
21-
<property name="javadocdir" value="dist/docs/api">
31+
<property name="proxy.host" value="">
2232
</property>
23-
<property name="final.name" value="commons-cli-2.0">
33+
<property name="proxy.port" value="">
2434
</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-lang/jars/commons-lang-2.1.jar">
41+
</pathelement>
42+
<pathelement location="${libdir}/junit/jars/junit-3.8.1.jar">
43+
</pathelement>
44+
<pathelement location="${libdir}/jdepend/jars/jdepend-2.5.jar">
45+
</pathelement>
46+
</path>
2547
<target name="init" description="o Initializes some properties">
2648
<mkdir dir="${libdir}">
2749
</mkdir>
2850
<condition property="noget">
2951
<equals arg2="only" arg1="${build.sysclasspath}">
3052
</equals>
3153
</condition>
54+
<!--Test if JUNIT is present in ANT classpath-->
55+
56+
<available property="Junit.present" classname="junit.framework.Test">
57+
</available>
58+
<!--Test if user defined a proxy-->
59+
60+
<condition property="useProxy">
61+
<and>
62+
<isset property="proxy.host">
63+
</isset>
64+
<not>
65+
<equals trim="true" arg2="" arg1="${proxy.host}">
66+
</equals>
67+
</not>
68+
</and>
69+
</condition>
3270
</target>
3371
<target name="compile" description="o Compile the code" depends="get-deps">
3472
<mkdir dir="${classesdir}">
3573
</mkdir>
3674
<javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
3775
<src>
38-
<pathelement location="src/java">
76+
<pathelement location="${basedir}/src/java">
3977
</pathelement>
4078
</src>
41-
<classpath>
42-
<fileset dir="${libdir}">
43-
<include name="*.jar">
44-
</include>
45-
</fileset>
79+
<classpath refid="build.classpath">
4680
</classpath>
4781
</javac>
4882
<mkdir dir="${classesdir}/org/apache/commons/cli2">
4983
</mkdir>
5084
<copy todir="${classesdir}/org/apache/commons/cli2">
51-
<fileset dir="src/java/org/apache/commons/cli2">
85+
<fileset dir="${basedir}/src/java/org/apache/commons/cli2">
5286
<include name="**/*.properties">
5387
</include>
5488
</fileset>
@@ -78,28 +112,26 @@
78112
<fail message="There were test failures.">
79113
</fail>
80114
</target>
81-
<target name="internal-test" depends="compile-tests">
115+
<target name="internal-test" if="Junit.present" depends="junit-present,compile-tests">
82116
<mkdir dir="${testreportdir}">
83117
</mkdir>
84-
<junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
118+
<junit dir="${basedir}" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
85119
<sysproperty key="basedir" value=".">
86120
</sysproperty>
87121
<formatter type="xml">
88122
</formatter>
89123
<formatter usefile="false" type="plain">
90124
</formatter>
91125
<classpath>
92-
<fileset dir="${libdir}">
93-
<include name="*.jar">
94-
</include>
95-
</fileset>
126+
<path refid="build.classpath">
127+
</path>
96128
<pathelement path="${testclassesdir}">
97129
</pathelement>
98130
<pathelement path="${classesdir}">
99131
</pathelement>
100132
</classpath>
101133
<batchtest todir="${testreportdir}">
102-
<fileset dir="src/test">
134+
<fileset dir="${basedir}/src/test">
103135
<include name="**/Test*.java">
104136
</include>
105137
<include name="**/*Test.java">
@@ -108,25 +140,28 @@
108140
</batchtest>
109141
</junit>
110142
</target>
111-
<target name="compile-tests" depends="compile">
143+
<target name="junit-present" unless="Junit.present" depends="init">
144+
<echo>================================= WARNING ================================</echo>
145+
<echo>Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.</echo>
146+
<echo>==========================================================================</echo>
147+
</target>
148+
<target name="compile-tests" if="Junit.present" depends="junit-present,compile">
112149
<mkdir dir="${testclassesdir}">
113150
</mkdir>
114151
<javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
115152
<src>
116-
<pathelement location="src/test">
153+
<pathelement location="${basedir}/src/test">
117154
</pathelement>
118155
</src>
119156
<classpath>
120-
<fileset dir="${libdir}">
121-
<include name="*.jar">
122-
</include>
123-
</fileset>
157+
<path refid="build.classpath">
158+
</path>
124159
<pathelement path="${classesdir}">
125160
</pathelement>
126161
</classpath>
127162
</javac>
128163
</target>
129-
<target name="javadoc" description="o Generate javadoc">
164+
<target name="javadoc" description="o Generate javadoc" depends="get-deps">
130165
<mkdir dir="${javadocdir}">
131166
</mkdir>
132167
<tstamp>
@@ -135,33 +170,66 @@
135170
</tstamp>
136171
<property name="copyright" value="Copyright &amp;copy; Apache Software Foundation. All Rights Reserved.">
137172
</property>
138-
<property name="title" value="CLI 2.0 API">
173+
<property name="title" value="CLI 2.0-SNAPSHOT API">
139174
</property>
140-
<javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="src/java" packagenames="org.apache.commons.cli.*">
175+
<javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true" sourcepath="${basedir}/src/java" packagenames="org.apache.commons.*">
141176
<classpath>
142-
<fileset dir="${libdir}">
143-
<include name="*.jar">
144-
</include>
145-
</fileset>
146-
<pathelement location="${defaulttargetdir}/${final.name}.jar">
147-
</pathelement>
177+
<path refid="build.classpath">
178+
</path>
148179
</classpath>
149180
</javadoc>
150181
</target>
151-
<target name="get-deps" unless="noget" depends="init">
152-
<get dest="${libdir}/commons-lang-1.0.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-1.0.jar">
182+
<target name="get-dep-commons-lang.jar" description="o Download the dependency : commons-lang.jar" unless="commons-lang.jar" depends="init,setProxy,noProxy,get-custom-dep-commons-lang.jar">
183+
<mkdir dir="${libdir}/commons-lang/jars/">
184+
</mkdir>
185+
<get dest="${libdir}/commons-lang/jars/commons-lang-2.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.1.jar">
153186
</get>
154-
<get dest="${libdir}/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar">
187+
</target>
188+
<target name="get-custom-dep-commons-lang.jar" if="commons-lang.jar" depends="init,setProxy,noProxy">
189+
<mkdir dir="${libdir}/commons-lang/jars/">
190+
</mkdir>
191+
<get dest="${libdir}/commons-lang/jars/commons-lang-2.1.jar" usetimestamp="true" ignoreerrors="true" src="${commons-lang.jar}">
155192
</get>
156-
<get dest="${libdir}/jdepend-2.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/jdepend/jars/jdepend-2.5.jar">
193+
</target>
194+
<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">
195+
<mkdir dir="${libdir}/junit/jars/">
196+
</mkdir>
197+
<get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar">
157198
</get>
158-
<get dest="${libdir}/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/junit/jars/junit-3.8.1.jar">
199+
</target>
200+
<target name="get-custom-dep-junit.jar" if="junit.jar" depends="init,setProxy,noProxy">
201+
<mkdir dir="${libdir}/junit/jars/">
202+
</mkdir>
203+
<get dest="${libdir}/junit/jars/junit-3.8.1.jar" usetimestamp="true" ignoreerrors="true" src="${junit.jar}">
159204
</get>
160-
<get dest="${libdir}/ant-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar">
205+
</target>
206+
<target name="get-dep-jdepend.jar" description="o Download the dependency : jdepend.jar" unless="jdepend.jar" depends="init,setProxy,noProxy,get-custom-dep-jdepend.jar">
207+
<mkdir dir="${libdir}/jdepend/jars/">
208+
</mkdir>
209+
<get dest="${libdir}/jdepend/jars/jdepend-2.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/jdepend/jars/jdepend-2.5.jar">
161210
</get>
162-
<get dest="${libdir}/ant-optional-1.5.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/ant/jars/ant-optional-1.5.jar">
211+
</target>
212+
<target name="get-custom-dep-jdepend.jar" if="jdepend.jar" depends="init,setProxy,noProxy">
213+
<mkdir dir="${libdir}/jdepend/jars/">
214+
</mkdir>
215+
<get dest="${libdir}/jdepend/jars/jdepend-2.5.jar" usetimestamp="true" ignoreerrors="true" src="${jdepend.jar}">
163216
</get>
164217
</target>
218+
<target name="get-deps" unless="noget" depends="get-dep-commons-lang.jar,get-dep-junit.jar,get-dep-jdepend.jar">
219+
</target>
220+
<target name="setProxy" if="useProxy" depends="init">
221+
<!--Proxy settings works only with a JDK 1.2 and higher.-->
222+
223+
<echo>Proxy used :</echo>
224+
<echo>Proxy host [${proxy.host}]</echo>
225+
<echo>Proxy port [${proxy.port}]</echo>
226+
<echo>Proxy user [${proxy.username}]</echo>
227+
<setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}" proxyhost="${proxy.host}">
228+
</setproxy>
229+
</target>
230+
<target name="noProxy" unless="useProxy" depends="init">
231+
<echo>Proxy not used.</echo>
232+
</target>
165233
<target name="install-maven">
166234
<get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">
167235
</get>

0 commit comments

Comments
 (0)