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

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