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 38 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  1. <?xml version="1.0"?>
  2. <!--
  3. =======================================================================
  4. Apache Ant own build file
  5. Copyright (c) 2000-2002 The Apache Software Foundation. All rights
  6. reserved.
  7. =======================================================================
  8. -->
  9. <project default="main" basedir=".">
  10. <!-- Give user a chance to override without editing this file
  11. (and without typing -D each time it compiles it) -->
  12. <property file=".ant.properties" />
  13. <property file="${user.home}/.ant.properties" />
  14. <property name="Name" value="Apache Ant"/>
  15. <property name="name" value="ant"/>
  16. <property name="version" value="1.5alpha"/>
  17. <property name="debug" value="true" />
  18. <property name="deprecation" value="false" />
  19. <property name="optimize" value="true" />
  20. <property name="junit.fork" value="false" />
  21. <property name="junit.filtertrace" value="off"/>
  22. <!--
  23. ===================================================================
  24. Set the properties related to the source tree
  25. ===================================================================
  26. -->
  27. <property name="src.dir" value="src"/>
  28. <property name="java.dir" value="${src.dir}/main"/>
  29. <property name="script.dir" value="${src.dir}/script"/>
  30. <property name="lib.dir" value="lib"/>
  31. <property name="docs.dir" value="docs"/>
  32. <property name="etc.dir" value="src/etc"/>
  33. <property name="tests.dir" value="src/testcases"/>
  34. <property name="tests.etc.dir" value="src/etc/testcases"/>
  35. <property name="ant.package" value="org/apache/tools/ant"/>
  36. <property name="optional.package" value="${ant.package}/taskdefs/optional"/>
  37. <property name="optional.type.package" value="${ant.package}/types/optional"/>
  38. <property name="util.package" value="${ant.package}/util"/>
  39. <property name="regexp.package" value="${util.package}/regexp"/>
  40. <property name="manifest" value="src/etc/manifest"/>
  41. <!--
  42. ===================================================================
  43. Set the properties for the build area
  44. ===================================================================
  45. -->
  46. <property name="build.dir" value="build"/>
  47. <property name="bootstrap.dir" value="bootstrap"/>
  48. <property name="build.classes" value="${build.dir}/classes"/>
  49. <property name="build.lib" value="${build.dir}/lib"/>
  50. <property name="build.javadocs" value="${build.dir}/javadocs"/>
  51. <property name="build.tests" value="${build.dir}/testcases"/>
  52. <path id="classpath">
  53. </path>
  54. <path id="tests-classpath">
  55. <pathelement location="${build.classes}" />
  56. <pathelement location="${build.tests}" />
  57. <!--
  58. include the test source and test data dirs
  59. so that we can pick resources via getResource(AsStream)
  60. -->
  61. <pathelement location="${tests.dir}"/>
  62. <pathelement location="${tests.etc.dir}"/>
  63. <path refid="classpath" />
  64. </path>
  65. <!--
  66. ===================================================================
  67. Set up properties for the distribution area
  68. ===================================================================
  69. -->
  70. <property name="dist.name" value="jakarta-${name}-${version}"/>
  71. <property name="dist.base" value="distribution"/>
  72. <property name="dist.dir" value="dist"/>
  73. <property name="dist.bin" value="${dist.dir}/bin"/>
  74. <property name="dist.lib" value="${dist.dir}/lib"/>
  75. <property name="dist.docs" value="${dist.dir}/docs"/>
  76. <property name="dist.etc" value="${dist.dir}/etc"/>
  77. <property name="dist.javadocs" value="${dist.dir}/docs/manual/api"/>
  78. <property name="src.dist.dir" value="dist-src"/>
  79. <property name="src.dist.src" value="${src.dist.dir}/src"/>
  80. <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
  81. <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
  82. <!--
  83. ===================================================================
  84. Check to see what optional dependencies are available
  85. ===================================================================
  86. -->
  87. <target name="check_for_optional_packages">
  88. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  89. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  90. <available property="jdk1.4+" classname="java.lang.CharSequence" />
  91. <available property="bsf.present"
  92. classname="com.ibm.bsf.BSFManager"
  93. classpathref="classpath" />
  94. <available property="netrexx.present"
  95. classname="netrexx.lang.Rexx"
  96. classpathref="classpath" />
  97. <available property="trax.present"
  98. classname="javax.xml.transform.Transformer"
  99. classpathref="classpath" />
  100. <available property="xslp.present"
  101. classname="com.kvisco.xsl.XSLProcessor"
  102. classpathref="classpath" />
  103. <available property="xalan.present"
  104. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  105. classpathref="classpath" />
  106. <available property="xalan2.present"
  107. classname="org.apache.xalan.transformer.TransformerImpl"
  108. classpathref="classpath" />
  109. <available property="ejb.ejbc.present"
  110. classname="weblogic.ejbc"
  111. classpathref="classpath" />
  112. <available property="ejb.DDCreator.present"
  113. classname="weblogic.ejb.utils.DDCreator"
  114. classpathref="classpath" />
  115. <available property="ejb.wls.present"
  116. classname="weblogic.Server"
  117. classpathref="classpath" />
  118. <available property="junit.present"
  119. classname="junit.framework.TestCase"
  120. classpathref="classpath" />
  121. <available property="netcomp.present"
  122. classname="com.oroinc.net.ftp.FTPClient"
  123. classpathref="classpath" />
  124. <available property="starteam.present"
  125. classname="com.starbase.util.Platform"
  126. classpathref="classpath" />
  127. <available property="antlr.present"
  128. classname="antlr.Tool"
  129. classpathref="classpath"/>
  130. <available property="vaj.present"
  131. classname="com.ibm.ivj.util.base.Workspace"
  132. classpathref="classpath"/>
  133. <available property="stylebook.present"
  134. classname="org.apache.stylebook.Engine"
  135. classpathref="classpath"/>
  136. <available property="jakarta.regexp.present"
  137. classname="org.apache.regexp.RE"
  138. classpathref="classpath"/>
  139. <available property="jakarta.oro.present"
  140. classname="org.apache.oro.text.regex.Perl5Matcher"
  141. classpathref="classpath" />
  142. <available property="jmf.present"
  143. classname="javax.sound.sampled.Clip"
  144. classpathref="classpath"/>
  145. <available property="icontract.present"
  146. classname="com.reliablesystems.iContract.IContracted"
  147. classpathref="classpath"/>
  148. <available property="jdepend.present"
  149. classname="jdepend.framework.JDepend"
  150. classpathref="classpath"/>
  151. <available property="log4j.present"
  152. classname="org.apache.log4j.Category"
  153. classpathref="classpath"/>
  154. <!-- this is just a way to check for a TraX implementation -->
  155. <available property="trax.impl.present"
  156. resource="META-INF/services/javax.xml.transform.TransformerFactory"
  157. classpathref="classpath"/>
  158. <available property="xalan.envcheck"
  159. classname="org.apache.xalan.xslt.EnvironmentCheck"
  160. classpathref="classpath" />
  161. <available property="which.present"
  162. classname="org.apache.env.Which"
  163. classpathref="classpath" />
  164. <available property="servlet.present"
  165. classname="javax.servlet.Servlet"
  166. classpathref="classpath"/>
  167. <available property="xerces.present"
  168. classname="org.apache.xerces.parsers.SAXParser"
  169. classpathref="classpath" />
  170. <available property="bcel.present"
  171. classname="org.apache.bcel.Constants"
  172. classpathref="classpath" />
  173. <condition property="javamail.complete">
  174. <and>
  175. <available classname="javax.activation.DataHandler"
  176. classpathref="classpath"/>
  177. <available classname="javax.mail.Transport"
  178. classpathref="classpath"/>
  179. </and>
  180. </condition>
  181. <condition property="some.regexp.support">
  182. <or>
  183. <isset property="jdk1.4+" />
  184. <isset property="jakarta.regexp.present" />
  185. <isset property="jakarta.oro.present" />
  186. </or>
  187. </condition>
  188. <condition property="ejbjar.support">
  189. <and>
  190. <isset property="bcel.present" />
  191. <isset property="jdk1.2+" />
  192. </and>
  193. </condition>
  194. <condition property="run.sqlexec.test">
  195. <or>
  196. <equals arg1="${junit.fork}" arg2="true" />
  197. <equals arg1="${build.sysclasspath}" arg2="only" />
  198. </or>
  199. </condition>
  200. </target>
  201. <!--
  202. ===================================================================
  203. Prepare the build
  204. ===================================================================
  205. -->
  206. <target name="prepare">
  207. <tstamp>
  208. <format property="year" pattern="yyyy" />
  209. </tstamp>
  210. <filterset id="ant.filters">
  211. <filter token="VERSION" value="${version}" />
  212. <filter token="DATE" value="${TODAY}" />
  213. <filter token="TIME" value="${TSTAMP}" />
  214. </filterset>
  215. </target>
  216. <!--
  217. ===================================================================
  218. Build the code
  219. ===================================================================
  220. -->
  221. <target name="build"
  222. depends="prepare, check_for_optional_packages"
  223. description="--> compiles the source code">
  224. <mkdir dir="${build.dir}"/>
  225. <mkdir dir="${build.classes}"/>
  226. <mkdir dir="${build.lib}"/>
  227. <javac srcdir="${java.dir}"
  228. destdir="${build.classes}"
  229. debug="${debug}"
  230. deprecation="${deprecation}"
  231. optimize="${optimize}" >
  232. <classpath refid="classpath" />
  233. <exclude name="${regexp.package}/JakartaRegexp*.java"
  234. unless="jakarta.regexp.present" />
  235. <exclude name="${regexp.package}/JakartaOro*.java"
  236. unless="jakarta.oro.present" />
  237. <exclude name="${regexp.package}/Jdk14Regexp*.java"
  238. unless="jdk1.4+" />
  239. <exclude name="${ant.package}/AntSecurityManager.java"
  240. unless="jdk1.2+" />
  241. <exclude name="${ant.package}/NoExitSecurityManager.java"
  242. unless="jdk1.2+" />
  243. <exclude name="${ant.package}/listener/Log4jListener.java"
  244. unless="log4j.present" />
  245. <exclude name="${optional.package}/IContract.java" unless="icontract.present" />
  246. <exclude name="${optional.package}/Script.java" unless="bsf.present" />
  247. <exclude name="${optional.package}/StyleBook.java" unless="stylebook.present" />
  248. <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" />
  249. <exclude name="${optional.package}/TraXLiaison.java"
  250. unless="trax.present" />
  251. <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" />
  252. <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" />
  253. <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" />
  254. <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" />
  255. <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" />
  256. <exclude name="${optional.package}/ejb/WLStop.java" unless="ejb.wls.present" />
  257. <exclude name="${optional.package}/ejb/EjbJar.java" unless="ejbjar.support" />
  258. <exclude name="${optional.package}/ejb/*DeploymentTool.java" unless="ejbjar.support" />
  259. <exclude name="${optional.package}/ejb/IPlanet*.java" unless="ejbjar.support" />
  260. <exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
  261. <exclude name="${optional.package}/junit/*" unless="junit.present" />
  262. <exclude name="${optional.package}/net/MimeMail.java" unless="javamail.complete" />
  263. <exclude name="${optional.package}/net/FTP.java" unless="netcomp.present" />
  264. <exclude name="${optional.package}/net/TelnetTask.java" unless="netcomp.present" />
  265. <exclude name="${optional.package}/scm/AntStarTeam*.java" unless="starteam.present" />
  266. <exclude name="${optional.package}/starteam/*.java" unless="starteam.present" />
  267. <exclude name="${optional.package}/ANTLR.java" unless="antlr.present" />
  268. <exclude name="${optional.package}/ide/VAJ*.java" unless="vaj.present" />
  269. <exclude name="${optional.package}/ide/VAJ*Servlet.java"
  270. unless="servlet.present" />
  271. <exclude name="${optional.package}/perforce/*.java" unless="jakarta.oro.present" />
  272. <exclude name="${optional.package}/sound/*.java" unless="jmf.present" />
  273. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  274. unless="trax.present" />
  275. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  276. unless="trax.present" />
  277. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  278. unless="xalan2.present" />
  279. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  280. unless="xalan2.present" />
  281. <exclude name="${optional.package}/junit/XalanExecutor.java"
  282. unless="xalan2.present" />
  283. <exclude name="${optional.package}/junit/Xalan2Executor.java"
  284. unless="xalan2.present" />
  285. <exclude name="${optional.package}/junit/Xalan1Executor.java"
  286. unless="xalan.present" />
  287. <exclude name="${optional.package}/jdepend/*" unless="jdepend.present" />
  288. <exclude name="${optional.package}/sitraka/**" unless="some.regexp.support"/>
  289. <exclude name="${optional.package}/metamata/MAudit*" unless="jakarta.oro.present"/>
  290. <exclude name="${optional.package}/metamata/MMetrics*"
  291. unless="trax.present"/>
  292. <exclude name="${optional.package}/metamata/**" unless="jdk1.2+" />
  293. <exclude name="${optional.type.package}/depend/*.java"
  294. unless="bcel.present" />
  295. <exclude name="${util.package}/depend/*.java"
  296. unless="bcel.present" />
  297. <exclude name="${optional.type.package}/depend/*.java"
  298. unless="jdk1.2+" />
  299. <exclude name="${util.package}/depend/*.java"
  300. unless="jdk1.2+" />
  301. </javac>
  302. <copy todir="${build.classes}">
  303. <fileset dir="${java.dir}">
  304. <include name="**/*.properties" />
  305. <include name="**/*.dtd" />
  306. </fileset>
  307. </copy>
  308. <copy todir="${build.classes}"
  309. overwrite="true">
  310. <fileset dir="${java.dir}">
  311. <include name="**/version.txt" />
  312. <include name="**/defaultManifest.mf" />
  313. </fileset>
  314. <filterset refid="ant.filters"/>
  315. </copy>
  316. <copy todir="${build.classes}/${optional.package}/junit/xsl">
  317. <fileset dir="${etc.dir}">
  318. <include name="junit-frames.xsl" />
  319. <include name="junit-noframes.xsl" />
  320. </fileset>
  321. </copy>
  322. </target>
  323. <!--
  324. ===================================================================
  325. Create the Apache Ant jars: ant.jar and optional.jar
  326. ===================================================================
  327. -->
  328. <target name="jars"
  329. depends="build"
  330. description="--> creates the Apache Ant jars">
  331. <copy file="LICENSE" tofile="${build.dir}/LICENSE.txt"/>
  332. <jar destfile="${build.lib}/${name}.jar"
  333. basedir="${build.classes}"
  334. manifest="${manifest}">
  335. <exclude name="org/apache/tools/ant/taskdefs/optional/**" />
  336. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  337. </jar>
  338. <jar destfile="${build.lib}/optional.jar"
  339. basedir="${build.classes}"
  340. manifest="${manifest}">
  341. <include name="org/apache/tools/ant/taskdefs/optional/**" />
  342. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  343. </jar>
  344. </target>
  345. <!--
  346. ===================================================================
  347. Create the essential distribution that can run Apache Ant
  348. ===================================================================
  349. -->
  350. <target name="dist-lite"
  351. depends="jars"
  352. description="--> creates a minimum distribution to run Apache Ant">
  353. <mkdir dir="${dist.dir}"/>
  354. <mkdir dir="${dist.bin}"/>
  355. <mkdir dir="${dist.lib}"/>
  356. <copy todir="${dist.lib}">
  357. <fileset dir="${build.lib}"/>
  358. </copy>
  359. <copy todir="${dist.bin}">
  360. <fileset dir="${script.dir}/" />
  361. </copy>
  362. <fixcrlf srcdir="${dist.bin}" eol="crlf" includes="*.bat" />
  363. <fixcrlf srcdir="${dist.bin}" eol="lf">
  364. <include name="ant" />
  365. <include name="antRun" />
  366. </fixcrlf>
  367. <fixcrlf srcdir="${dist.bin}" includes="*.pl" />
  368. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**" />
  369. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**" />
  370. <chmod perm="ugo+x" type="file">
  371. <fileset dir="${dist.bin}">
  372. <include name="**/ant" />
  373. <include name="**/antRun" />
  374. <include name="**/*.pl" />
  375. </fileset>
  376. </chmod>
  377. </target>
  378. <!--
  379. ===================================================================
  380. Create the complete distribution
  381. ===================================================================
  382. -->
  383. <target name="dist" description="--> creates a complete distribution">
  384. <antcall inheritAll="false" target="internal_dist">
  385. <param name="dist.dir" value="${dist.name}" />
  386. </antcall>
  387. </target>
  388. <target name="dist_javadocs" depends="javadocs">
  389. <mkdir dir="${dist.javadocs}"/>
  390. <copy todir="${dist.javadocs}" overwrite="true">
  391. <fileset dir="${build.javadocs}"/>
  392. </copy>
  393. </target>
  394. <target name="internal_dist" depends="dist-lite,dist_javadocs">
  395. <mkdir dir="${dist.docs}"/>
  396. <mkdir dir="${dist.etc}"/>
  397. <copy todir="${dist.lib}">
  398. <fileset dir="${lib.dir}">
  399. <include name="*.jar" />
  400. <include name="*.zip" />
  401. </fileset>
  402. </copy>
  403. <copy todir="${dist.lib}" file="${lib.dir}/README"/>
  404. <copy todir="${dist.docs}">
  405. <fileset dir="${docs.dir}">
  406. <exclude name="**/images/**"/>
  407. </fileset>
  408. <filterset refid="ant.filters"/>
  409. </copy>
  410. <copy todir="${dist.docs}" filtering="false">
  411. <fileset dir="${docs.dir}">
  412. <include name="**/images/**"/>
  413. </fileset>
  414. </copy>
  415. <copy todir="${dist.dir}">
  416. <fileset dir=".">
  417. <include name="README"/>
  418. <include name="LICENSE"/>
  419. <include name="TODO"/>
  420. <include name="WHATSNEW"/>
  421. <include name="KEYS"/>
  422. </fileset>
  423. </copy>
  424. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**" />
  425. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**" />
  426. <chmod perm="ugo+x" type="file">
  427. <fileset dir="${dist.bin}">
  428. <include name="**/ant" />
  429. <include name="**/antRun" />
  430. <include name="**/runant.pl" />
  431. </fileset>
  432. </chmod>
  433. <!-- publish some useful stylesheets -->
  434. <copy todir="${dist.etc}">
  435. <fileset dir="${etc.dir}">
  436. <include name="junit-frames.xsl"/>
  437. <include name="junit-noframes.xsl"/>
  438. <include name="coverage-frames.xsl"/>
  439. <include name="maudit-frames.xsl"/>
  440. <include name="mmetrics-frames.xsl"/>
  441. <include name="jdepend.xsl"/>
  442. <include name="log.xsl"/>
  443. </fileset>
  444. </copy>
  445. </target>
  446. <!--
  447. ===================================================================
  448. Target to create bootstrap build
  449. ===================================================================
  450. -->
  451. <target name="bootstrap" description="--> creates a bootstrap build">
  452. <antcall inheritAll="false" target="dist-lite">
  453. <param name="dist.dir" value="${bootstrap.dir}" />
  454. </antcall>
  455. </target>
  456. <!--
  457. ===================================================================
  458. Create the source distribution
  459. ===================================================================
  460. -->
  461. <target name="src-dist"
  462. description="--> creates a source distribution">
  463. <mkdir dir="${src.dist.dir}" />
  464. <copy todir="${src.dist.lib}">
  465. <fileset dir="${lib.dir}">
  466. <include name="*.jar" />
  467. <include name="*.zip" />
  468. <include name="README"/>
  469. </fileset>
  470. </copy>
  471. <copy todir="${src.dist.src}">
  472. <fileset dir="${src.dir}"/>
  473. </copy>
  474. <copy todir="${src.dist.docs}">
  475. <fileset dir="${docs.dir}">
  476. <exclude name="manual/api/**"/>
  477. </fileset>
  478. </copy>
  479. <copy todir="${src.dist.dir}">
  480. <fileset dir=".">
  481. <include name="README"/>
  482. <include name="LICENSE"/>
  483. <include name="TODO"/>
  484. <include name="WHATSNEW"/>
  485. <include name="KEYS"/>
  486. <include name="build.bat"/>
  487. <include name="build.sh"/>
  488. <include name="bootstrap.bat"/>
  489. <include name="bootstrap.sh"/>
  490. <include name="build.xml"/>
  491. </fileset>
  492. </copy>
  493. <fixcrlf srcdir="${src.dist.dir}" eol="crlf" includes="*.bat" />
  494. <fixcrlf srcdir="${src.dist.dir}" eol="lf">
  495. <include name="**/*.sh" />
  496. <include name="**/*.pl" />
  497. <include name="**/ant" />
  498. <include name="**/antRun" />
  499. </fixcrlf>
  500. <fixcrlf srcdir="${src.dist.dir}">
  501. <include name="**/runant.pl" />
  502. <include name="**/*.java" />
  503. </fixcrlf>
  504. <chmod perm="ugo+x" dir="${src.dist.dir}" type="dir"/>
  505. <chmod perm="ugo+r" dir="${src.dist.dir}" />
  506. <chmod perm="ugo+x">
  507. <fileset dir="${src.dist.dir}">
  508. <include name="**/.sh" />
  509. <include name="**/ant" />
  510. <include name="**/antRun" />
  511. <include name="**/runant.pl" />
  512. </fileset>
  513. </chmod>
  514. </target>
  515. <!--
  516. ===================================================================
  517. Create the binary distribution
  518. ===================================================================
  519. -->
  520. <target name="main_distribution"
  521. description="--> creates the zip and tar distributions">
  522. <delete dir="${dist.name}" />
  523. <mkdir dir="${dist.base}"/>
  524. <mkdir dir="${dist.base}/src"/>
  525. <mkdir dir="${dist.base}/bin"/>
  526. <antcall inheritAll="false" target="internal_dist">
  527. <param name="dist.dir" value="${dist.name}" />
  528. </antcall>
  529. <zip destfile="${dist.base}/bin/${dist.name}-bin.zip"
  530. basedir="${dist.name}/.."
  531. includes="${dist.name}/**"/>
  532. <tar longfile="gnu"
  533. tarfile="${dist.base}/bin/${dist.name}-bin.tar">
  534. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  535. <include name="${dist.name}/bin/ant"/>
  536. <include name="${dist.name}/bin/antRun"/>
  537. <include name="${dist.name}/bin/*.pl"/>
  538. </tarfileset>
  539. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  540. <include name="${dist.name}/**"/>
  541. <exclude name="${dist.name}/bin/ant"/>
  542. <exclude name="${dist.name}/bin/antRun"/>
  543. <include name="${dist.name}/bin/*.pl"/>
  544. </tarfileset>
  545. </tar>
  546. <gzip zipfile="${dist.base}/bin/${dist.name}-bin.tar.gz"
  547. src="${dist.base}/bin/${dist.name}-bin.tar"/>
  548. <bzip2 zipfile="${dist.base}/bin/${dist.name}-bin.tar.bz2"
  549. src="${dist.base}/bin/${dist.name}-bin.tar"/>
  550. <delete file="${dist.base}/bin/${dist.name}-bin.tar"/>
  551. <delete dir="${dist.name}" />
  552. <checksum fileext=".md5">
  553. <fileset dir="${dist.base}/bin/" />
  554. </checksum>
  555. <antcall inheritAll="false" target="src-dist">
  556. <param name="src.dist.dir" value="${dist.name}" />
  557. </antcall>
  558. <zip destfile="${dist.base}/src/${dist.name}-src.zip"
  559. basedir="${dist.name}/.."
  560. includes="${dist.name}/**"/>
  561. <tar longfile="gnu"
  562. tarfile="${dist.base}/src/${dist.name}-src.tar" >
  563. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  564. <include name="${dist.name}/bootstrap.sh"/>
  565. <include name="${dist.name}/build.sh"/>
  566. </tarfileset>
  567. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  568. <include name="${dist.name}/**"/>
  569. <exclude name="${dist.name}/bootstrap.sh"/>
  570. <exclude name="${dist.name}/build.sh"/>
  571. </tarfileset>
  572. </tar>
  573. <gzip zipfile="${dist.base}/src/${dist.name}-src.tar.gz"
  574. src="${dist.base}/src/${dist.name}-src.tar"/>
  575. <bzip2 zipfile="${dist.base}/src/${dist.name}-src.tar.bz2"
  576. src="${dist.base}/src/${dist.name}-src.tar"/>
  577. <delete file="${dist.base}/src/${dist.name}-src.tar"/>
  578. <delete dir="${dist.name}" />
  579. <checksum fileext=".md5">
  580. <fileset dir="${dist.base}/src/" />
  581. </checksum>
  582. </target>
  583. <target name="rpm_check">
  584. <available property="rpm.present"
  585. file="/bin/rpm"/>
  586. </target>
  587. <target name="rpm" description="Build the RPM files for ant"
  588. depends="prepare, rpm_check"
  589. if="rpm.present">
  590. <tstamp>
  591. <format property="rpmyear" pattern="yyyyMMdd"/>
  592. <format property="nightlybuild.dir" pattern="yyyy-MM-dd"/>
  593. </tstamp>
  594. <property name="rpm.release" value="cvs${rpmyear}"/>
  595. <property name="rpm.source" value="nightly/${nightlybuild.dir}/"/>
  596. <mkdir dir="build/rpm/SPECS"/>
  597. <mkdir dir="build/rpm/SOURCES"/>
  598. <mkdir dir="build/rpm/BUILD"/>
  599. <mkdir dir="build/rpm/RPMS"/>
  600. <mkdir dir="build/rpm/SRPMS"/>
  601. <property name="disttar" location="${dist.base}/bin/${dist.name}-bin.tar.gz"/>
  602. <copy file="src/etc/ant.spec" tofile="build/rpm/SPECS/ant.spec">
  603. <filterset refid="ant.filters"/>
  604. <filterset>
  605. <filter token="RPM_RELEASE" value="${rpm.release}"/>
  606. <filter token="RPM_SOURCE" value="${rpm.source}"/>
  607. <filter token="DIST_TAR" value="${disttar}"/>
  608. </filterset>
  609. </copy>
  610. <copy file="src/etc/antsrc.spec" tofile="build/rpm/SPECS/antsrc.spec">
  611. <filterset refid="ant.filters"/>
  612. <filterset>
  613. <filter token="RPM_RELEASE" value="${rpm.release}"/>
  614. <filter token="RPM_SOURCE" value="${rpm.source}"/>
  615. </filterset>
  616. </copy>
  617. <rpm topDir="build/rpm"
  618. specfile="ant.spec"
  619. command="-bb"/>
  620. <copy file="distribution/src/${dist.name}-src.tar.gz" todir="build/rpm/SOURCES"/>
  621. <rpm topDir="build/rpm"
  622. specfile="antsrc.spec"
  623. command="-bs"/>
  624. <mkdir dir="${dist.base}/rpms"/>
  625. <copy todir="${dist.base}/rpms">
  626. <fileset dir="build/rpm/RPMS/noarch"/>
  627. </copy>
  628. <copy todir="${dist.base}/rpms">
  629. <fileset dir="build/rpm/SRPMS"/>
  630. </copy>
  631. </target>
  632. <target name="distribution" depends="main_distribution, rpm">
  633. </target>
  634. <!--
  635. ===================================================================
  636. Cleans up build and distribution directories
  637. ===================================================================
  638. -->
  639. <target name="clean"
  640. description="--> cleans up build and dist directories">
  641. <delete dir="${build.dir}" />
  642. <delete dir="${dist.base}" />
  643. <delete dir="${dist.dir}" />
  644. <delete>
  645. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  646. </delete>
  647. </target>
  648. <!--
  649. ===================================================================
  650. Cleans everything
  651. ===================================================================
  652. -->
  653. <target name="allclean"
  654. depends="clean"
  655. description="--> cleans up everything">
  656. <delete file="${bootstrap.dir}/bin/antRun" />
  657. <delete file="${bootstrap.dir}/bin/antRun.bat" />
  658. </target>
  659. <!--
  660. ===================================================================
  661. Installs Apache Ant
  662. ===================================================================
  663. -->
  664. <target name="install" if="ant.install">
  665. <antcall inheritAll="false" target="internal_dist">
  666. <param name="dist.dir" value="${ant.install}" />
  667. </antcall>
  668. </target>
  669. <target name="install-lite" if="ant.install">
  670. <antcall inheritAll="false" target="dist-lite">
  671. <param name="dist.dir" value="${ant.install}" />
  672. </antcall>
  673. </target>
  674. <!--
  675. ===================================================================
  676. Creates the API documentation
  677. ===================================================================
  678. -->
  679. <target name="javadoc_check">
  680. <uptodate property="javadoc.notrequired"
  681. targetfile="${build.javadocs}/packages.html" >
  682. <srcfiles dir= "${java.dir}" includes="**/*.java"/>
  683. </uptodate>
  684. </target>
  685. <target name="javadocs" depends="prepare, javadoc_check"
  686. unless="javadoc.notrequired"
  687. description="--> creates the API documentation">
  688. <mkdir dir="${build.javadocs}"/>
  689. <javadoc packagenames="org.apache.*"
  690. useexternalfile="yes"
  691. sourcepath="${java.dir}"
  692. destdir="${build.javadocs}"
  693. author="true"
  694. version="true"
  695. windowtitle="${Name} API"
  696. doctitle="${Name}">
  697. <group title="Apache Ant Core" packages="org.apache.tools.ant*" />
  698. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*" />
  699. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*" />
  700. <bottom>Copyright &#169; 2000-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  701. </javadoc>
  702. </target>
  703. <!--
  704. ===================================================================
  705. Compile testcases
  706. ===================================================================
  707. -->
  708. <target name="compile-tests" depends="build" if="junit.present">
  709. <mkdir dir="${build.tests}"/>
  710. <javac srcdir="${tests.dir}"
  711. destdir="${build.tests}"
  712. debug="${debug}"
  713. deprecation="${deprecation}" >
  714. <classpath refid="tests-classpath" />
  715. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  716. unless="antlr.present" />
  717. <exclude name="${regexp.package}/JakartaRegexp*Test.java"
  718. unless="jakarta.regexp.present" />
  719. <exclude name="${regexp.package}/JakartaOro*Test.java"
  720. unless="jakarta.oro.present" />
  721. <exclude name="${regexp.package}/Jdk14Regexp*Test.java"
  722. unless="jdk1.4+" />
  723. <exclude name="org/apache/tools/ant/taskdefs/optional/sitraka/*.java"
  724. unless="some.regexp.support" />
  725. <exclude name="org/apache/tools/ant/taskdefs/optional/sitraka/XMLReportTest.java"
  726. unless="trax.present" />
  727. <exclude name="org/apache/tools/ant/taskdefs/optional/XslpLiaisonTest.java"
  728. unless="xslp.present"/>
  729. <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java"
  730. unless="xalan.present"/>
  731. <exclude name="${optional.package}/TraXLiaisonTest.java"
  732. unless="trax.present"/>
  733. <exclude name="${optional.package}/perforce/*.java"
  734. unless="jakarta.oro.present" />
  735. <exclude name="org/apache/tools/ant/taskdefs/TestProcess.java"
  736. unless="jdk1.3+" />
  737. </javac>
  738. </target>
  739. <target name="dump-info" depends="dump-sys-properties,run-which" />
  740. <target name="dump-sys-properties" unless="which.present"
  741. depends="xml-check">
  742. <echo message="java.vm.info=${java.vm.info}" />
  743. <echo message="java.vm.name=${java.vm.name}" />
  744. <echo message="java.vm.vendor=${java.vm.vendor}" />
  745. <echo message="java.vm.version=${java.vm.version}" />
  746. <echo message="os.arch=${os.arch}" />
  747. <echo message="os.name=${os.name}" />
  748. <echo message="os.version=${os.version}" />
  749. <echo message="file.encoding=${file.encoding}" />
  750. <echo message="user.language=${user.language}" />
  751. </target>
  752. <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors -->
  753. <target name="xml-check" depends="check_for_optional_packages"
  754. if="xalan.envcheck" unless="which.present">
  755. <java classname="org.apache.xalan.xslt.EnvironmentCheck"/>
  756. </target>
  757. <target name="run-which" depends="check_for_optional_packages"
  758. if="which.present">
  759. <java classname="org.apache.env.Which" taskname="which"/>
  760. </target>
  761. <!--
  762. ===================================================================
  763. Run testcase
  764. ===================================================================
  765. -->
  766. <target name="test" depends="run-tests" description="--> run JUnit tests"/>
  767. <target name="run-tests" depends="dump-info,compile-tests" if="junit.present">
  768. <junit printsummary="no" haltonfailure="yes"
  769. filtertrace="${junit.filtertrace}"
  770. fork="${junit.fork}">
  771. <!-- <jvmarg value="-classic"/> -->
  772. <classpath refid="tests-classpath"/>
  773. <sysproperty key="ant.home" value="${ant.home}" />
  774. <sysproperty key="build.tests" value="${build.tests}"/>
  775. <sysproperty key="java.home" value="${java.home}" />
  776. <formatter type="brief" usefile="false" />
  777. <batchtest>
  778. <fileset dir="${tests.dir}">
  779. <exclude name="org/example/**" />
  780. <include name="**/*Test*" />
  781. <!-- abstract class, not a testcase -->
  782. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  783. <exclude name="org/apache/tools/ant/BuildFileTest.java" />
  784. <exclude name="${regexp.package}/RegexpMatcherTest.java" />
  785. <exclude name="${regexp.package}/RegexpTest.java" />
  786. <!-- helper classes, not testcases -->
  787. <exclude name="org/apache/tools/ant/taskdefs/TaskdefTest*Task.java" />
  788. <!-- these tests need to be localised before being ran???? -->
  789. <exclude name="org/apache/tools/ant/taskdefs/optional/PvcsTest.java" />
  790. <!-- only run these tests if their required libraries are installed -->
  791. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  792. unless="antlr.present" />
  793. <exclude name="${regexp.package}/JakartaRegexp*Test.java"
  794. unless="jakarta.regexp.present" />
  795. <exclude name="${regexp.package}/JakartaOro*Test.java"
  796. unless="jakarta.oro.present" />
  797. <exclude name="${regexp.package}/Jdk14Regexp*Test.java"
  798. unless="jdk1.4+" />
  799. <exclude name="${optional.package}/ide/VAJExportTest.java" unless="vaj.present" />
  800. <exclude name="${optional.package}/sitraka/*.java" unless="jakarta.oro.present" />
  801. <exclude name="${optional.package}/ReplaceRegExpTest.java"
  802. unless="some.regexp.support" />
  803. <exclude name="org/apache/tools/ant/taskdefs/optional/XslpLiaisonTest.java"
  804. unless="xslp.present"/>
  805. <exclude name="org/apache/tools/ant/taskdefs/optional/XalanLiaisonTest.java"
  806. unless="xalan.present"/>
  807. <exclude name="${optional.package}/perforce/*.java"
  808. unless="jakarta.oro.present" />
  809. <!-- it's an abstract class, not a test -->
  810. <exclude name="org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java" />
  811. <!-- ehm, this is not really a TraX test but rather a xalan2 test..-->
  812. <exclude name="org/apache/tools/ant/taskdefs/optional/TraXLiaisonTest.java" unless="xalan2.present"/>
  813. <!--
  814. XXX need to figure out what's causing this InvocationTargetException
  815. -->
  816. <exclude name="${optional.package}/junit/JUnitTestRunnerTest.java"
  817. unless="jdk1.2+" />
  818. <!-- interactive test -->
  819. <exclude name="org/apache/tools/ant/taskdefs/TestProcess.java" />
  820. <!-- This test only passes if SQLExecTest and SQLExec have
  821. been loaded by the same classloader - will throw
  822. IllegalAccessExceptions otherwise. -->
  823. <exclude name="org/apache/tools/ant/taskdefs/SQLExecTest.java"
  824. unless="run.sqlexec.test" />
  825. </fileset>
  826. </batchtest>
  827. </junit>
  828. </target>
  829. <target name="run-single-test" if="testcase" depends="compile-tests">
  830. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}"
  831. filtertrace="${junit.filtertrace}">
  832. <!-- <jvmarg value="-classic"/> -->
  833. <sysproperty key="ant.home" value="${ant.home}" />
  834. <sysproperty key="build.tests" value="${build.tests}"/>
  835. <sysproperty key="java.home" value="${java.home}" />
  836. <classpath location="${java.home}/lib/classes.zip" />
  837. <classpath refid="tests-classpath"/>
  838. <formatter type="plain" usefile="false" />
  839. <test name="${testcase}" />
  840. </junit>
  841. </target>
  842. <target name="interactive-tests" description="--> runs interactive tests"
  843. depends="compile-tests"
  844. if="jdk1.3+">
  845. <java classpathref="tests-classpath"
  846. classname="org.apache.tools.ant.taskdefs.TestProcess"
  847. fork="true" />
  848. </target>
  849. <!--
  850. ===================================================================
  851. Main target - runs dist-lite by default
  852. ===================================================================
  853. -->
  854. <target name="main"
  855. description="--> creates a minimum distribution in ./dist">
  856. <antcall inheritAll="false" target="dist-lite"/>
  857. </target>
  858. </project>