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

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