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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627
  1. <?xml version="1.0"?>
  2. <!--
  3. =======================================================================
  4. Apache Ant own build file
  5. Copyright (c) 2000-2003 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 environment="env"/>
  15. <property name="Name" value="Apache Ant"/>
  16. <property name="name" value="ant"/>
  17. <property name="version" value="1.6alpha"/>
  18. <property name="manifest-version" value="1.5.9"/>
  19. <property name="bootstrap.jar" value="ant-bootstrap.jar"/>
  20. <property name="debug" value="true"/>
  21. <property name="chmod.fail" value="true"/>
  22. <property name="deprecation" value="false"/>
  23. <property name="optimize" value="true"/>
  24. <property name="javac.target" value="1.1"/>
  25. <property name="junit.fork" value="false"/>
  26. <property name="junit.filtertrace" value="off"/>
  27. <property name="junit.summary" value="no"/>
  28. <!--
  29. ===================================================================
  30. Set the properties related to the source tree
  31. ===================================================================
  32. -->
  33. <property name="src.dir" value="src"/>
  34. <property name="java.dir" value="${src.dir}/main"/>
  35. <property name="script.dir" value="${src.dir}/script"/>
  36. <property name="lib.dir" value="lib"/>
  37. <property name="docs.dir" value="docs"/>
  38. <property name="etc.dir" value="src/etc"/>
  39. <property name="tests.dir" value="src/testcases"/>
  40. <property name="tests.etc.dir" value="src/etc/testcases"/>
  41. <property name="test.haltonfailure" value="yes" />
  42. <property name="ant.package" value="org/apache/tools/ant"/>
  43. <property name="optional.package" value="${ant.package}/taskdefs/optional"/>
  44. <property name="optional.type.package" value="${ant.package}/types/optional"/>
  45. <property name="apache.resolver.type.package" value="${ant.package}/types/resolver"/>
  46. <property name="util.package" value="${ant.package}/util"/>
  47. <property name="regexp.package" value="${util.package}/regexp"/>
  48. <property name="manifest" value="src/etc/manifest"/>
  49. <property name="unfiltered.files" value="**/*.gif,**/*.jpg,**/*.ico,**/*.pdf"/>
  50. <!--
  51. ===================================================================
  52. Set the properties for the build area
  53. ===================================================================
  54. -->
  55. <property name="build.dir" value="build"/>
  56. <property name="bootstrap.dir" value="bootstrap"/>
  57. <property name="build.classes" value="${build.dir}/classes"/>
  58. <property name="build.lib" value="${build.dir}/lib"/>
  59. <property name="build.javadocs" value="${build.dir}/javadocs"/>
  60. <property name="build.tests" value="${build.dir}/testcases"/>
  61. <property name="build.tests.javadocs" value="${build.dir}/javadocs.test/"/>
  62. <property name="manifest.tmp" value="${build.dir}/optional.manifest"/>
  63. <property name="optional.jars.prefix" value="ant"/>
  64. <path id="classpath">
  65. </path>
  66. <path id="tests-classpath">
  67. <pathelement location="${build.classes}"/>
  68. <pathelement location="${build.tests}"/>
  69. <!--
  70. include the test source and test data dirs
  71. so that we can pick resources via getResource(AsStream)
  72. -->
  73. <pathelement location="${tests.dir}"/>
  74. <pathelement location="${tests.etc.dir}"/>
  75. <path refid="classpath"/>
  76. </path>
  77. <!-- turn this path into a string which is passed to the tests -->
  78. <property name="tests-classpath.value"
  79. refid="tests-classpath"/>
  80. <!--
  81. ===================================================================
  82. Set up properties for the distribution area
  83. ===================================================================
  84. -->
  85. <property name="dist.name" value="apache-${name}-${version}"/>
  86. <property name="dist.base" value="distribution"/>
  87. <property name="dist.dir" value="dist"/>
  88. <property name="dist.bin" value="${dist.dir}/bin"/>
  89. <property name="dist.lib" value="${dist.dir}/lib"/>
  90. <property name="dist.docs" value="${dist.dir}/docs"/>
  91. <property name="dist.etc" value="${dist.dir}/etc"/>
  92. <property name="dist.javadocs" value="${dist.dir}/docs/manual/api"/>
  93. <property name="src.dist.dir" value="dist-src"/>
  94. <property name="src.dist.src" value="${src.dist.dir}/src"/>
  95. <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
  96. <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
  97. <!--
  98. ===================================================================
  99. Set up selectors to be used by javac, junit and jar to exclude
  100. files that have dependencies that are not available
  101. ===================================================================
  102. -->
  103. <!-- depends on JDK version -->
  104. <selector id="needs.jdk1.3+">
  105. <or>
  106. <filename name="${ant.package}/taskdefs/TestProcess*"/>
  107. <filename name="${optional.package}/extension/**"/>
  108. </or>
  109. </selector>
  110. <selector id="needs.jdk1.4+">
  111. <or>
  112. <filename name="${regexp.package}/Jdk14Regexp*"/>
  113. </or>
  114. </selector>
  115. <!-- classes that should be present in Sun based JVMs, but not in
  116. Kaffe for example -->
  117. <selector id="needs.sun.tools">
  118. <or>
  119. <filename name="${optional.package}/Native2Ascii*"/>
  120. <filename name="${optional.package}/Javah*"/>
  121. </or>
  122. </selector>
  123. <selector id="needs.sun.uue">
  124. <filename name="${ant.package}/taskdefs/email/UUMailer*"/>
  125. </selector>
  126. <selector id="needs.sun.b64">
  127. <or>
  128. <filename name="${optional.package}/splash/SplashTask*"/>
  129. </or>
  130. </selector>
  131. <!-- depends on external libraries -->
  132. <selector id="needs.trax">
  133. <or>
  134. <filename name="${optional.package}/TraXLiaison*"/>
  135. <filename name="${optional.package}/sitraka/**"/>
  136. <filename name="${optional.package}/metamata/MMetrics*"/>
  137. <filename name="${optional.package}/XsltTest*"/>
  138. <filename name="${ant.package}/types/XMLCatalogBuildFileTest*"/>
  139. </or>
  140. </selector>
  141. <selector id="needs.xalan1">
  142. <or>
  143. <filename name="${optional.package}/XalanLiaison*"/>
  144. <filename name="${optional.package}/junit/Xalan1Executor*"/>
  145. </or>
  146. </selector>
  147. <selector id="needs.xalan2">
  148. <filename name="${optional.package}/junit/Xalan2Executor*"/>
  149. </selector>
  150. <selector id="needs.xslp">
  151. <filename name="${optional.package}/XslpLiaison*"/>
  152. </selector>
  153. <selector id="needs.apache.resolver">
  154. <filename name="${apache.resolver.type.package}/**"/>
  155. </selector>
  156. <selector id="needs.junit">
  157. <filename name="${optional.package}/junit/**"/>
  158. </selector>
  159. <selector id="needs.jakarta.regexp">
  160. <filename name="${regexp.package}/JakartaRegexp*"/>
  161. </selector>
  162. <selector id="needs.jakarta.oro">
  163. <or>
  164. <filename name="${regexp.package}/JakartaOro*"/>
  165. <filename name="${optional.package}/perforce/*"/>
  166. <filename name="${optional.package}/metamata/MAudit*"/>
  167. </or>
  168. </selector>
  169. <selector id="needs.jakarta.bcel">
  170. <or>
  171. <filename name="${ant.package}/filters/util/JavaClassHelper*"/>
  172. <filename name="${util.package}/depend/bcel/*"/>
  173. <filename name="${optional.type.package}/depend/ClassFileSetTest*"/>
  174. </or>
  175. </selector>
  176. <selector id="needs.jakarta.log4j">
  177. <filename name="${ant.package}/listener/Log4jListener*"/>
  178. </selector>
  179. <selector id="needs.commons.logging">
  180. <filename name="${ant.package}/listener/CommonsLoggingListener*"/>
  181. </selector>
  182. <selector id="needs.bsf">
  183. <or>
  184. <filename name="${optional.package}/Script*"/>
  185. <filename name="${optional.type.package}/Script*"/>
  186. </or>
  187. </selector>
  188. <selector id="needs.stylebook">
  189. <filename name="${optional.package}/StyleBook*"/>
  190. </selector>
  191. <selector id="needs.javamail">
  192. <filename name="${ant.package}/taskdefs/email/MimeMailer*"/>
  193. </selector>
  194. <selector id="needs.icontract">
  195. <filename name="${optional.package}/IContract*"/>
  196. </selector>
  197. <selector id="needs.netrexx">
  198. <filename name="${optional.package}/NetRexxC*"/>
  199. </selector>
  200. <selector id="needs.weblogic.ejbc">
  201. <filename name="${optional.package}/ejb/Ejbc*"/>
  202. </selector>
  203. <selector id="needs.weblogic.ddcreator">
  204. <filename name="${optional.package}/ejb/DDCreator*"/>
  205. </selector>
  206. <selector id="needs.weblogic.server">
  207. <or>
  208. <filename name="${optional.package}/ejb/WLRun*"/>
  209. <filename name="${optional.package}/ejb/WLStop*"/>
  210. </or>
  211. </selector>
  212. <selector id="needs.commons.net">
  213. <or>
  214. <filename name="${optional.package}/net/FTP*"/>
  215. <filename name="${optional.package}/net/TelnetTask*"/>
  216. </or>
  217. </selector>
  218. <selector id="needs.starteam">
  219. <or>
  220. <filename name="${optional.package}/scm/AntStarTeam*"/>
  221. <filename name="${optional.package}/starteam/*"/>
  222. </or>
  223. </selector>
  224. <selector id="needs.vaj">
  225. <filename name="${optional.package}/ide/VAJ*"/>
  226. </selector>
  227. <selector id="needs.antlr">
  228. <filename name="${optional.package}/ANTLR*"/>
  229. </selector>
  230. <selector id="needs.jmf">
  231. <filename name="${optional.package}/sound/*"/>
  232. </selector>
  233. <selector id="needs.jai">
  234. <or>
  235. <filename name="${optional.package}/image/*"/>
  236. <filename name="${ant.package}/types/optional/image/*"/>
  237. </or>
  238. </selector>
  239. <selector id="needs.jdepend">
  240. <filename name="${optional.package}/jdepend/*"/>
  241. </selector>
  242. <selector id="needs.swing">
  243. <filename name="${optional.package}/splash/*"/>
  244. </selector>
  245. <selector id="needs.jsch">
  246. <filename name="${optional.package}/ssh/*"/>
  247. </selector>
  248. <patternset id="onlinetests">
  249. <exclude name="**/GetTest.java" if="offline"/>
  250. <exclude name="**/SignJarTest.java" if="offline"/>
  251. </patternset>
  252. <patternset id="teststhatfail">
  253. <exclude name="${optional.package}/BeanShellScriptTest.java"/>
  254. <exclude name="${ant.package}/taskdefs/ImportTest.java"/>
  255. </patternset>
  256. <!--
  257. ===================================================================
  258. Set up a patternsets that matches the parts of our JUnit testsuite
  259. that may be useful for task developers.
  260. ===================================================================
  261. -->
  262. <patternset id="useful.tests">
  263. <include name="${ant.package}/BuildFileTest*"/>
  264. <include name="${regexp.package}/RegexpMatcherTest*"/>
  265. <include name="${regexp.package}/RegexpTest*"/>
  266. <include name="${optional.package}/AbstractXSLTLiaisonTest*"/>
  267. <include name="${ant.package}/types/AbstractFileSetTest*"/>
  268. </patternset>
  269. <!--
  270. ===================================================================
  271. Set up a patternsets that matches the parts of our site that
  272. should not be part of the distribution.
  273. ===================================================================
  274. -->
  275. <patternset id="site.excludes">
  276. <exclude name="bindownload.html"/>
  277. <exclude name="srcdownload.html"/>
  278. <exclude name="*.cgi"/>
  279. </patternset>
  280. <!--
  281. ===================================================================
  282. Check to see what optional dependencies are available
  283. ===================================================================
  284. -->
  285. <target name="check_for_optional_packages">
  286. <available property="jdk1.3+" classname="java.lang.StrictMath"/>
  287. <available property="jdk1.4+" classname="java.lang.CharSequence"/>
  288. <available property="kaffe" classname="kaffe.util.NotImplemented"/>
  289. <available property="bsf.present"
  290. classname="org.apache.bsf.BSFManager"
  291. classpathref="classpath"/>
  292. <available property="netrexx.present"
  293. classname="netrexx.lang.Rexx"
  294. classpathref="classpath"/>
  295. <available property="trax.present"
  296. classname="javax.xml.transform.Transformer"
  297. classpathref="classpath"/>
  298. <condition property="trax.impl.present">
  299. <or>
  300. <and>
  301. <isset property="javax.xml.transform.TransformerFactory"/>
  302. <available classname="${javax.xml.transform.TransformerFactory}"
  303. classpathref="classpath"/>
  304. </and>
  305. <available resource="META-INF/services/javax.xml.transform.TransformerFactory"/>
  306. </or>
  307. </condition>
  308. <available property="xslp.present"
  309. classname="com.kvisco.xsl.XSLProcessor"
  310. classpathref="classpath"/>
  311. <available property="apache.resolver.present"
  312. classname="org.apache.xml.resolver.tools.CatalogResolver"
  313. classpathref="classpath" />
  314. <available property="xalan.present"
  315. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  316. classpathref="classpath"/>
  317. <available property="xalan2.present"
  318. classname="org.apache.xalan.transformer.TransformerImpl"
  319. classpathref="classpath"/>
  320. <available property="ejb.ejbc.present"
  321. classname="weblogic.ejbc"
  322. classpathref="classpath"/>
  323. <available property="ejb.DDCreator.present"
  324. classname="weblogic.ejb.utils.DDCreator"
  325. classpathref="classpath"/>
  326. <available property="ejb.wls.present"
  327. classname="weblogic.Server"
  328. classpathref="classpath"/>
  329. <available property="junit.present"
  330. classname="junit.framework.TestCase"
  331. classpathref="classpath"/>
  332. <available property="commons.net.present"
  333. classname="org.apache.commons.net.ftp.FTPClient"
  334. classpathref="classpath"/>
  335. <available property="starteam.present"
  336. classname="com.starbase.util.Platform"
  337. classpathref="classpath"/>
  338. <available property="antlr.present"
  339. classname="antlr.Tool"
  340. classpathref="classpath"/>
  341. <available property="vaj.present"
  342. classname="com.ibm.ivj.util.base.Workspace"
  343. classpathref="classpath"/>
  344. <available property="stylebook.present"
  345. classname="org.apache.stylebook.Engine"
  346. classpathref="classpath"/>
  347. <available property="jakarta.regexp.present"
  348. classname="org.apache.regexp.RE"
  349. classpathref="classpath"/>
  350. <available property="jakarta.oro.present"
  351. classname="org.apache.oro.text.regex.Perl5Matcher"
  352. classpathref="classpath"/>
  353. <available property="jmf.present"
  354. classname="javax.sound.sampled.Clip"
  355. classpathref="classpath"/>
  356. <available property="jai.present"
  357. classname="javax.media.jai.JAI"
  358. classpathref="classpath"/>
  359. <available property="icontract.present"
  360. classname="com.reliablesystems.iContract.IContracted"
  361. classpathref="classpath"/>
  362. <available property="jdepend.present"
  363. classname="jdepend.framework.JDepend"
  364. classpathref="classpath"/>
  365. <available property="log4j.present"
  366. classname="org.apache.log4j.Category"
  367. classpathref="classpath"/>
  368. <available property="commons.logging.present"
  369. classname="org.apache.commons.logging.LogFactory"
  370. classpathref="classpath"/>
  371. <available property="xalan.envcheck"
  372. classname="org.apache.xalan.xslt.EnvironmentCheck"
  373. classpathref="classpath"/>
  374. <available property="which.present"
  375. classname="org.apache.env.Which"
  376. classpathref="classpath"/>
  377. <available property="xerces.present"
  378. classname="org.apache.xerces.parsers.SAXParser"
  379. classpathref="classpath"/>
  380. <available property="bcel.present"
  381. classname="org.apache.bcel.Constants"
  382. classpathref="classpath"/>
  383. <available property="sunuue.present"
  384. classname="sun.misc.UUEncoder"
  385. classpathref="classpath"/>
  386. <condition property="javamail.complete">
  387. <and>
  388. <available classname="javax.activation.DataHandler"
  389. classpathref="classpath"/>
  390. <available classname="javax.mail.Transport"
  391. classpathref="classpath"/>
  392. </and>
  393. </condition>
  394. <condition property="some.regexp.support">
  395. <or>
  396. <isset property="jdk1.4+"/>
  397. <isset property="jakarta.regexp.present"/>
  398. <isset property="jakarta.oro.present"/>
  399. </or>
  400. </condition>
  401. <condition property="tests.and.ant.share.classloader">
  402. <or>
  403. <equals arg1="${junit.fork}" arg2="true"/>
  404. <equals arg1="${build.sysclasspath}" arg2="only"/>
  405. </or>
  406. </condition>
  407. <condition property="sun.tools.present">
  408. <and>
  409. <available classname="sun.tools.native2ascii.Main"/>
  410. <available classname="com.sun.tools.javah.Main"/>
  411. </and>
  412. </condition>
  413. <available property="base64.present" classname="sun.misc.BASE64Encoder"/>
  414. <property name="build.tests.resolved" location="${build.tests}"/>
  415. <condition property="tests.are.on.system.classpath">
  416. <or>
  417. <!-- relative paths in CLASSPATH -->
  418. <contains string="${java.class.path}"
  419. substring="${build.tests}"/>
  420. <!-- absolute paths in CLASSPATH -->
  421. <contains string="${java.class.path}"
  422. substring="${build.tests.resolved}"/>
  423. </or>
  424. </condition>
  425. <condition property="jasper.present">
  426. <and>
  427. <available classname="org.apache.jasper.compiler.Compiler"/>
  428. <available classname="org.apache.jasper.JasperException"/>
  429. </and>
  430. </condition>
  431. <condition property="swing.present">
  432. <or>
  433. <not>
  434. <isset property="kaffe"/>
  435. </not>
  436. <available classname="javax.swing.ImageIcon"
  437. classpathref="classpath"/>
  438. </or>
  439. </condition>
  440. <condition property="wsdl.found">
  441. <or>
  442. <available file="wsdl" filepath="${env.PATH}"/>
  443. <available file="wsdl.exe" filepath="${env.PATH}"/>
  444. <available file="wsdl.exe" filepath="${env.Path}"/>
  445. </or>
  446. </condition>
  447. <echo level="verbose"> wsdl.found=${wsdl.found}</echo>
  448. <condition property="csc.found">
  449. <or>
  450. <available file="csc" filepath="${env.PATH}"/>
  451. <available file="csc.exe" filepath="${env.PATH}"/>
  452. <available file="csc.exe" filepath="${env.Path}"/>
  453. </or>
  454. </condition>
  455. <echo level="verbose"> csc.found=${csc.found}</echo>
  456. <condition property="dotnetapps.found">
  457. <and>
  458. <isset property="csc.found"/>
  459. <isset property="wsdl.found"/>
  460. </and>
  461. </condition>
  462. <echo level="verbose"> dotnetapps.found=${dotnetapps.found}</echo>
  463. <available property="rhino.present"
  464. classname="org.mozilla.javascript.Scriptable"
  465. classpathref="classpath"/>
  466. <available property="beanshell.present"
  467. classname="bsh.StringUtil"
  468. classpathref="classpath"/>
  469. <available property="jsch.present"
  470. classname="com.jcraft.jsch.Session"
  471. classpathref="classpath"/>
  472. </target>
  473. <!--
  474. ===================================================================
  475. Prepare the build
  476. ===================================================================
  477. -->
  478. <target name="prepare">
  479. <tstamp>
  480. <format property="year" pattern="yyyy"/>
  481. </tstamp>
  482. <filterchain id="ant.filters">
  483. <replacetokens>
  484. <token key="VERSION" value="${version}"/>
  485. <token key="DATE" value="${TODAY}"/>
  486. <token key="TIME" value="${TSTAMP}"/>
  487. </replacetokens>
  488. </filterchain>
  489. </target>
  490. <!--
  491. ===================================================================
  492. Build the code
  493. ===================================================================
  494. -->
  495. <target name="build"
  496. depends="prepare, check_for_optional_packages"
  497. description="--> compiles the source code">
  498. <mkdir dir="${build.dir}"/>
  499. <mkdir dir="${build.classes}"/>
  500. <mkdir dir="${build.lib}"/>
  501. <javac srcdir="${java.dir}"
  502. destdir="${build.classes}"
  503. debug="${debug}"
  504. deprecation="${deprecation}"
  505. target="${javac.target}"
  506. optimize="${optimize}" >
  507. <classpath refid="classpath"/>
  508. <selector id="conditional-patterns">
  509. <not>
  510. <or>
  511. <selector refid="needs.jdk1.3+" unless="jdk1.3+"/>
  512. <selector refid="needs.jdk1.4+" unless="jdk1.4+"/>
  513. <selector refid="needs.sun.tools" unless="sun.tools.present"/>
  514. <selector refid="needs.sun.uue" unless="sunuue.present"/>
  515. <selector refid="needs.sun.b64" unless="base64.present"/>
  516. <selector refid="needs.trax" unless="trax.present"/>
  517. <selector refid="needs.xalan1" unless="xalan.present"/>
  518. <selector refid="needs.xalan2" unless="xalan2.present"/>
  519. <selector refid="needs.xslp" unless="xslp.present"/>
  520. <selector refid="needs.apache.resolver" unless="apache.resolver.present"/>
  521. <selector refid="needs.junit" unless="junit.present"/>
  522. <selector refid="needs.jakarta.regexp"
  523. unless="jakarta.regexp.present"/>
  524. <selector refid="needs.jakarta.oro" unless="jakarta.oro.present"/>
  525. <selector refid="needs.jakarta.bcel" unless="bcel.present"/>
  526. <selector refid="needs.jakarta.log4j" unless="log4j.present"/>
  527. <selector refid="needs.commons.logging"
  528. unless="commons.logging.present"/>
  529. <selector refid="needs.bsf" unless="bsf.present"/>
  530. <selector refid="needs.stylebook" unless="stylebook.present"/>
  531. <selector refid="needs.javamail" unless="javamail.complete"/>
  532. <selector refid="needs.icontract" unless="icontract.present"/>
  533. <selector refid="needs.netrexx" unless="netrexx.present"/>
  534. <selector refid="needs.weblogic.ejbc" unless="ejb.ejbc.present"/>
  535. <selector refid="needs.weblogic.ddcreator"
  536. unless="ejb.DDCreator.present"/>
  537. <selector refid="needs.weblogic.server" unless="ejb.wls.present"/>
  538. <selector refid="needs.commons.net" unless="commons.net.present"/>
  539. <selector refid="needs.starteam" unless="starteam.present"/>
  540. <selector refid="needs.vaj" unless="vaj.present"/>
  541. <selector refid="needs.antlr" unless="antlr.present"/>
  542. <selector refid="needs.jmf" unless="jmf.present"/>
  543. <selector refid="needs.jai" unless="jai.present"/>
  544. <selector refid="needs.jdepend" unless="jdepend.present"/>
  545. <selector refid="needs.swing" unless="swing.present"/>
  546. <selector refid="needs.jsch" unless="jsch.present"/>
  547. </or>
  548. </not>
  549. </selector>
  550. </javac>
  551. <copy todir="${build.classes}">
  552. <fileset dir="${java.dir}">
  553. <include name="**/*.properties"/>
  554. <include name="**/*.dtd"/>
  555. </fileset>
  556. </copy>
  557. <copy todir="${build.classes}"
  558. overwrite="true" encoding="UTF-8">
  559. <fileset dir="${java.dir}">
  560. <include name="**/version.txt"/>
  561. <include name="**/defaultManifest.mf"/>
  562. </fileset>
  563. <filterchain refid="ant.filters"/>
  564. </copy>
  565. <copy todir="${build.classes}/${optional.package}/junit/xsl">
  566. <fileset dir="${etc.dir}">
  567. <include name="junit-frames.xsl"/>
  568. <include name="junit-noframes.xsl"/>
  569. </fileset>
  570. </copy>
  571. </target>
  572. <!--
  573. ===================================================================
  574. Create the Apache Ant jars: ant.jar and optional.jar
  575. ===================================================================
  576. -->
  577. <target name="jars"
  578. depends="build"
  579. description="--> creates the Apache Ant jars">
  580. <copy todir="${build.dir}">
  581. <fileset dir=".">
  582. <include name="LICENSE"/>
  583. <include name="LICENSE.xerces"/>
  584. <include name="LICENSE.dom"/>
  585. <include name="LICENSE.sax"/>
  586. </fileset>
  587. <mapper type="glob" from="*" to="*.txt"/>
  588. </copy>
  589. <copy file="${manifest}" tofile="${manifest.tmp}"/>
  590. <manifest file="${manifest.tmp}">
  591. <section name="${optional.package}/">
  592. <attribute name="Extension-name"
  593. value="org.apache.tools.ant"/>
  594. <attribute name="Specification-Title"
  595. value="Apache Ant"/>
  596. <attribute name="Specification-Version"
  597. value="${manifest-version}"/>
  598. <attribute name="Specification-Vendor"
  599. value="Apache Software Foundation"/>
  600. <attribute name="Implementation-Title"
  601. value="org.apache.tools.ant"/>
  602. <attribute name="Implementation-Version"
  603. value="${manifest-version}"/>
  604. <attribute name="Implementation-Vendor"
  605. value="Apache Software Foundation"/>
  606. </section>
  607. </manifest>
  608. <jar destfile="${build.lib}/${name}.jar"
  609. basedir="${build.classes}"
  610. manifest="${manifest}">
  611. <not>
  612. <selector id="non-core">
  613. <or>
  614. <filename name="${optional.package}/**"/>
  615. <filename name="${optional.type.package}/**"/>
  616. <filename name="${util.package}/depend/**"/>
  617. <filename name="${util.package}/optional/**"/>
  618. <selector refid="needs.jakarta.log4j"/>
  619. <selector refid="needs.commons.logging"/>
  620. <selector refid="needs.jakarta.regexp"/>
  621. <selector refid="needs.jakarta.oro"/>
  622. <selector refid="needs.jdk1.4+"/>
  623. <selector refid="needs.javamail"/>
  624. </or>
  625. </selector>
  626. </not>
  627. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  628. <manifest>
  629. <section name="${ant.package}/">
  630. <attribute name="Extension-name"
  631. value="org.apache.tools.ant"/>
  632. <attribute name="Specification-Title"
  633. value="Apache Ant"/>
  634. <attribute name="Specification-Version"
  635. value="${manifest-version}"/>
  636. <attribute name="Specification-Vendor"
  637. value="Apache Software Foundation"/>
  638. <attribute name="Implementation-Title"
  639. value="org.apache.tools.ant"/>
  640. <attribute name="Implementation-Version"
  641. value="${manifest-version}"/>
  642. <attribute name="Implementation-Vendor"
  643. value="Apache Software Foundation"/>
  644. </section>
  645. </manifest>
  646. <fileset dir="${docs.dir}">
  647. <include name="images/ant_logo_large.gif"/>
  648. </fileset>
  649. </jar>
  650. <jar destfile="${build.lib}/optional.jar"
  651. basedir="${build.classes}"
  652. manifest="${manifest.tmp}">
  653. <selector refid="non-core"/>
  654. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  655. </jar>
  656. <jar destfile="${build.lib}/${bootstrap.jar}"
  657. basedir="${build.classes}"
  658. manifest="${manifest}">
  659. <include name="${ant.package}/Main.class"/>
  660. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  661. <manifest>
  662. <attribute name="Class-Path"
  663. value="ant.jar xml-apis.jar xercesImpl.jar optional.jar xalan.jar"/>
  664. </manifest>
  665. </jar>
  666. <jar destfile="${build.lib}/nodeps.jar"
  667. basedir="${build.classes}"
  668. manifest="${manifest.tmp}">
  669. <and>
  670. <selector refid="non-core"/>
  671. <not>
  672. <or>
  673. <selector refid="needs.trax"/>
  674. <selector refid="needs.xalan1"/>
  675. <selector refid="needs.xalan2"/>
  676. <selector refid="needs.xslp"/>
  677. <selector refid="needs.apache.resolver"/>
  678. <selector refid="needs.junit"/>
  679. <selector refid="needs.jakarta.regexp"/>
  680. <selector refid="needs.jakarta.oro"/>
  681. <selector refid="needs.jakarta.bcel"/>
  682. <selector refid="needs.jakarta.log4j"/>
  683. <selector refid="needs.commons.logging"/>
  684. <selector refid="needs.bsf"/>
  685. <selector refid="needs.stylebook"/>
  686. <selector refid="needs.javamail"/>
  687. <selector refid="needs.icontract"/>
  688. <selector refid="needs.netrexx"/>
  689. <selector refid="needs.weblogic.ejbc"/>
  690. <selector refid="needs.weblogic.ddcreator"/>
  691. <selector refid="needs.weblogic.server"/>
  692. <selector refid="needs.commons.net"/>
  693. <selector refid="needs.starteam"/>
  694. <selector refid="needs.vaj"/>
  695. <selector refid="needs.antlr"/>
  696. <selector refid="needs.jmf"/>
  697. <selector refid="needs.jai"/>
  698. <selector refid="needs.jdepend"/>
  699. <selector refid="needs.swing"/>
  700. <selector refid="needs.jsch"/>
  701. </or>
  702. </not>
  703. </and>
  704. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  705. </jar>
  706. <jar destfile="${build.lib}/${optional.jars.prefix}-trax.jar"
  707. basedir="${build.classes}"
  708. manifest="${manifest.tmp}">
  709. <selector refid="needs.trax"/>
  710. </jar>
  711. <jar destfile="${build.lib}/${optional.jars.prefix}-xalan1.jar"
  712. basedir="${build.classes}"
  713. manifest="${manifest.tmp}">
  714. <selector refid="needs.xalan1"/>
  715. </jar>
  716. <jar destfile="${build.lib}/${optional.jars.prefix}-xalan2.jar"
  717. basedir="${build.classes}"
  718. manifest="${manifest.tmp}">
  719. <selector refid="needs.xalan2"/>
  720. </jar>
  721. <jar destfile="${build.lib}/${optional.jars.prefix}-xslp.jar"
  722. basedir="${build.classes}"
  723. manifest="${manifest.tmp}">
  724. <selector refid="needs.xslp"/>
  725. </jar>
  726. <jar destfile="${build.lib}/${optional.jars.prefix}-apache-resolver.jar"
  727. basedir="${build.classes}"
  728. manifest="${manifest.tmp}">
  729. <selector refid="needs.apache.resolver"/>
  730. </jar>
  731. <jar destfile="${build.lib}/${optional.jars.prefix}-junit.jar"
  732. basedir="${build.classes}"
  733. manifest="${manifest.tmp}">
  734. <selector refid="needs.junit"/>
  735. </jar>
  736. <jar destfile="${build.lib}/${optional.jars.prefix}-jakarta-regexp.jar"
  737. basedir="${build.classes}" manifest="${manifest.tmp}">
  738. <selector refid="needs.jakarta.regexp"/>
  739. </jar>
  740. <jar destfile="${build.lib}/${optional.jars.prefix}-oro.jar"
  741. basedir="${build.classes}"
  742. manifest="${manifest.tmp}">
  743. <selector refid="needs.jakarta.oro"/>
  744. </jar>
  745. <jar destfile="${build.lib}/${optional.jars.prefix}-bcel.jar"
  746. basedir="${build.classes}"
  747. manifest="${manifest.tmp}">
  748. <selector refid="needs.jakarta.bcel"/>
  749. </jar>
  750. <jar destfile="${build.lib}/${optional.jars.prefix}-log4j.jar"
  751. basedir="${build.classes}"
  752. manifest="${manifest.tmp}">
  753. <selector refid="needs.jakarta.log4j"/>
  754. </jar>
  755. <jar destfile="${build.lib}/${optional.jars.prefix}-commons-logging.jar"
  756. basedir="${build.classes}" manifest="${manifest.tmp}">
  757. <selector refid="needs.commons.logging"/>
  758. </jar>
  759. <jar destfile="${build.lib}/${optional.jars.prefix}-apache-bsf.jar"
  760. basedir="${build.classes}"
  761. manifest="${manifest.tmp}">
  762. <selector refid="needs.bsf"/>
  763. </jar>
  764. <jar destfile="${build.lib}/${optional.jars.prefix}-stylebook.jar"
  765. basedir="${build.classes}"
  766. manifest="${manifest.tmp}">
  767. <selector refid="needs.stylebook"/>
  768. </jar>
  769. <jar destfile="${build.lib}/${optional.jars.prefix}-javamail.jar"
  770. basedir="${build.classes}"
  771. manifest="${manifest.tmp}">
  772. <selector refid="needs.javamail"/>
  773. </jar>
  774. <jar destfile="${build.lib}/${optional.jars.prefix}-icontract.jar"
  775. basedir="${build.classes}"
  776. manifest="${manifest.tmp}">
  777. <selector refid="needs.icontract"/>
  778. </jar>
  779. <jar destfile="${build.lib}/${optional.jars.prefix}-netrexx.jar"
  780. basedir="${build.classes}"
  781. manifest="${manifest.tmp}">
  782. <selector refid="needs.netrexx"/>
  783. </jar>
  784. <jar destfile="${build.lib}/${optional.jars.prefix}-commons-net.jar"
  785. basedir="${build.classes}"
  786. manifest="${manifest.tmp}">
  787. <selector refid="needs.commons.net"/>
  788. </jar>
  789. <jar destfile="${build.lib}/${optional.jars.prefix}-starteam.jar"
  790. basedir="${build.classes}"
  791. manifest="${manifest.tmp}">
  792. <selector refid="needs.starteam"/>
  793. </jar>
  794. <jar destfile="${build.lib}/${optional.jars.prefix}-vaj.jar"
  795. basedir="${build.classes}"
  796. manifest="${manifest.tmp}">
  797. <selector refid="needs.vaj"/>
  798. </jar>
  799. <jar destfile="${build.lib}/${optional.jars.prefix}-antlr.jar"
  800. basedir="${build.classes}"
  801. manifest="${manifest.tmp}">
  802. <selector refid="needs.antlr"/>
  803. </jar>
  804. <jar destfile="${build.lib}/${optional.jars.prefix}-jmf.jar"
  805. basedir="${build.classes}"
  806. manifest="${manifest.tmp}">
  807. <selector refid="needs.jmf"/>
  808. </jar>
  809. <jar destfile="${build.lib}/${optional.jars.prefix}-jai.jar"
  810. basedir="${build.classes}"
  811. manifest="${manifest.tmp}">
  812. <selector refid="needs.jai"/>
  813. </jar>
  814. <jar destfile="${build.lib}/${optional.jars.prefix}-swing.jar"
  815. basedir="${build.classes}"
  816. manifest="${manifest.tmp}">
  817. <selector refid="needs.swing"/>
  818. </jar>
  819. <jar destfile="${build.lib}/${optional.jars.prefix}-jdepend.jar"
  820. basedir="${build.classes}"
  821. manifest="${manifest.tmp}">
  822. <selector refid="needs.jdepend"/>
  823. </jar>
  824. <jar destfile="${build.lib}/${optional.jars.prefix}-weblogic.jar"
  825. basedir="${build.classes}"
  826. manifest="${manifest.tmp}">
  827. <or>
  828. <selector refid="needs.weblogic.ejbc"/>
  829. <selector refid="needs.weblogic.ddcreator" />
  830. <selector refid="needs.weblogic.server"/>
  831. </or>
  832. </jar>
  833. <jar destfile="${build.lib}/${optional.jars.prefix}-jsch.jar"
  834. basedir="${build.classes}"
  835. manifest="${manifest.tmp}">
  836. <selector refid="needs.jsch"/>
  837. </jar>
  838. </target>
  839. <!-- Creates jar of test utility classes -->
  840. <target name="test-jar"
  841. depends="compile-tests"
  842. description="--> creates the Apache Ant Test Utilties jar">
  843. <jar destfile="${build.lib}/${name}-testutil.jar"
  844. basedir="${build.tests}">
  845. <patternset refid="useful.tests"/>
  846. </jar>
  847. </target>
  848. <!--
  849. ===================================================================
  850. Create the essential distribution that can run Apache Ant
  851. ===================================================================
  852. -->
  853. <target name="dist-lite"
  854. depends="jars"
  855. description="--> creates a minimum distribution to run Apache Ant">
  856. <mkdir dir="${dist.dir}"/>
  857. <mkdir dir="${dist.bin}"/>
  858. <mkdir dir="${dist.lib}"/>
  859. <copy todir="${dist.lib}">
  860. <fileset dir="${build.lib}">
  861. <exclude name="${bootstrap.jar}"/>
  862. </fileset>
  863. </copy>
  864. <copy todir="${dist.bin}">
  865. <fileset dir="${script.dir}/"/>
  866. </copy>
  867. <fixcrlf srcdir="${dist.bin}" eol="dos" includes="*.bat,*.cmd"/>
  868. <fixcrlf srcdir="${dist.bin}" eol="unix">
  869. <include name="ant"/>
  870. <include name="antRun"/>
  871. <include name="*.pl"/>
  872. </fixcrlf>
  873. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
  874. failonerror="${chmod.fail}"/>
  875. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
  876. failonerror="${chmod.fail}"/>
  877. <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
  878. <fileset dir="${dist.bin}">
  879. <include name="**/ant"/>
  880. <include name="**/antRun"/>
  881. <include name="**/*.pl"/>
  882. <include name="**/*.py"/>
  883. </fileset>
  884. </chmod>
  885. </target>
  886. <!--
  887. ===================================================================
  888. Create the complete distribution
  889. ===================================================================
  890. -->
  891. <target name="dist" description="--> creates a complete distribution">
  892. <antcall inheritAll="false" target="internal_dist">
  893. <param name="dist.dir" value="${dist.name}"/>
  894. </antcall>
  895. </target>
  896. <target name="dist_javadocs" depends="javadocs">
  897. <mkdir dir="${dist.javadocs}"/>
  898. <copy todir="${dist.javadocs}" overwrite="true">
  899. <fileset dir="${build.javadocs}"/>
  900. </copy>
  901. </target>
  902. <target name="internal_dist" depends="dist-lite,dist_javadocs">
  903. <mkdir dir="${dist.docs}"/>
  904. <mkdir dir="${dist.etc}"/>
  905. <copy todir="${dist.lib}">
  906. <fileset dir="${lib.dir}">
  907. <include name="*.jar"/>
  908. <include name="*.zip"/>
  909. </fileset>
  910. </copy>
  911. <copy todir="${dist.lib}" file="${lib.dir}/README"/>
  912. <copy todir="${dist.docs}">
  913. <fileset dir="${docs.dir}" excludes="${unfiltered.files}">
  914. <patternset refid="site.excludes"/>
  915. </fileset>
  916. <filterchain refid="ant.filters"/>
  917. </copy>
  918. <copy todir="${dist.docs}" filtering="false">
  919. <fileset dir="${docs.dir}" includes="${unfiltered.files}">
  920. <patternset refid="site.excludes"/>
  921. </fileset>
  922. </copy>
  923. <copy todir="${dist.dir}">
  924. <fileset dir=".">
  925. <include name="README"/>
  926. <include name="LICENSE"/>
  927. <include name="LICENSE.xerces"/>
  928. <include name="LICENSE.dom"/>
  929. <include name="LICENSE.sax"/>
  930. <include name="TODO"/>
  931. <include name="WHATSNEW"/>
  932. <include name="KEYS"/>
  933. <include name="welcome.html"/>
  934. </fileset>
  935. </copy>
  936. <chmod perm="ugo+rx" dir="${dist.dir}" type="dir" includes="**"
  937. failonerror="${chmod.fail}"/>
  938. <chmod perm="ugo+r" dir="${dist.dir}" type="file" includes="**"
  939. failonerror="${chmod.fail}"/>
  940. <chmod perm="ugo+x" type="file" failonerror="${chmod.fail}">
  941. <fileset dir="${dist.bin}">
  942. <include name="**/ant"/>
  943. <include name="**/antRun"/>
  944. <include name="**/*.pl"/>
  945. <include name="**/*.py"/>
  946. </fileset>
  947. </chmod>
  948. <!-- publish some useful stylesheets -->
  949. <copy todir="${dist.etc}">
  950. <fileset dir="${etc.dir}">
  951. <include name="junit-frames.xsl"/>
  952. <include name="junit-noframes.xsl"/>
  953. <include name="coverage-frames.xsl"/>
  954. <include name="maudit-frames.xsl"/>
  955. <include name="mmetrics-frames.xsl"/>
  956. <include name="changelog.xsl"/>
  957. <include name="jdepend.xsl"/>
  958. <include name="jdepend-frames.xsl"/>
  959. <include name="checkstyle-frames.xsl"/>
  960. <include name="log.xsl"/>
  961. <include name="tagdiff.xsl"/>
  962. </fileset>
  963. <fileset dir="${build.lib}">
  964. <include name="${bootstrap.jar}"/>
  965. </fileset>
  966. </copy>
  967. </target>
  968. <!--
  969. ===================================================================
  970. Target to create bootstrap build
  971. ===================================================================
  972. -->
  973. <target name="bootstrap" description="--> creates a bootstrap build">
  974. <antcall inheritAll="false" target="dist-lite">
  975. <param name="dist.dir" value="${bootstrap.dir}"/>
  976. </antcall>
  977. </target>
  978. <!--
  979. ===================================================================
  980. Create the source distribution
  981. ===================================================================
  982. -->
  983. <target name="src-dist"
  984. description="--> creates a source distribution">
  985. <mkdir dir="${src.dist.dir}"/>
  986. <copy todir="${src.dist.lib}">
  987. <fileset dir="${lib.dir}">
  988. <include name="*.jar"/>
  989. <include name="*.zip"/>
  990. <include name="README"/>
  991. </fileset>
  992. </copy>
  993. <copy todir="${src.dist.src}">
  994. <fileset dir="${src.dir}"/>
  995. </copy>
  996. <copy todir="${src.dist.docs}">
  997. <fileset dir="${docs.dir}">
  998. <exclude name="manual/api/**"/>
  999. <patternset refid="site.excludes"/>
  1000. </fileset>
  1001. </copy>
  1002. <copy todir="${src.dist.dir}">
  1003. <fileset dir=".">
  1004. <include name="README"/>
  1005. <include name="LICENSE"/>
  1006. <include name="LICENSE.xerces"/>
  1007. <include name="LICENSE.dom"/>
  1008. <include name="LICENSE.sax"/>
  1009. <include name="TODO"/>
  1010. <include name="WHATSNEW"/>
  1011. <include name="KEYS"/>
  1012. <include name="build.bat"/>
  1013. <include name="build.sh"/>
  1014. <include name="bootstrap.bat"/>
  1015. <include name="bootstrap.sh"/>
  1016. <include name="build.xml"/>
  1017. <include name="welcome.html"/>
  1018. </fileset>
  1019. </copy>
  1020. <fixcrlf srcdir="${src.dist.dir}" eol="dos" includes="*.bat,*.cmd"/>
  1021. <fixcrlf srcdir="${src.dist.dir}" eol="unix">
  1022. <include name="**/*.sh"/>
  1023. <include name="**/*.pl"/>
  1024. <include name="**/ant"/>
  1025. <include name="**/antRun"/>
  1026. </fixcrlf>
  1027. <fixcrlf srcdir="${src.dist.dir}">
  1028. <include name="**/*.java"/>
  1029. <exclude name="src/etc/testcases/taskdefs/fixcrlf/expected/Junk?.java"/>
  1030. <exclude name="src/etc/testcases/taskdefs/fixcrlf/input/Junk?.java"/>
  1031. </fixcrlf>
  1032. <chmod perm="ugo+x" dir="${src.dist.dir}" type="dir"
  1033. failonerror="${chmod.fail}"/>
  1034. <chmod perm="ugo+r" dir="${src.dist.dir}" failonerror="${chmod.fail}"/>
  1035. <chmod perm="ugo+x" failonerror="${chmod.fail}">
  1036. <fileset dir="${src.dist.dir}">
  1037. <include name="**/.sh"/>
  1038. <include name="**/.pl"/>
  1039. <include name="**/.py"/>
  1040. <include name="**/ant"/>
  1041. <include name="**/antRun"/>
  1042. </fileset>
  1043. </chmod>
  1044. </target>
  1045. <!--
  1046. ===================================================================
  1047. Create the binary distribution
  1048. ===================================================================
  1049. -->
  1050. <target name="main_distribution"
  1051. description="--> creates the zip and tar distributions">
  1052. <delete dir="${dist.name}"/>
  1053. <mkdir dir="${dist.base}"/>
  1054. <mkdir dir="${dist.base}/src"/>
  1055. <mkdir dir="${dist.base}/bin"/>
  1056. <antcall inheritAll="false" target="internal_dist">
  1057. <param name="dist.dir" value="${dist.name}"/>
  1058. </antcall>
  1059. <zip destfile="${dist.base}/bin/${dist.name}-bin.zip">
  1060. <zipfileset dir="${dist.name}/.." filemode="755">
  1061. <include name="${dist.name}/bin/ant"/>
  1062. <include name="${dist.name}/bin/antRun"/>
  1063. <include name="${dist.name}/bin/*.pl"/>
  1064. <include name="${dist.name}/bin/*.py"/>
  1065. </zipfileset>
  1066. <fileset dir="${dist.name}/..">
  1067. <include name="${dist.name}/**"/>
  1068. <exclude name="${dist.name}/bin/ant"/>
  1069. <exclude name="${dist.name}/bin/antRun"/>
  1070. <exclude name="${dist.name}/bin/*.pl"/>
  1071. <exclude name="${dist.name}/bin/*.py"/>
  1072. </fileset>
  1073. </zip>
  1074. <tar longfile="gnu"
  1075. destfile="${dist.base}/bin/${dist.name}-bin.tar">
  1076. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  1077. <include name="${dist.name}/bin/ant"/>
  1078. <include name="${dist.name}/bin/antRun"/>
  1079. <include name="${dist.name}/bin/*.pl"/>
  1080. <include name="${dist.name}/bin/*.py"/>
  1081. </tarfileset>
  1082. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  1083. <include name="${dist.name}/**"/>
  1084. <exclude name="${dist.name}/bin/ant"/>
  1085. <exclude name="${dist.name}/bin/antRun"/>
  1086. <exclude name="${dist.name}/bin/*.pl"/>
  1087. <exclude name="${dist.name}/bin/*.py"/>
  1088. </tarfileset>
  1089. </tar>
  1090. <gzip destfile="${dist.base}/bin/${dist.name}-bin.tar.gz"
  1091. src="${dist.base}/bin/${dist.name}-bin.tar"/>
  1092. <bzip2 destfile="${dist.base}/bin/${dist.name}-bin.tar.bz2"
  1093. src="${dist.base}/bin/${dist.name}-bin.tar"/>
  1094. <delete file="${dist.base}/bin/${dist.name}-bin.tar"/>
  1095. <delete dir="${dist.name}"/>
  1096. <checksum fileext=".md5">
  1097. <fileset dir="${dist.base}/bin/">
  1098. <include name="**/*"/>
  1099. <exclude name="**/*.asc"/>
  1100. <exclude name="**/*.md5"/>
  1101. </fileset>
  1102. </checksum>
  1103. <antcall inheritAll="false" target="src-dist">
  1104. <param name="src.dist.dir" value="${dist.name}"/>
  1105. </antcall>
  1106. <zip destfile="${dist.base}/src/${dist.name}-src.zip">
  1107. <zipfileset dir="${dist.name}/.." filemode="755">
  1108. <include name="${dist.name}/bootstrap.sh"/>
  1109. <include name="${dist.name}/build.sh"/>
  1110. </zipfileset>
  1111. <fileset dir="${dist.name}/..">
  1112. <include name="${dist.name}/**"/>
  1113. <exclude name="${dist.name}/bootstrap.sh"/>
  1114. <exclude name="${dist.name}/build.sh"/>
  1115. </fileset>
  1116. </zip>
  1117. <tar longfile="gnu"
  1118. destfile="${dist.base}/src/${dist.name}-src.tar" >
  1119. <tarfileset dir="${dist.name}/.." mode="755" username="ant" group="ant">
  1120. <include name="${dist.name}/bootstrap.sh"/>
  1121. <include name="${dist.name}/build.sh"/>
  1122. </tarfileset>
  1123. <tarfileset dir="${dist.name}/.." username="ant" group="ant">
  1124. <include name="${dist.name}/**"/>
  1125. <exclude name="${dist.name}/bootstrap.sh"/>
  1126. <exclude name="${dist.name}/build.sh"/>
  1127. </tarfileset>
  1128. </tar>
  1129. <gzip destfile="${dist.base}/src/${dist.name}-src.tar.gz"
  1130. src="${dist.base}/src/${dist.name}-src.tar"/>
  1131. <bzip2 destfile="${dist.base}/src/${dist.name}-src.tar.bz2"
  1132. src="${dist.base}/src/${dist.name}-src.tar"/>
  1133. <delete file="${dist.base}/src/${dist.name}-src.tar"/>
  1134. <delete dir="${dist.name}"/>
  1135. <checksum fileext=".md5">
  1136. <fileset dir="${dist.base}/src/">
  1137. <include name="**/*"/>
  1138. <exclude name="**/*.asc"/>
  1139. <exclude name="**/*.md5"/>
  1140. </fileset>
  1141. </checksum>
  1142. </target>
  1143. <target name="distribution" depends="main_distribution"
  1144. description="--> creates the full Apache Ant distribution">
  1145. </target>
  1146. <!--
  1147. ===================================================================
  1148. Cleans up build and distribution directories
  1149. ===================================================================
  1150. -->
  1151. <target name="clean"
  1152. description="--> cleans up build and dist directories">
  1153. <delete dir="${build.dir}"/>
  1154. <delete dir="${dist.base}"/>
  1155. <delete dir="${dist.dir}"/>
  1156. <delete>
  1157. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  1158. </delete>
  1159. </target>
  1160. <!--
  1161. ===================================================================
  1162. Cleans everything
  1163. ===================================================================
  1164. -->
  1165. <target name="allclean"
  1166. depends="clean"
  1167. description="--> cleans up everything">
  1168. <delete file="${bootstrap.dir}/bin/antRun"/>
  1169. <delete file="${bootstrap.dir}/bin/antRun.bat"/>
  1170. <delete file="${bootstrap.dir}/bin/*.pl"/>
  1171. <delete file="${bootstrap.dir}/bin/*.py"/>
  1172. </target>
  1173. <!--
  1174. ===================================================================
  1175. Installs Apache Ant
  1176. ===================================================================
  1177. -->
  1178. <target name="install" if="ant.install">
  1179. <antcall inheritAll="false" target="internal_dist">
  1180. <param name="dist.dir" value="${ant.install}"/>
  1181. </antcall>
  1182. </target>
  1183. <target name="install-lite" if="ant.install">
  1184. <antcall inheritAll="false" target="dist-lite">
  1185. <param name="dist.dir" value="${ant.install}"/>
  1186. </antcall>
  1187. </target>
  1188. <!--
  1189. ===================================================================
  1190. Creates the API documentation
  1191. ===================================================================
  1192. -->
  1193. <target name="javadoc_check">
  1194. <uptodate property="javadoc.notrequired"
  1195. targetfile="${build.javadocs}/packages.html" >
  1196. <srcfiles dir= "${java.dir}" includes="**/*.java"/>
  1197. </uptodate>
  1198. <uptodate property="tests.javadoc.notrequired"
  1199. targetfile="${build.tests.javadocs}/packages.html" >
  1200. <srcfiles dir= "${tests.dir}">
  1201. <patternset refid="useful.tests"/>
  1202. </srcfiles>
  1203. </uptodate>
  1204. </target>
  1205. <target name="javadocs" depends="prepare, javadoc_check"
  1206. unless="javadoc.notrequired"
  1207. description="--> creates the API documentation">
  1208. <mkdir dir="${build.javadocs}"/>
  1209. <javadoc useexternalfile="yes"
  1210. destdir="${build.javadocs}"
  1211. author="true"
  1212. version="true"
  1213. locale="en"
  1214. windowtitle="${Name} API"
  1215. doctitle="${Name}">
  1216. <packageset dir="${java.dir}"/>
  1217. <tag name="todo" description="To do:" scope="all"/>
  1218. <tag name="ant.task" enabled="false" description="Task:" scope="types"/>
  1219. <tag name="ant.datatype" enabled="false" description="Data type:" scope="types"/>
  1220. <tag name="ant.attribute" enabled="false" description="Attribute:" scope="types"/>
  1221. <tag name="ant.attribute.group" enabled="false" description="Attribute group:" scope="types"/>
  1222. <tag name="ant.element" enabled="false" description="Nested element:" scope="types"/>
  1223. <group title="Apache Ant Core" packages="org.apache.tools.ant*"/>
  1224. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*"/>
  1225. <group title="Core Types" packages="org.apache.tools.ant.types*"/>
  1226. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*"/>
  1227. <group title="Optional Types" packages="org.apache.tools.ant.types.optional*"/>
  1228. <group title="Ant Utilities" packages="org.apache.tools.ant.util*"/>
  1229. <bottom>Copyright &#169; 2000-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  1230. </javadoc>
  1231. </target>
  1232. <target name="test-javadocs" depends="prepare, javadoc_check"
  1233. unless="tests.javadoc.notrequired"
  1234. description="--> creates the API documentation for test utilities">
  1235. <mkdir dir="${build.tests.javadocs}"/>
  1236. <javadoc useexternalfile="yes"
  1237. destdir="${build.tests.javadocs}"
  1238. author="true"
  1239. version="true"
  1240. locale="en"
  1241. windowtitle="${Name} Test Utilities"
  1242. doctitle="${Name}">
  1243. <fileset dir="${tests.dir}">
  1244. <patternset refid="useful.tests"/>
  1245. </fileset>
  1246. <bottom>Copyright &#169; 2000-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  1247. </javadoc>
  1248. </target>
  1249. <!--
  1250. ===================================================================
  1251. Compile testcases
  1252. ===================================================================
  1253. -->
  1254. <target name="compile-tests" depends="build" if="junit.present">
  1255. <mkdir dir="${build.tests}"/>
  1256. <javac srcdir="${tests.dir}"
  1257. destdir="${build.tests}"
  1258. debug="${debug}"
  1259. target="${javac.target}"
  1260. deprecation="${deprecation}" >
  1261. <classpath refid="tests-classpath"/>
  1262. <selector refid="conditional-patterns"/>
  1263. </javac>
  1264. </target>
  1265. <target name="dump-info" depends="dump-sys-properties,run-which"/>
  1266. <target name="dump-sys-properties" unless="which.present"
  1267. depends="xml-check">
  1268. <echo message="java.vm.info=${java.vm.info}"/>
  1269. <echo message="java.vm.name=${java.vm.name}"/>
  1270. <echo message="java.vm.vendor=${java.vm.vendor}"/>
  1271. <echo message="java.vm.version=${java.vm.version}"/>
  1272. <echo message="os.arch=${os.arch}"/>
  1273. <echo message="os.name=${os.name}"/>
  1274. <echo message="os.version=${os.version}"/>
  1275. <echo message="file.encoding=${file.encoding}"/>
  1276. <echo message="user.language=${user.language}"/>
  1277. </target>
  1278. <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors -->
  1279. <target name="xml-check" depends="check_for_optional_packages"
  1280. if="xalan.envcheck" unless="which.present">
  1281. <java classname="org.apache.xalan.xslt.EnvironmentCheck"/>
  1282. </target>
  1283. <target name="run-which" depends="check_for_optional_packages"
  1284. if="which.present">
  1285. <java classname="org.apache.env.Which" taskname="which"/>
  1286. </target>
  1287. <!-- test to see if we are online or not. can take a while when we are off line, so
  1288. setting the property is a good shortcut-->
  1289. <target name="probe-offline">
  1290. <condition property="offline">
  1291. <or>
  1292. <isset property="offline"/>
  1293. <not>
  1294. <http url="http://www.apache.org/"/>
  1295. </not>
  1296. </or>
  1297. </condition>
  1298. <echo level="verbose" > offline=${offline}</echo>
  1299. </target>
  1300. <!--
  1301. ===================================================================
  1302. Run testcase
  1303. ===================================================================
  1304. -->
  1305. <target name="test" depends="run-tests" description="--> run JUnit tests"/>
  1306. <target name="run-tests" depends="dump-info,compile-tests,probe-offline" if="junit.present">
  1307. <condition property="run.junitreport">
  1308. <or>
  1309. <isset property="xalan2.present"/>
  1310. <and>
  1311. <isset property="xalan.present"/>
  1312. <isset property="bsf.present"/>
  1313. </and>
  1314. </or>
  1315. </condition>
  1316. <junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}"
  1317. filtertrace="${junit.filtertrace}"
  1318. fork="${junit.fork}"
  1319. failureproperty="tests.failed">
  1320. <!-- <jvmarg value="-classic"/> -->
  1321. <classpath refid="tests-classpath"/>
  1322. <sysproperty key="ant.home" value="${ant.home}"/>
  1323. <sysproperty key="build.tests" value="${build.tests}"/>
  1324. <sysproperty key="tests-classpath.value"
  1325. value="${tests-classpath.value}"/>
  1326. <formatter type="brief" usefile="false"/>
  1327. <batchtest>
  1328. <fileset dir="${tests.dir}">
  1329. <include name="**/*Test*"/>
  1330. <!-- abstract classes, not testcases -->
  1331. <exclude name="${ant.package}/taskdefs/TaskdefsTest.java"/>
  1332. <exclude name="${ant.package}/BuildFileTest.java"/>
  1333. <exclude name="${regexp.package}/RegexpMatcherTest.java"/>
  1334. <exclude name="${regexp.package}/RegexpTest.java"/>
  1335. <exclude name="${optional.package}/AbstractXSLTLiaisonTest.java"/>
  1336. <exclude name="${ant.package}/types/AbstractFileSetTest.java"/>
  1337. <exclude name="${ant.package}/types/selectors/BaseSelectorTest.java"/>
  1338. <!-- helper classes, not testcases -->
  1339. <exclude name="org/example/**"/>
  1340. <exclude name="${ant.package}/taskdefs/TaskdefTest*Task.java"/>
  1341. <!-- interactive tests -->
  1342. <exclude name="${ant.package}/taskdefs/TestProcess.java"/>
  1343. <exclude name="${optional.package}/splash/SplashScreenTest.java"/>
  1344. <!-- only run these tests if their required libraries are
  1345. installed -->
  1346. <selector refid="conditional-patterns"/>
  1347. <!-- tests excluded if the test is run in offline mode -->
  1348. <patternset refid="onlinetests"/>
  1349. <!-- failing tests excluded unless run.failing.tests is set -->
  1350. <patternset refid="teststhatfail"/>
  1351. <!-- runtime dependencies that are different from compile
  1352. time dependencies -->
  1353. <exclude name="${optional.package}/ReplaceRegExpTest.java"
  1354. unless="some.regexp.support"/>
  1355. <exclude name="${optional.package}/sitraka/*.java"
  1356. unless="some.regexp.support"/>
  1357. <exclude name="${ant.package}/types/selectors/ContainsRegexpTest.java"
  1358. unless="some.regexp.support"/>
  1359. <exclude name="${optional.package}/RhinoScriptTest.java"
  1360. unless="bsf.present"/>
  1361. <exclude name="${optional.package}/RhinoScriptTest.java"
  1362. unless="rhino.present"/>
  1363. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1364. unless="bsf.present"/>
  1365. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1366. unless="beanshell.present"/>
  1367. <!-- fail if testcases can be loaded from the system classloader -->
  1368. <exclude name="${optional.package}/junit/JUnitClassLoaderTest.java"
  1369. if="tests.are.on.system.classpath"/>
  1370. <exclude name="${optional.package}/sitraka/XMLReportTest.java"
  1371. if="tests.are.on.system.classpath"/>
  1372. <!-- these tests need to be localised before being ran???? -->
  1373. <exclude name="${optional.package}/PvcsTest.java"/>
  1374. <!-- These tests need a TraX implementation like xalan2 or saxon -->
  1375. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1376. unless="trax.impl.present"/>
  1377. <exclude name="${optional.package}/XsltTest.java"
  1378. unless="trax.impl.present"/>
  1379. <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
  1380. unless="trax.impl.present"/>
  1381. <exclude name="${optional.package}/junit/JUnitReportTest.java"
  1382. unless="run.junitreport"/>
  1383. <!-- needs BSF to work -->
  1384. <exclude name="${optional.package}/XalanLiaisonTest.java"
  1385. unless="bsf.present"/>
  1386. <!-- needs resolver.jar to work -->
  1387. <exclude name="${optional.package}/XmlValidateCatalogTest.java"
  1388. unless="apache.resolver.present"/>
  1389. <!-- needs jasperc -->
  1390. <exclude name="${optional.package}/JspcTest.java"
  1391. unless="jasper.present"/>
  1392. <!-- misc oneoff tests -->
  1393. <exclude name="${optional.package}/WsdlToDotnetTest.java"
  1394. unless="dotnetapps.found"/>
  1395. <exclude name="${optional.package}/DotnetTest.java"
  1396. unless="dotnetapps.found"/>
  1397. <!-- These tests only passes if testcases and Ant classes have
  1398. been loaded by the same classloader - will throw
  1399. IllegalAccessExceptions otherwise. -->
  1400. <exclude name="${ant.package}/taskdefs/SQLExecTest.java"
  1401. unless="tests.and.ant.share.classloader"/>
  1402. <exclude name="${optional.package}/sos/SOSTest.java"
  1403. unless="tests.and.ant.share.classloader"/>
  1404. <exclude name="${optional.package}/vss/MSVSSTest.java"
  1405. unless="tests.and.ant.share.classloader"/>
  1406. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1407. unless="tests.and.ant.share.classloader"/>
  1408. <exclude name="${optional.package}/metamata/MAuditParserTest.java"
  1409. unless="tests.and.ant.share.classloader"/>
  1410. <exclude name="${ant.package}/taskdefs/ProcessDestroyerTest.java"
  1411. unless="tests.and.ant.share.classloader"/>
  1412. <!-- can only run if cvs is installed on your machine
  1413. enable by setting the property have.cvs
  1414. -->
  1415. <exclude name="${ant.package}/taskdefs/AbstractCvsTaskTest.java"
  1416. unless="have.cvs"/>
  1417. <!-- test needs special setup -->
  1418. <exclude name="${optional.package}/ssh/ScpTest.java"/>
  1419. </fileset>
  1420. </batchtest>
  1421. </junit>
  1422. <fail if="tests.failed">At least one test has failed.</fail>
  1423. </target>
  1424. <target name="run-single-test" if="testcase" depends="compile-tests,run-single-test-only"
  1425. description="--> runs the single unit test defined in the testcase property"/>
  1426. <target name="run-single-test-only"
  1427. description="--> runs the single unit test defined in the testcase property">
  1428. <junit printsummary="${junit.summary}"
  1429. haltonfailure="${test.haltonfailure}"
  1430. fork="${junit.fork}"
  1431. filtertrace="${junit.filtertrace}">
  1432. <!-- <jvmarg value="-classic"/> -->
  1433. <sysproperty key="ant.home" value="${ant.home}"/>
  1434. <sysproperty key="build.tests" value="${build.tests}"/>
  1435. <sysproperty key="tests-classpath.value"
  1436. value="${tests-classpath.value}"/>
  1437. <classpath refid="tests-classpath"/>
  1438. <formatter type="plain" usefile="false"/>
  1439. <test name="${testcase}"/>
  1440. </junit>
  1441. </target>
  1442. <target name="interactive-tests" description="--> runs interactive tests"
  1443. depends="compile-tests"
  1444. if="jdk1.3+">
  1445. <java classpathref="tests-classpath"
  1446. classname="org.apache.tools.ant.taskdefs.TestProcess"
  1447. fork="true"/>
  1448. </target>
  1449. <!--
  1450. ===================================================================
  1451. Main target - runs dist-lite by default
  1452. ===================================================================
  1453. -->
  1454. <target name="main"
  1455. description="--> creates a minimum distribution in ./dist"
  1456. depends="dist-lite"/>
  1457. </project>