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

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