You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 28 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <?xml version="1.0"?>
  2. <!--
  3. =======================================================================
  4. Ant own build file
  5. =======================================================================
  6. -->
  7. <project name="Ant" default="main" basedir=".">
  8. <!-- Give user a chance to override without editing this file
  9. (and without typing -D each time it compiles it) -->
  10. <property file=".ant.properties" />
  11. <property file="${user.home}/.ant.properties" />
  12. <property name="Name" value="Ant"/>
  13. <property name="name" value="ant"/>
  14. <property name="version" value="1.4alpha"/>
  15. <property name="debug" value="false" />
  16. <property name="deprecation" value="false" />
  17. <property name="optimize" value="true" />
  18. <property name="junit.fork" value="false" />
  19. <!--
  20. ===================================================================
  21. Set the properties related to the source tree
  22. ===================================================================
  23. -->
  24. <property name="src.dir" value="src"/>
  25. <property name="java.dir" value="${src.dir}/main"/>
  26. <property name="script.dir" value="${src.dir}/script"/>
  27. <property name="lib.dir" value="lib"/>
  28. <property name="docs.dir" value="docs"/>
  29. <property name="tests.dir" value="src/testcases"/>
  30. <property name="tests.etc.dir" value="src/etc/testcases"/>
  31. <property name="ant.package" value="org/apache/tools/ant"/>
  32. <property name="optional.package" value="${ant.package}/taskdefs/optional"/>
  33. <property name="manifest" value="src/etc/manifest"/>
  34. <!--
  35. ===================================================================
  36. Set the properties for the build area
  37. ===================================================================
  38. -->
  39. <property name="build.dir" value="build"/>
  40. <property name="bootstrap.dir" value="bootstrap"/>
  41. <property name="build.classes" value="${build.dir}/classes"/>
  42. <property name="build.lib" value="${build.dir}/lib"/>
  43. <property name="build.javadocs" value="${build.dir}/javadocs"/>
  44. <property name="build.tests" value="${build.dir}/testcases"/>
  45. <path id="classpath">
  46. </path>
  47. <path id="tests-classpath">
  48. <pathelement location="${build.classes}" />
  49. <pathelement location="${build.tests}" />
  50. <path refid="classpath" />
  51. </path>
  52. <!--
  53. ===================================================================
  54. Set up properties for the distribution area
  55. ===================================================================
  56. -->
  57. <property name="dist.name" value="jakarta-${name}-${version}"/>
  58. <property name="dist.base" value="distribution"/>
  59. <property name="defaultdist.dir" value="dist"/>
  60. <target name="setup-distproperties">
  61. <property name="dist.dir" value="${defaultdist.dir}"/>
  62. <property name="dist.bin" value="${dist.dir}/bin"/>
  63. <property name="dist.lib" value="${dist.dir}/lib"/>
  64. <property name="dist.docs" value="${dist.dir}/docs"/>
  65. <property name="dist.javadocs" value="${dist.dir}/docs/manual/api"/>
  66. <property name="src.dist.dir" value="dist-src"/>
  67. <property name="src.dist.src" value="${src.dist.dir}/src"/>
  68. <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
  69. <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
  70. </target>
  71. <!--
  72. ===================================================================
  73. Check to see what optional dependencies are available
  74. ===================================================================
  75. -->
  76. <target name="check_for_optional_packages_1">
  77. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  78. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  79. <available property="jdk1.4+" classname="java.lang.CharSequence" />
  80. <available property="bsf.present"
  81. classname="com.ibm.bsf.BSFManager"
  82. classpathref="classpath" />
  83. <available property="netrexx.present"
  84. classname="netrexx.lang.Rexx"
  85. classpathref="classpath" />
  86. <available property="xslp.present"
  87. classname="com.kvisco.xsl.XSLProcessor"
  88. classpathref="classpath" />
  89. <available property="xalan.present"
  90. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  91. classpathref="classpath" />
  92. <available property="ejb.ejbc.present"
  93. classname="weblogic.ejbc"
  94. classpathref="classpath" />
  95. <available property="ejb.DDCreator.present"
  96. classname="weblogic.ejb.utils.DDCreator"
  97. classpathref="classpath" />
  98. <available property="ejb.wls.present"
  99. classname="weblogic.Server"
  100. classpathref="classpath" />
  101. <available property="junit.present"
  102. classname="junit.framework.TestCase"
  103. classpathref="classpath" />
  104. <available property="netcomp.present"
  105. classname="com.oroinc.net.ftp.FTPClient"
  106. classpathref="classpath" />
  107. <available property="starteam.present"
  108. classname="com.starbase.util.Platform"
  109. classpathref="classpath" />
  110. <available property="antlr.present"
  111. classname="antlr.Tool"
  112. classpathref="classpath"/>
  113. <available property="vaj.present"
  114. classname="com.ibm.ivj.util.base.Workspace"
  115. classpathref="classpath"/>
  116. <available property="stylebook.present"
  117. classname="org.apache.stylebook.Engine"
  118. classpathref="classpath"/>
  119. <available property="jakarta.regexp.present"
  120. classname="org.apache.regexp.RE"
  121. classpathref="classpath"/>
  122. <available property="jakarta.oro.present"
  123. classname="org.apache.oro.text.regex.Perl5Matcher"
  124. classpathref="classpath" />
  125. <available property="jmf.present"
  126. classname="javax.sound.sampled.Clip"
  127. classpathref="classpath"/>
  128. <available property="icontract.present"
  129. classname="com.reliablesystems.iContract.IContracted"
  130. classpathref="classpath"/>
  131. <available property="jdepend.present"
  132. classname="jdepend.framework.JDepend"
  133. classpathref="classpath"/>
  134. <available property="jaf.present"
  135. classname="javax.activation.DataHandler"
  136. classpathref="classpath"/>
  137. </target>
  138. <target name="check_for_optional_packages"
  139. depends="check_for_optional_packages_1"
  140. if="jaf.present">
  141. <available property="javamail.complete"
  142. classname="javax.mail.Transport"
  143. classpathref="classpath"/>
  144. </target>
  145. <!--
  146. ===================================================================
  147. Prepare the build
  148. ===================================================================
  149. -->
  150. <target name="prepare">
  151. <tstamp>
  152. <format property="year" pattern="yyyy" />
  153. </tstamp>
  154. </target>
  155. <!--
  156. ===================================================================
  157. Build the code
  158. ===================================================================
  159. -->
  160. <target name="build"
  161. depends="prepare, check_for_optional_packages"
  162. description="--> compiles the source code">
  163. <mkdir dir="${build.dir}"/>
  164. <mkdir dir="${build.classes}"/>
  165. <mkdir dir="${build.lib}"/>
  166. <javac srcdir="${java.dir}"
  167. destdir="${build.classes}"
  168. debug="${debug}"
  169. deprecation="${deprecation}"
  170. optimize="${optimize}" >
  171. <classpath refid="classpath" />
  172. <exclude name="${ant.package}/util/regexp/JakartaRegexpMatcher.java"
  173. unless="jakarta.regexp.present" />
  174. <exclude name="${ant.package}/util/regexp/JakartaOroMatcher.java"
  175. unless="jakarta.oro.present" />
  176. <exclude name="${ant.package}/util/regexp/Jdk14RegexpMatcher.java"
  177. unless="jdk1.4+" />
  178. <exclude name="${optional.package}/IContract.java" unless="icontract.present" />
  179. <exclude name="${optional.package}/Script.java" unless="bsf.present" />
  180. <exclude name="${optional.package}/StyleBook.java" unless="stylebook.present" />
  181. <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" />
  182. <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" />
  183. <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" />
  184. <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" />
  185. <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" />
  186. <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" />
  187. <exclude name="${optional.package}/ejb/WLStop.java" unless="ejb.wls.present" />
  188. <exclude name="${optional.package}/ejb/EjbJar.java" unless="jdk1.2+" />
  189. <exclude name="${optional.package}/ejb/*DeploymentTool.java" unless="jdk1.2+" />
  190. <exclude name="${optional.package}/ejb/IPlanet*.java" unless="jdk1.2+" />
  191. <exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
  192. <exclude name="${optional.package}/junit/*" unless="junit.present" />
  193. <exclude name="${optional.package}/net/MimeMail.java" unless="javamail.complete" />
  194. <exclude name="${optional.package}/net/FTP.java" unless="netcomp.present" />
  195. <exclude name="${optional.package}/net/TelnetTask.java" unless="netcomp.present" />
  196. <exclude name="${optional.package}/scm/AntStarTeam*.java" unless="starteam.present" />
  197. <exclude name="${optional.package}/ANTLR.java" unless="antlr.present" />
  198. <exclude name="${optional.package}/ide/VAJ*.java" unless="vaj.present" />
  199. <exclude name="${optional.package}/perforce/*.java" unless="jakarta.oro.present" />
  200. <exclude name="${optional.package}/sound/*.java" unless="jmf.present" />
  201. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  202. unless="xalan.present" />
  203. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  204. unless="xalan.present" />
  205. <exclude name="${optional.package}/jdepend/*" unless="jdepend.present" />
  206. </javac>
  207. <copy todir="${build.classes}">
  208. <fileset dir="${java.dir}">
  209. <include name="**/*.properties" />
  210. </fileset>
  211. </copy>
  212. <filter token="VERSION" value="${version}" />
  213. <filter token="DATE" value="${TODAY}" />
  214. <filter token="TIME" value="${TSTAMP}" />
  215. <copy todir="${build.classes}"
  216. overwrite="true"
  217. filtering="on">
  218. <fileset dir="${java.dir}">
  219. <include name="**/version.txt" />
  220. <include name="**/defaultManifest.mf" />
  221. </fileset>
  222. </copy>
  223. <copy todir="${build.classes}/${optional.package}/junit">
  224. <fileset dir="${java.dir}/${optional.package}/junit">
  225. <include name="html/**" />
  226. <include name="xsl/**" />
  227. </fileset>
  228. </copy>
  229. </target>
  230. <!--
  231. ===================================================================
  232. Create the ant jars: ant.jar and optional.jar
  233. ===================================================================
  234. -->
  235. <target name="jars"
  236. depends="build"
  237. description="--> creates the ant jars">
  238. <jar jarfile="${build.lib}/${name}.jar"
  239. basedir="${build.classes}"
  240. manifest="${manifest}">
  241. <exclude name="org/apache/tools/ant/taskdefs/optional/**" />
  242. <fileset dir="${build.classes}"
  243. includes="org/apache/tools/ant/taskdefs/optional/TraXLiaison.class" />
  244. </jar>
  245. <jar jarfile="${build.lib}/optional.jar"
  246. basedir="${build.classes}"
  247. manifest="${manifest}">
  248. <include name="org/apache/tools/ant/taskdefs/optional/**" />
  249. <exclude name="org/apache/tools/ant/taskdefs/optional/TraXLiaison.class" />
  250. </jar>
  251. </target>
  252. <!--
  253. ===================================================================
  254. Create the essential distribution that can run ant
  255. ===================================================================
  256. -->
  257. <target name="dist-lite"
  258. depends="jars, setup-distproperties"
  259. description="--> creates a minimum distribution to run ant">
  260. <mkdir dir="${dist.dir}"/>
  261. <mkdir dir="${dist.bin}"/>
  262. <mkdir dir="${dist.lib}"/>
  263. <copy todir="${dist.lib}">
  264. <fileset dir="${build.lib}"/>
  265. </copy>
  266. <copy todir="${dist.bin}">
  267. <fileset dir="${script.dir}/" />
  268. </copy>
  269. <fixcrlf srcdir="${dist.bin}" cr="add" includes="*.bat" />
  270. <fixcrlf srcdir="${dist.bin}" cr="remove">
  271. <include name="ant" />
  272. <include name="antRun" />
  273. </fixcrlf>
  274. <fixcrlf srcdir="${dist.bin}" includes="runant.pl" />
  275. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**" />
  276. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**" />
  277. <chmod perm="ugo+x" type="file">
  278. <fileset dir="${dist.bin}">
  279. <include name="**/ant" />
  280. <include name="**/antRun" />
  281. <include name="**/runant.pl" />
  282. </fileset>
  283. </chmod>
  284. </target>
  285. <!--
  286. ===================================================================
  287. Create the complete distribution
  288. ===================================================================
  289. -->
  290. <target name="dist" description="--> creates a complete distribution">
  291. <antcall target="internal_dist">
  292. <param name="dist.dir" value="${dist.name}" />
  293. </antcall>
  294. </target>
  295. <target name="internal_dist" depends="dist-lite,javadocs">
  296. <mkdir dir="${dist.docs}"/>
  297. <mkdir dir="${dist.javadocs}"/>
  298. <copy todir="${dist.lib}">
  299. <fileset dir="${lib.dir}">
  300. <include name="*.jar" />
  301. <include name="*.zip" />
  302. </fileset>
  303. </copy>
  304. <copy todir="${dist.lib}" file="${lib.dir}/optional/README"/>
  305. <copy todir="${dist.docs}"
  306. filtering="on">
  307. <fileset dir="${docs.dir}"/>
  308. </copy>
  309. <copy todir="${dist.javadocs}" overwrite="true">
  310. <fileset dir="${build.javadocs}"/>
  311. </copy>
  312. <copy todir="${dist.dir}">
  313. <fileset dir=".">
  314. <include name="README"/>
  315. <include name="LICENSE"/>
  316. <include name="TODO"/>
  317. <include name="WHATSNEW"/>
  318. <include name="KEYS"/>
  319. </fileset>
  320. </copy>
  321. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**" />
  322. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**" />
  323. <chmod perm="ugo+x" type="file">
  324. <fileset dir="${dist.bin}">
  325. <include name="**/ant" />
  326. <include name="**/antRun" />
  327. <include name="**/runant.pl" />
  328. </fileset>
  329. </chmod>
  330. </target>
  331. <!--
  332. ===================================================================
  333. Target to create bootstrap build
  334. ===================================================================
  335. -->
  336. <target name="bootstrap" description="--> creates a bootstrap build">
  337. <antcall target="dist-lite">
  338. <param name="dist.dir" value="${bootstrap.dir}" />
  339. </antcall>
  340. </target>
  341. <!--
  342. ===================================================================
  343. Create the source distribution
  344. ===================================================================
  345. -->
  346. <target name="src-dist"
  347. depends="setup-distproperties"
  348. description="--> creates a source distribution">
  349. <mkdir dir="${src.dist.dir}" />
  350. <copy todir="${src.dist.lib}">
  351. <fileset dir="${lib.dir}">
  352. <include name="*.jar" />
  353. <include name="*.zip" />
  354. <include name="optional/README"/>
  355. </fileset>
  356. </copy>
  357. <copy todir="${src.dist.src}">
  358. <fileset dir="${src.dir}"/>
  359. </copy>
  360. <copy todir="${src.dist.docs}">
  361. <fileset dir="${docs.dir}"/>
  362. </copy>
  363. <copy todir="${src.dist.dir}">
  364. <fileset dir=".">
  365. <include name="README"/>
  366. <include name="LICENSE"/>
  367. <include name="TODO"/>
  368. <include name="WHATSNEW"/>
  369. <include name="KEYS"/>
  370. <include name="build.bat"/>
  371. <include name="build.sh"/>
  372. <include name="bootstrap.bat"/>
  373. <include name="bootstrap.sh"/>
  374. <include name="build.xml"/>
  375. </fileset>
  376. </copy>
  377. <fixcrlf srcdir="${src.dist.dir}" cr="add" includes="*.bat" />
  378. <fixcrlf srcdir="${src.dist.dir}" cr="remove">
  379. <include name="**/*.sh" />
  380. <include name="**/ant" />
  381. <include name="**/antRun" />
  382. </fixcrlf>
  383. <fixcrlf srcdir="${src.dist.dir}">
  384. <include name="**/runant.pl" />
  385. <include name="**/*.java" />
  386. </fixcrlf>
  387. <chmod perm="ugo+x" dir="${src.dist.dir}" type="dir"/>
  388. <chmod perm="ugo+r" dir="${src.dist.dir}" />
  389. <chmod perm="ugo+x">
  390. <fileset dir="${src.dist.dir}">
  391. <include name="**/.sh" />
  392. <include name="**/ant" />
  393. <include name="**/antRun" />
  394. <include name="**/runant.pl" />
  395. </fileset>
  396. </chmod>
  397. </target>
  398. <!--
  399. ===================================================================
  400. Create the binary distribution
  401. ===================================================================
  402. -->
  403. <target name="distribution"
  404. description="--> creates a binary distribution">
  405. <mkdir dir="${dist.base}"/>
  406. <antcall target="internal_dist">
  407. <param name="dist.dir" value="${dist.name}" />
  408. </antcall>
  409. <zip zipfile="${dist.base}/${dist.name}-bin.zip"
  410. basedir="${dist.name}/.."
  411. includes="${dist.name}/**"
  412. excludes="${dist.name}/lib/optional.jar"/>
  413. <tar longfile="gnu"
  414. tarfile="${dist.base}/${dist.name}-bin.tar">
  415. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  416. <include name="${dist.name}/bin/ant"/>
  417. <include name="${dist.name}/bin/antRun"/>
  418. </tarfileset>
  419. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  420. <include name="${dist.name}/**"/>
  421. <exclude name="${dist.name}/bin/ant"/>
  422. <exclude name="${dist.name}/bin/antRun"/>
  423. <exclude name="${dist.name}/lib/optional.jar"/>
  424. </tarfileset>
  425. </tar>
  426. <gzip zipfile="${dist.base}/${dist.name}-bin.tar.gz"
  427. src="${dist.base}/${dist.name}-bin.tar"/>
  428. <delete file="${dist.base}/${dist.name}-bin.tar"/>
  429. <copy file="${dist.name}/lib/optional.jar" tofile="${dist.base}/${dist.name}-optional.jar"/>
  430. <delete dir="${dist.name}" />
  431. <antcall target="src-dist">
  432. <param name="src.dist.dir" value="${dist.name}" />
  433. </antcall>
  434. <zip zipfile="${dist.base}/${dist.name}-src.zip"
  435. basedir="${dist.name}/.."
  436. includes="${dist.name}/**"/>
  437. <tar longfile="gnu"
  438. tarfile="${dist.base}/${dist.name}-src.tar" >
  439. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  440. <include name="${dist.name}/bootstrap.sh"/>
  441. <include name="${dist.name}/build.sh"/>
  442. </tarfileset>
  443. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  444. <include name="${dist.name}/**"/>
  445. <exclude name="${dist.name}/bootstrap.sh"/>
  446. <exclude name="${dist.name}/build.sh"/>
  447. </tarfileset>
  448. </tar>
  449. <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
  450. src="${dist.base}/${dist.name}-src.tar"/>
  451. <delete file="${dist.base}/${dist.name}-src.tar"/>
  452. <delete dir="${dist.name}" />
  453. </target>
  454. <!--
  455. ===================================================================
  456. Cleans up build and distribution directories
  457. ===================================================================
  458. -->
  459. <target name="clean"
  460. description="--> cleans up build and dist directories">
  461. <delete dir="${build.dir}" />
  462. <delete dir="${dist.base}" />
  463. <delete dir="${defaultdist.dir}" />
  464. <delete>
  465. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  466. </delete>
  467. </target>
  468. <!--
  469. ===================================================================
  470. Cleans everything
  471. ===================================================================
  472. -->
  473. <target name="allclean"
  474. depends="clean"
  475. description="--> cleans up everything">
  476. <delete file="${bootstrap.dir}/bin/antRun" />
  477. <delete file="${bootstrap.dir}/bin/antRun.bat" />
  478. </target>
  479. <!--
  480. ===================================================================
  481. Installs ant
  482. ===================================================================
  483. -->
  484. <target name="install" if="ant.install">
  485. <antcall target="internal_dist">
  486. <param name="dist.dir" value="${ant.install}" />
  487. </antcall>
  488. </target>
  489. <target name="install-lite" if="ant.install">
  490. <antcall target="dist-lite">
  491. <param name="dist.dir" value="${ant.install}" />
  492. </antcall>
  493. </target>
  494. <!--
  495. ===================================================================
  496. Creates the API documentation
  497. ===================================================================
  498. -->
  499. <target name="javadoc_check">
  500. <uptodate property="javadoc.notrequired"
  501. targetfile="${build.javadocs}/packages.html" >
  502. <srcfiles dir= "${java.dir}" includes="**/*.java"/>
  503. </uptodate>
  504. </target>
  505. <target name="javadocs" depends="prepare, javadoc_check"
  506. unless="javadoc.notrequired"
  507. description="--> creates the API documentation">
  508. <mkdir dir="${build.javadocs}"/>
  509. <javadoc packagenames="org.apache.*"
  510. useexternalfile="yes"
  511. sourcepath="${java.dir}"
  512. destdir="${build.javadocs}"
  513. author="true"
  514. version="true"
  515. windowtitle="${Name} API"
  516. doctitle="${Name}">
  517. <group title="Ant Core" packages="org.apache.tools.ant*" />
  518. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*" />
  519. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*" />
  520. <bottom>Copyright &#169; 1999-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  521. </javadoc>
  522. </target>
  523. <!--
  524. ===================================================================
  525. Compile testcases
  526. ===================================================================
  527. -->
  528. <target name="compile-tests" depends="build" if="junit.present">
  529. <mkdir dir="${build.tests}"/>
  530. <javac srcdir="${tests.dir}"
  531. destdir="${build.tests}"
  532. debug="${debug}"
  533. deprecation="${deprecation}" >
  534. <classpath refid="tests-classpath" />
  535. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  536. unless="antlr.present" />
  537. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  538. unless="jakarta.regexp.present" />
  539. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  540. unless="jakarta.oro.present" />
  541. <exclude name="org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java"
  542. unless="jdk1.4+" />
  543. </javac>
  544. </target>
  545. <target name="dump-info">
  546. <echo message="java.vm.info=${java.vm.info}" />
  547. <echo message="java.vm.name=${java.vm.name}" />
  548. <echo message="java.vm.vendor=${java.vm.vendor}" />
  549. <echo message="java.vm.version=${java.vm.version}" />
  550. <echo message="os.arch=${os.arch}" />
  551. <echo message="os.name=${os.name}" />
  552. <echo message="os.version=${os.version}" />
  553. <echo message="file.encoding=${file.encoding}" />
  554. <echo message="user.language=${user.language}" />
  555. </target>
  556. <!--
  557. ===================================================================
  558. Run testcase
  559. ===================================================================
  560. -->
  561. <target name="test" depends="run-tests" description="--> run JUnit tests"/>
  562. <target name="run-tests" depends="dump-info,compile-tests" if="junit.present">
  563. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  564. <!-- <jvmarg value="-classic"/> -->
  565. <classpath refid="tests-classpath"/>
  566. <sysproperty key="build.tests" value="${build.tests}"/>
  567. <formatter type="brief" usefile="false" />
  568. <batchtest>
  569. <fileset dir="${tests.dir}">
  570. <include name="**/*Test*" />
  571. <!-- abstract class, not a testcase -->
  572. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  573. <exclude name="org/apache/tools/ant/util/regexp/RegexpMatcherTest.java" />
  574. <!-- helper classes, not testcases -->
  575. <exclude name="org/apache/tools/ant/taskdefs/TaskdefTest*Task.java" />
  576. <!-- these tests need to be localised before being ran???? -->
  577. <exclude name="org/apache/tools/ant/taskdefs/optional/PvcsTest.java" />
  578. <!-- these depend on order -->
  579. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  580. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  581. <!-- only run these tests if their required libraries are installed -->
  582. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  583. unless="antlr.present" />
  584. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  585. unless="jakarta.regexp.present" />
  586. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  587. unless="jakarta.oro.present" />
  588. <exclude name="org/apache/tools/ant/util/regexp/Jdk14RegexpMatcherTest.java"
  589. unless="jdk1.4+" />
  590. <exclude name="${optional.package}/ide/VAJExportTest.java" unless="vaj.present" />
  591. <!-- run when you have the environment setup to support them -->
  592. <exclude name="org/apache/tools/ant/taskdefs/optional/net/FtpTest.java" />
  593. </fileset>
  594. </batchtest>
  595. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  596. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  597. </junit>
  598. <!-- clean up again -->
  599. <delete dir="${tests.etc.dir}/taskdefs/optional/antlr/antlr.tmp" />
  600. <delete dir="${tests.etc.dir}/taskdefs/taskdefs.tmp" />
  601. <delete dir="${tests.etc.dir}/taskdefs.tmp" />
  602. <delete file="${tests.etc.dir}/taskdefs/tmp.jar" />
  603. <delete dir="${tests.etc.dir}/types/copytest" />
  604. </target>
  605. <target name="run-single-test" if="testcase" depends="compile-tests">
  606. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  607. <!-- <jvmarg value="-classic"/> -->
  608. <sysproperty key="build.tests" value="${build.tests}"/>
  609. <classpath location="${java.home}/lib/classes.zip" />
  610. <classpath refid="tests-classpath"/>
  611. <formatter type="plain" usefile="false" />
  612. <test name="${testcase}" />
  613. </junit>
  614. </target>
  615. <!--
  616. ===================================================================
  617. Main target - runs dist-lite by default
  618. ===================================================================
  619. -->
  620. <target name="main"
  621. description="--> creates a minimum distribution in ./dist">
  622. <antcall target="dist-lite"/>
  623. </target>
  624. </project>