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

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