|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 |
|
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--> |
5 | 5 |
|
6 | 6 | <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"> |
8 | 18 | </property> |
9 | | - <property name="libdir" value="${defaulttargetdir}/lib"> |
| 19 | + <property name="classesdir" value="${basedir}/target/classes"> |
10 | 20 | </property> |
11 | | - <property name="classesdir" value="${defaulttargetdir}/classes"> |
| 21 | + <property name="testclassesdir" value="${basedir}/target/test-classes"> |
12 | 22 | </property> |
13 | | - <property name="testclassesdir" value="${defaulttargetdir}/test-classes"> |
| 23 | + <property name="testreportdir" value="${basedir}/target/test-reports"> |
14 | 24 | </property> |
15 | | - <property name="testclassesdir" value="${defaulttargetdir}/test-classes"> |
| 25 | + <property name="distdir" value="${basedir}/dist"> |
16 | 26 | </property> |
17 | | - <property name="testreportdir" value="${defaulttargetdir}/test-reports"> |
| 27 | + <property name="javadocdir" value="${basedir}/dist/docs/api"> |
18 | 28 | </property> |
19 | | - <property name="distdir" value="dist"> |
| 29 | + <property name="final.name" value="commons-cli-2.0-SNAPSHOT"> |
20 | 30 | </property> |
21 | | - <property name="javadocdir" value="dist/docs/api"> |
| 31 | + <property name="proxy.host" value=""> |
22 | 32 | </property> |
23 | | - <property name="final.name" value="commons-cli-2.0"> |
| 33 | + <property name="proxy.port" value=""> |
24 | 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-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> |
25 | 47 | <target name="init" description="o Initializes some properties"> |
26 | 48 | <mkdir dir="${libdir}"> |
27 | 49 | </mkdir> |
28 | 50 | <condition property="noget"> |
29 | 51 | <equals arg2="only" arg1="${build.sysclasspath}"> |
30 | 52 | </equals> |
31 | 53 | </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> |
32 | 70 | </target> |
33 | 71 | <target name="compile" description="o Compile the code" depends="get-deps"> |
34 | 72 | <mkdir dir="${classesdir}"> |
35 | 73 | </mkdir> |
36 | 74 | <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html"> |
37 | 75 | <src> |
38 | | - <pathelement location="src/java"> |
| 76 | + <pathelement location="${basedir}/src/java"> |
39 | 77 | </pathelement> |
40 | 78 | </src> |
41 | | - <classpath> |
42 | | - <fileset dir="${libdir}"> |
43 | | - <include name="*.jar"> |
44 | | - </include> |
45 | | - </fileset> |
| 79 | + <classpath refid="build.classpath"> |
46 | 80 | </classpath> |
47 | 81 | </javac> |
48 | 82 | <mkdir dir="${classesdir}/org/apache/commons/cli2"> |
49 | 83 | </mkdir> |
50 | 84 | <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"> |
52 | 86 | <include name="**/*.properties"> |
53 | 87 | </include> |
54 | 88 | </fileset> |
|
78 | 112 | <fail message="There were test failures."> |
79 | 113 | </fail> |
80 | 114 | </target> |
81 | | - <target name="internal-test" depends="compile-tests"> |
| 115 | + <target name="internal-test" if="Junit.present" depends="junit-present,compile-tests"> |
82 | 116 | <mkdir dir="${testreportdir}"> |
83 | 117 | </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"> |
85 | 119 | <sysproperty key="basedir" value="."> |
86 | 120 | </sysproperty> |
87 | 121 | <formatter type="xml"> |
88 | 122 | </formatter> |
89 | 123 | <formatter usefile="false" type="plain"> |
90 | 124 | </formatter> |
91 | 125 | <classpath> |
92 | | - <fileset dir="${libdir}"> |
93 | | - <include name="*.jar"> |
94 | | - </include> |
95 | | - </fileset> |
| 126 | + <path refid="build.classpath"> |
| 127 | + </path> |
96 | 128 | <pathelement path="${testclassesdir}"> |
97 | 129 | </pathelement> |
98 | 130 | <pathelement path="${classesdir}"> |
99 | 131 | </pathelement> |
100 | 132 | </classpath> |
101 | 133 | <batchtest todir="${testreportdir}"> |
102 | | - <fileset dir="src/test"> |
| 134 | + <fileset dir="${basedir}/src/test"> |
103 | 135 | <include name="**/Test*.java"> |
104 | 136 | </include> |
105 | 137 | <include name="**/*Test.java"> |
|
108 | 140 | </batchtest> |
109 | 141 | </junit> |
110 | 142 | </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"> |
112 | 149 | <mkdir dir="${testclassesdir}"> |
113 | 150 | </mkdir> |
114 | 151 | <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html"> |
115 | 152 | <src> |
116 | | - <pathelement location="src/test"> |
| 153 | + <pathelement location="${basedir}/src/test"> |
117 | 154 | </pathelement> |
118 | 155 | </src> |
119 | 156 | <classpath> |
120 | | - <fileset dir="${libdir}"> |
121 | | - <include name="*.jar"> |
122 | | - </include> |
123 | | - </fileset> |
| 157 | + <path refid="build.classpath"> |
| 158 | + </path> |
124 | 159 | <pathelement path="${classesdir}"> |
125 | 160 | </pathelement> |
126 | 161 | </classpath> |
127 | 162 | </javac> |
128 | 163 | </target> |
129 | | - <target name="javadoc" description="o Generate javadoc"> |
| 164 | + <target name="javadoc" description="o Generate javadoc" depends="get-deps"> |
130 | 165 | <mkdir dir="${javadocdir}"> |
131 | 166 | </mkdir> |
132 | 167 | <tstamp> |
|
135 | 170 | </tstamp> |
136 | 171 | <property name="copyright" value="Copyright &copy; Apache Software Foundation. All Rights Reserved."> |
137 | 172 | </property> |
138 | | - <property name="title" value="CLI 2.0 API"> |
| 173 | + <property name="title" value="CLI 2.0-SNAPSHOT API"> |
139 | 174 | </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.*"> |
141 | 176 | <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> |
148 | 179 | </classpath> |
149 | 180 | </javadoc> |
150 | 181 | </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"> |
153 | 186 | </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}"> |
155 | 192 | </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"> |
157 | 198 | </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}"> |
159 | 204 | </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"> |
161 | 210 | </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}"> |
163 | 216 | </get> |
164 | 217 | </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> |
165 | 233 | <target name="install-maven"> |
166 | 234 | <get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar"> |
167 | 235 | </get> |
|
0 commit comments