| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
<project |
| 19 |
name="ant-contrib" |
| 20 |
default="dist" |
| 21 |
basedir="." |
| 22 |
xmlns:ivy="antlib:org.apache.ivy.ant"> |
| 23 |
|
| 24 |
<property file="build.properties" /> |
| 25 |
|
| 26 |
<property name="root.dir" location="." /> |
| 27 |
<property name="src.dir" location="src/main" /> |
| 28 |
<property name="src.java.dir" location="${src.dir}/java" /> |
| 29 |
<property name="src.resources.dir" location="${src.dir}/resources" /> |
| 30 |
<property name="test.dir" location="test" /> |
| 31 |
<property name="test.src.dir" location="${test.dir}/src" /> |
| 32 |
<property name="test.resources.dir" location="${test.dir}/resources" /> |
| 33 |
<property name="docs.dir" location="docs" /> |
| 34 |
<property name="target.dir" location="target" /> |
| 35 |
<property name="target.classes.dir" location="${target.dir}/classes" /> |
| 36 |
<property name="target.test-classes.dir" location="${target.dir}/test-classes" /> |
| 37 |
<property name="target.docs.dir" location="${target.dir}/docs" /> |
| 38 |
<property name="dist.dir" location="dist" /> |
| 39 |
<property name="target.stage.dir" location="${target.dir}/stage" /> |
| 40 |
|
| 41 |
<property name="m2_repo" location="${user.home}/.m2/repository"/> |
| 42 |
<property name="bcel.version" value="5.1"/> |
| 43 |
<property name="bcel.jar" value="${m2_repo}/bcel/bcel/${bcel.version}/bcel-${bcel.version}.jar"/> |
| 44 |
<property name="httpclient.version" value="3.0.1"/> |
| 45 |
<property name="httpclient.jar" value="${m2_repo}/commons-httpclient/commons-httpclient/${httpclient.version}/commons-httpclient-${httpclient.version}.jar"/> |
| 46 |
<property name="ivy.version" value="2.0.0"/> |
| 47 |
<property name="ivy.jar" value="lib/ivy/jars/ivy-${ivy.version}.jar"/> |
| 48 |
<property name="junit.version" value="3.8.1"/> |
| 49 |
<property name="junit.jar" value="${m2_repo}/junit/junit/${junit.version}/junit-${junit.version}.jar"/> |
| 50 |
<property name="ant.jar.version" value="1.6.5"/> |
| 51 |
<property name="ant.jar" value="${m2_repo}/ant/ant/${ant.jar.version}/ant-${ant.jar.version}.jar"/> |
| 52 |
|
| 53 |
|
| 54 |
<target name="init" unless="no-ivy"> |
| 55 |
<path id="ivy.lib.path"> |
| 56 |
<fileset dir="lib/ivy/jars" includes="ivy-2.0.0.jar"/> |
| 57 |
<fileset dir="lib/commons-cli/jars" includes="commons-cli-1.0.jar"/> |
| 58 |
<fileset dir="lib/commons-codec/jars" includes="commons-codec-1.3.jar"/> |
| 59 |
<fileset dir="lib/commons-httpclient/jars" includes="commons-httpclient-3.0.1.jar"/> |
| 60 |
<fileset dir="lib/commons-logging/jars" includes="commons-logging-1.0.4.jar"/> |
| 61 |
<fileset dir="lib/oro/jars" includes="oro-2.0.8.jar"/> |
| 62 |
</path> |
| 63 |
|
| 64 |
<taskdef resource="org/apache/ivy/ant/antlib.xml" |
| 65 |
uri="antlib:org.apache.ivy.ant" |
| 66 |
classpathref="ivy.lib.path"/> |
| 67 |
</target> |
| 68 |
|
| 69 |
<target name="configure" depends="init" unless="no-ivy"> |
| 70 |
<ivy:configure file="ivysettings.xml" /> |
| 71 |
</target> |
| 72 |
|
| 73 |
<target name="resolve" depends="configure" unless="no-ivy"> |
| 74 |
<ivy:resolve /> |
| 75 |
</target> |
| 76 |
|
| 77 |
<target name="classpath-ivy" depends="resolve" unless="no-ivy"> |
| 78 |
<ivy:cachepath pathid="compile.classpath" type="jar" conf="provided" /> |
| 79 |
<ivy:cachepath pathid="runtime.classpath" type="jar" conf="default" /> |
| 80 |
<ivy:cachepath pathid="test.classpath" type="jar" conf="test" /> |
| 81 |
<ivy:cachefileset setid="compile.fileset" type="jar" conf="provided" /> |
| 82 |
<ivy:cachefileset setid="runtime.fileset" type="jar" conf="default" /> |
| 83 |
<ivy:cachefileset setid="test.fileset" type="jar" conf="test" /> |
| 84 |
</target> |
| 85 |
|
| 86 |
<target name="classpath-no-ivy" if="no-ivy"> |
| 87 |
<path id="compile.classpath"> |
| 88 |
<pathelement location="${bcel.jar}"/> |
| 89 |
<pathelement location="${httpclient.jar}"/> |
| 90 |
<pathelement location="${ivy.jar}"/> |
| 91 |
<pathelement location="${ant.jar}"/> |
| 92 |
</path> |
| 93 |
|
| 94 |
<path id="test.classpath"> |
| 95 |
<path refid="compile.classpath"/> |
| 96 |
<pathelement location="${junit.jar}"/> |
| 97 |
</path> |
| 98 |
|
| 99 |
<fileset id="runtime.fileset" dir="lib"/> |
| 100 |
</target> |
| 101 |
|
| 102 |
<target name="classpath" depends="classpath-ivy, classpath-no-ivy"/> |
| 103 |
|
| 104 |
<target name="compile" depends="classpath"> |
| 105 |
<mkdir dir="${target.classes.dir}" /> |
| 106 |
<javac srcdir="${src.java.dir}" |
| 107 |
destdir="${target.classes.dir}" |
| 108 |
debug="true" |
| 109 |
classpathref="compile.classpath" |
| 110 |
source="${jdk.source}" |
| 111 |
target="${jdk.target}" |
| •112 |
excludes="**/Ivy14Adapter.java" |
| 113 |
/> |
| 114 |
|
| 115 |
<copy todir="${target.classes.dir}"> |
| 116 |
<fileset dir="${src.resources.dir}" |
| 117 |
includes="**/*.properties,**/*.xml" /> |
| 118 |
</copy> |
| 119 |
</target> |
| 120 |
|
| 121 |
<target name="compile-tests" depends="classpath,compile"> |
| 122 |
<mkdir dir="${target.test-classes.dir}" /> |
| 123 |
<javac srcdir="${test.src.dir}" |
| 124 |
destdir="${target.test-classes.dir}" |
| 125 |
debug="true" |
| 126 |
source="${jdk.source}" |
| 127 |
target="${jdk.target}"> |
| 128 |
<classpath> |
| 129 |
<path refid="test.classpath" /> |
| 130 |
<pathelement location="${target.classes.dir}" /> |
| 131 |
</classpath> |
| 132 |
</javac> |
| 133 |
|
| 134 |
<copy todir="${target.test-classes.dir}"> |
| 135 |
<fileset dir="${test.src.dir}" |
| 136 |
includes="**/*.properties,**/*.xml" /> |
| 137 |
<fileset dir="${test.resources.dir}" |
| 138 |
includes="**/*.java,**/*.properties,**/*.xml" |
| 139 |
excludes="**/design/src/**/*" /> |
| 140 |
<fileset dir="${test.resources.dir}/design/src" |
| 141 |
includes="**/design/src/**/*" /> |
| 142 |
</copy> |
| 143 |
</target> |
| 144 |
|
| 145 |
<target name="jar" depends="compile"> |
| 146 |
<mkdir dir="${target.dir}" /> |
| 147 |
<tstamp> |
| 148 |
<format property="tstamp" pattern="dd/MM/yyyy HH:mm:ss" /> |
| 149 |
</tstamp> |
| 150 |
<jar file="${target.dir}/${jar.name}"> |
| 151 |
<manifest> |
| 152 |
<attribute name="Version" value="${project.version}"/> |
| 153 |
<attribute name="Build-Timestamp" value="${tstamp}"/> |
| 154 |
</manifest> |
| 155 |
<fileset dir="${target.classes.dir}" /> |
| 156 |
</jar> |
| 157 |
</target> |
| 158 |
|
| 159 |
<target name="clean"> |
| •160 |
<mkdir dir="${target.dir}" /> |
| 161 |
<mkdir dir="${dist.dir}" /> |
| 162 |
<delete includeemptydirs="true"> |
| 163 |
<fileset dir="${target.dir}" includes="**/*" /> |
| 164 |
<fileset dir="${dist.dir}" includes="**/*" /> |
| 165 |
</delete> |
| 166 |
</target> |
| 167 |
|
| 168 |
<target name="javadoc" depends="classpath"> |
| 169 |
<javadoc sourcepath="${src.java.dir}" |
| 170 |
destdir="${target.docs.dir}/api" |
| 171 |
packagenames="net.sf.antcontrib.*" |
| 172 |
author="true" |
| 173 |
version="true" |
| 174 |
windowtitle="Ant Contrib" |
| 175 |
classpathref="compile.classpath"> |
| 176 |
<tag name="ant.task" enabled="false" description="Task:" scope="types"/> |
| 177 |
<tag name="ant.datatype" enabled="false" |
| 178 |
description="Data type:" scope="types"/> |
| 179 |
<tag name="ant.attribute" enabled="false" |
| 180 |
description="Attribute:" scope="types"/> |
| 181 |
<tag name="ant.attribute.group" enabled="false" |
| 182 |
description="Attribute group:" scope="types"/> |
| 183 |
<tag name="ant.element" enabled="false" |
| 184 |
description="Nested element:" scope="types"/> |
| 185 |
</javadoc> |
| 186 |
</target> |
| 187 |
|
| 188 |
<target name="docs" depends="javadoc"> |
| 189 |
<mkdir dir="${target.docs.dir}" /> |
| 190 |
<copy todir="${target.docs.dir}"> |
| 191 |
<fileset dir="${docs.dir}" includes="**/*" /> |
| 192 |
</copy> |
| 193 |
</target> |
| 194 |
|
| 195 |
<target name="dist-stage" depends="jar,docs"> |
| 196 |
<mkdir dir="${target.stage.dir}" /> |
| 197 |
<mkdir dir="${target.stage.dir}/lib" /> |
| 198 |
|
| 199 |
<copy file="${target.dir}/${jar.name}" |
| 200 |
tofile="${target.stage.dir}/${jar.name.versioned}" /> |
| 201 |
|
| 202 |
<copy todir="${target.stage.dir}"> |
| 203 |
<fileset dir="${root.dir}" includes="README.txt" /> |
| 204 |
<fileset dir="${target.dir}" includes="docs/**/*" /> |
| 205 |
</copy> |
| 206 |
<copy todir="${target.stage.dir}/lib" flatten="true"> |
| 207 |
<fileset refid="runtime.fileset" /> |
| 208 |
</copy> |
| 209 |
</target> |
| 210 |
|
| 211 |
<target name="zip" depends="dist-stage"> |
| 212 |
<mkdir dir="${dist.dir}" /> |
| 213 |
<zip file="${dist.dir}/${project.name}-${project.version}-bin.zip"> |
| 214 |
<zipfileset prefix="ant-contrib" dir="${target.stage.dir}" |
| 215 |
includes="**/*" /> |
| 216 |
</zip> |
| 217 |
|
| 218 |
<zip file="${dist.dir}/${project.name}-${project.version}-src.zip"> |
| 219 |
<zipfileset prefix="ant-contrib" |
| 220 |
dir="${root.dir}" |
| 221 |
includes="**/*" |
| 222 |
excludes="target,target/**/*,dist,dist/**/*" /> |
| 223 |
</zip> |
| 224 |
</target> |
| 225 |
|
| 226 |
<target name="tar.gz" depends="dist-stage"> |
| 227 |
<mkdir dir="${dist.dir}" /> |
| 228 |
|
| 229 |
<tar destfile="${dist.dir}/${project.name}-${project.version}-bin.tar.gz" |
| 230 |
compression="gzip"> |
| 231 |
<tarfileset prefix="ant-contrib" |
| 232 |
dir="${target.stage.dir}" |
| 233 |
includes="**/*" /> |
| 234 |
</tar> |
| 235 |
|
| 236 |
<tar destfile="${dist.dir}/${project.name}-${project.version}-bin.tar.bz2" |
| 237 |
compression="bzip2"> |
| 238 |
<tarfileset prefix="ant-contrib" |
| 239 |
dir="${target.stage.dir}" |
| 240 |
includes="**/*" /> |
| 241 |
</tar> |
| 242 |
|
| 243 |
<tar destfile="${dist.dir}/${project.name}-${project.version}-src.tar.gz" |
| 244 |
compression="gzip"> |
| 245 |
<tarfileset prefix="ant-contrib" |
| 246 |
dir="${root.dir}" |
| 247 |
includes="**/*" |
| 248 |
excludes="target,target/**/*,dist,dist/**/*" /> |
| 249 |
</tar> |
| 250 |
|
| 251 |
<tar destfile="${dist.dir}/${project.name}-${project.version}-src.tar.bz2" |
| 252 |
compression="bzip2"> |
| 253 |
<tarfileset prefix="ant-contrib" |
| 254 |
dir="${root.dir}" |
| 255 |
includes="**/*" |
| 256 |
excludes="target,target/**/*,dist,dist/**/*" /> |
| 257 |
</tar> |
| 258 |
|
| 259 |
</target> |
| 260 |
|
| 261 |
<target name="package" depends="tar.gz,zip"> |
| 262 |
<checksum fileext=".md5"> |
| 263 |
<fileset dir="${dist.dir}"> |
| 264 |
<include name="*.zip"/> |
| 265 |
<include name="*.tar.bz2"/> |
| 266 |
<include name="*.tar.gz"/> |
| 267 |
</fileset> |
| 268 |
</checksum> |
| 269 |
</target> |
| 270 |
|
| 271 |
<target name="dist" depends="package"> |
| 272 |
</target> |
| 273 |
|
| 274 |
<target name="run-test" depends="compile-tests, jar"> |
| 275 |
<property name="lib.dir" location="lib" /> |
| 276 |
<pathconvert pathsep="${path.separator}" |
| 277 |
dirsep="/" |
| 278 |
property="tpath"> |
| 279 |
<path refid="test.classpath" /> |
| 280 |
</pathconvert> |
| 281 |
|
| •282 |
<junit fork="true" haltonfailure="false" haltonerror="false" |
| 283 |
errorproperty="junit.error" failureproperty="junit.failure"> |
| 284 |
<formatter type="brief" usefile="false"/> |
| 285 |
<batchtest> |
| 286 |
<fileset dir="${target.test-classes.dir}" excludes="${skip-tests}"> |
| 287 |
<exclude name="**/antclipse/**" unless="eclipse.present"/> |
| 288 |
<exclude name="walls/**"/> |
| •289 |
<exclude name="**/design/**"/> |
| 290 |
</fileset> |
| 291 |
</batchtest> |
| 292 |
<sysproperty key="antcontrib.jar" file="${target.dir}/${jar.name}"/> |
| 293 |
<sysproperty key="test.classpath" value="${tpath}"/> |
| 294 |
<classpath> |
| 295 |
<path refid="test.classpath" /> |
| 296 |
<pathelement location="${target.classes.dir}" /> |
| 297 |
<pathelement location="${target.test-classes.dir}" /> |
| 298 |
</classpath> |
| 299 |
</junit> |
| 300 |
|
| 301 |
<fail message="JUnit error (${junit.error}) encountered." if="junit.error" /> |
| 302 |
<fail message="JUnit failure (${junit.failure}) encountered." if="junit.failure" /> |
| 303 |
</target> |
| 304 |
|
| 305 |
<target name="test-all" depends="compile-tests"> |
| 306 |
<antcall target="run-test"> |
| 307 |
<param name="skip-tests" value="**/BuildFileTestBase.class"/> |
| 308 |
</antcall> |
| 309 |
</target> |
| 310 |
|
| 311 |
|
| 312 |
<target name="gump-safe-test" depends="compile-tests"> |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
<antcall target="run-test"> |
| 317 |
<param name="skip-tests" value="**/AntServerTest.class **/BuildFileTest*.class"/> |
| 318 |
</antcall> |
| 319 |
</target> |
| 320 |
|
| 321 |
<target name="test" depends="gump-safe-test"/> |
| 322 |
|
| 323 |
</project> |