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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655
  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. Check to see what optional dependencies are available
  323. ===================================================================
  324. -->
  325. <target name="check_for_optional_packages">
  326. <available property="jdk1.3+" classname="java.lang.StrictMath"/>
  327. <available property="jdk1.4+" classname="java.lang.CharSequence"/>
  328. <available property="jdk1.5+" classname="java.lang.Readable"/>
  329. <available property="kaffe" classname="kaffe.util.NotImplemented"/>
  330. <available property="bsf.present"
  331. classname="org.apache.bsf.BSFManager"
  332. classpathref="classpath"/>
  333. <available property="netrexx.present"
  334. classname="netrexx.lang.Rexx"
  335. classpathref="classpath"/>
  336. <available property="trax.present"
  337. classname="javax.xml.transform.Transformer"
  338. classpathref="classpath"/>
  339. <condition property="trax.impl.present">
  340. <or>
  341. <and>
  342. <isset property="javax.xml.transform.TransformerFactory"/>
  343. <available classname="${javax.xml.transform.TransformerFactory}"
  344. classpathref="classpath"/>
  345. </and>
  346. <available resource="META-INF/services/javax.xml.transform.TransformerFactory"/>
  347. </or>
  348. </condition>
  349. <available property="xslp.present"
  350. classname="com.kvisco.xsl.XSLProcessor"
  351. classpathref="classpath"/>
  352. <available property="apache.resolver.present"
  353. classname="org.apache.xml.resolver.tools.CatalogResolver"
  354. classpathref="classpath" />
  355. <available property="xalan.present"
  356. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  357. classpathref="classpath"/>
  358. <available property="xalan2.present"
  359. classname="org.apache.xalan.transformer.TransformerImpl"
  360. classpathref="classpath"/>
  361. <available property="ejb.ejbc.present"
  362. classname="weblogic.ejbc"
  363. classpathref="classpath"/>
  364. <available property="ejb.DDCreator.present"
  365. classname="weblogic.ejb.utils.DDCreator"
  366. classpathref="classpath"/>
  367. <available property="ejb.wls.present"
  368. classname="weblogic.Server"
  369. classpathref="classpath"/>
  370. <available property="junit.present"
  371. classname="junit.framework.TestCase"
  372. classpathref="classpath"/>
  373. <available property="commons.net.present"
  374. classname="org.apache.commons.net.ftp.FTPClient"
  375. classpathref="classpath"/>
  376. <available property="starteam.present"
  377. classname="com.starbase.util.Platform"
  378. classpathref="classpath"/>
  379. <available property="antlr.present"
  380. classname="antlr.Tool"
  381. classpathref="classpath"/>
  382. <available property="vaj.present"
  383. classname="com.ibm.ivj.util.base.Workspace"
  384. classpathref="classpath"/>
  385. <available property="stylebook.present"
  386. classname="org.apache.stylebook.Engine"
  387. classpathref="classpath"/>
  388. <available property="apache.regexp.present"
  389. classname="org.apache.regexp.RE"
  390. classpathref="classpath"/>
  391. <available property="apache.oro.present"
  392. classname="org.apache.oro.text.regex.Perl5Matcher"
  393. classpathref="classpath"/>
  394. <available property="jmf.present"
  395. classname="javax.sound.sampled.Clip"
  396. classpathref="classpath"/>
  397. <available property="jai.present"
  398. classname="javax.media.jai.JAI"
  399. classpathref="classpath"/>
  400. <available property="icontract.present"
  401. classname="com.reliablesystems.iContract.IContracted"
  402. classpathref="classpath"/>
  403. <available property="jdepend.present"
  404. classname="jdepend.framework.JDepend"
  405. classpathref="classpath"/>
  406. <available property="log4j.present"
  407. classname="org.apache.log4j.Logger"
  408. classpathref="classpath"/>
  409. <available property="commons.logging.present"
  410. classname="org.apache.commons.logging.LogFactory"
  411. classpathref="classpath"/>
  412. <available property="xalan.envcheck"
  413. classname="org.apache.xalan.xslt.EnvironmentCheck"
  414. classpathref="classpath"/>
  415. <available property="which.present"
  416. classname="org.apache.env.Which"
  417. classpathref="classpath"/>
  418. <available property="xerces.present"
  419. classname="org.apache.xerces.parsers.SAXParser"
  420. classpathref="classpath"/>
  421. <available property="bcel.present"
  422. classname="org.apache.bcel.Constants"
  423. classpathref="classpath"/>
  424. <available property="sunuue.present"
  425. classname="sun.misc.UUEncoder"
  426. classpathref="classpath"/>
  427. <condition property="javamail.complete">
  428. <and>
  429. <available classname="javax.activation.DataHandler"
  430. classpathref="classpath"/>
  431. <available classname="javax.mail.Transport"
  432. classpathref="classpath"/>
  433. </and>
  434. </condition>
  435. <condition property="some.regexp.support">
  436. <or>
  437. <isset property="jdk1.4+"/>
  438. <isset property="apache.regexp.present"/>
  439. <isset property="apache.oro.present"/>
  440. </or>
  441. </condition>
  442. <condition property="tests.and.ant.share.classloader">
  443. <or>
  444. <equals arg1="${junit.fork}" arg2="true"/>
  445. <equals arg1="${build.sysclasspath}" arg2="only"/>
  446. </or>
  447. </condition>
  448. <condition property="sun.tools.present">
  449. <and>
  450. <available classname="sun.tools.native2ascii.Main"/>
  451. <available classname="com.sun.tools.javah.Main"/>
  452. </and>
  453. </condition>
  454. <available property="base64.present" classname="sun.misc.BASE64Encoder"/>
  455. <property name="build.tests.resolved" location="${build.tests}"/>
  456. <condition property="tests.are.on.system.classpath">
  457. <or>
  458. <!-- relative paths in CLASSPATH -->
  459. <contains string="${java.class.path}"
  460. substring="${build.tests}"/>
  461. <!-- absolute paths in CLASSPATH -->
  462. <contains string="${java.class.path}"
  463. substring="${build.tests.resolved}"/>
  464. <istrue value="${junit.fork}"/>
  465. </or>
  466. </condition>
  467. <condition property="jasper.present">
  468. <and>
  469. <available classname="org.apache.jasper.compiler.Compiler"/>
  470. <available classname="org.apache.jasper.JasperException"/>
  471. </and>
  472. </condition>
  473. <condition property="swing.present">
  474. <or>
  475. <not>
  476. <isset property="kaffe"/>
  477. </not>
  478. <available classname="javax.swing.ImageIcon"
  479. classpathref="classpath"/>
  480. </or>
  481. </condition>
  482. <!-- http client needs commons logging -->
  483. <condition property="apache-httpclient.present">
  484. <and>
  485. <available
  486. classname="org.apache.commons.httpclient.HttpClient"
  487. classpathref="classpath"/>
  488. <isset property="commons.logging.present"/>
  489. </and>
  490. </condition>
  491. <condition property="wsdl.found">
  492. <or>
  493. <available file="wsdl" filepath="${env.PATH}"/>
  494. <available file="wsdl.exe" filepath="${env.PATH}"/>
  495. <available file="wsdl.exe" filepath="${env.Path}"/>
  496. </or>
  497. </condition>
  498. <echo level="verbose"> wsdl.found=${wsdl.found}</echo>
  499. <condition property="csc.found">
  500. <or>
  501. <available file="mcs" filepath="${env.PATH}"/>
  502. <available file="csc" filepath="${env.PATH}"/>
  503. <available file="csc.exe" filepath="${env.PATH}"/>
  504. <available file="csc.exe" filepath="${env.Path}"/>
  505. </or>
  506. </condition>
  507. <echo level="verbose"> csc.found=${csc.found}</echo>
  508. <condition property="dotnetapps.found">
  509. <and>
  510. <isset property="csc.found"/>
  511. <isset property="wsdl.found"/>
  512. </and>
  513. </condition>
  514. <echo level="verbose"> dotnetapps.found=${dotnetapps.found}</echo>
  515. <available property="rhino.present"
  516. classname="org.mozilla.javascript.Scriptable"
  517. classpathref="classpath"/>
  518. <available property="beanshell.present"
  519. classname="bsh.StringUtil"
  520. classpathref="classpath"/>
  521. <available property="xerces1.present"
  522. classname="org.apache.xerces.framework.XMLParser"
  523. classpathref="classpath"/>
  524. <available property="jsch.present"
  525. classname="com.jcraft.jsch.Session"
  526. classpathref="classpath"/>
  527. </target>
  528. <!--
  529. ===================================================================
  530. Prepare the build
  531. ===================================================================
  532. -->
  533. <target name="prepare">
  534. <tstamp>
  535. <format property="year" pattern="yyyy"/>
  536. </tstamp>
  537. <filterchain id="ant.filters">
  538. <replacetokens>
  539. <token key="VERSION" value="${version}"/>
  540. <token key="DATE" value="${TODAY}"/>
  541. <token key="TIME" value="${TSTAMP}"/>
  542. </replacetokens>
  543. </filterchain>
  544. </target>
  545. <!--
  546. ===================================================================
  547. Build the code
  548. ===================================================================
  549. -->
  550. <target name="build"
  551. depends="prepare, check_for_optional_packages"
  552. description="--> compiles the source code">
  553. <mkdir dir="${build.dir}"/>
  554. <mkdir dir="${build.classes}"/>
  555. <mkdir dir="${build.lib}"/>
  556. <javac srcdir="${java.dir}"
  557. destdir="${build.classes}"
  558. debug="${debug}"
  559. deprecation="${deprecation}"
  560. target="${javac.target}"
  561. source="${javac.source}"
  562. optimize="${optimize}" >
  563. <classpath refid="classpath"/>
  564. <selector id="conditional-patterns">
  565. <not>
  566. <or>
  567. <selector refid="needs.jdk1.3+" unless="jdk1.3+"/>
  568. <selector refid="needs.jdk1.4+" unless="jdk1.4+"/>
  569. <selector refid="needs.jdk1.5+" unless="jdk1.5+"/>
  570. <selector refid="needs.sun.tools" unless="sun.tools.present"/>
  571. <selector refid="needs.sun.uue" unless="sunuue.present"/>
  572. <selector refid="needs.sun.b64" unless="base64.present"/>
  573. <selector refid="needs.trax" unless="trax.present"/>
  574. <selector refid="needs.xalan1" unless="xalan.present"/>
  575. <selector refid="needs.xslp" unless="xslp.present"/>
  576. <selector refid="needs.apache-resolver" unless="apache.resolver.present"/>
  577. <selector refid="needs.junit" unless="junit.present"/>
  578. <selector refid="needs.apache-regexp"
  579. unless="apache.regexp.present"/>
  580. <selector refid="needs.apache-oro" unless="apache.oro.present"/>
  581. <selector refid="needs.apache-bcel" unless="bcel.present"/>
  582. <selector refid="needs.apache-log4j" unless="log4j.present"/>
  583. <selector refid="needs.commons-logging"
  584. unless="commons.logging.present"/>
  585. <selector refid="needs.apache-bsf" unless="bsf.present"/>
  586. <selector refid="needs.stylebook" unless="stylebook.present"/>
  587. <selector refid="needs.javamail" unless="javamail.complete"/>
  588. <selector refid="needs.icontract" unless="icontract.present"/>
  589. <selector refid="needs.netrexx" unless="netrexx.present"/>
  590. <selector refid="needs.weblogic.ejbc" unless="ejb.ejbc.present"/>
  591. <selector refid="needs.weblogic.ddcreator"
  592. unless="ejb.DDCreator.present"/>
  593. <selector refid="needs.weblogic.server" unless="ejb.wls.present"/>
  594. <selector refid="needs.commons-net" unless="commons.net.present"/>
  595. <selector refid="needs.starteam" unless="starteam.present"/>
  596. <selector refid="needs.vaj" unless="vaj.present"/>
  597. <selector refid="needs.antlr" unless="antlr.present"/>
  598. <selector refid="needs.jmf" unless="jmf.present"/>
  599. <selector refid="needs.jai" unless="jai.present"/>
  600. <selector refid="needs.jdepend" unless="jdepend.present"/>
  601. <selector refid="needs.swing" unless="swing.present"/>
  602. <selector refid="needs.jsch" unless="jsch.present"/>
  603. <selector refid="needs.apache-httpclient"
  604. unless="apache-httpclient.present"/>
  605. </or>
  606. </not>
  607. </selector>
  608. </javac>
  609. <copy todir="${build.classes}">
  610. <fileset dir="${java.dir}">
  611. <include name="**/*.properties"/>
  612. <include name="**/*.dtd"/>
  613. </fileset>
  614. </copy>
  615. <copy todir="${build.classes}"
  616. overwrite="true" encoding="UTF-8">
  617. <fileset dir="${java.dir}">
  618. <include name="**/version.txt"/>
  619. <include name="**/defaultManifest.mf"/>
  620. </fileset>
  621. <filterchain refid="ant.filters"/>
  622. </copy>
  623. <copy todir="${build.classes}/${optional.package}/junit/xsl">
  624. <fileset dir="${etc.dir}">
  625. <include name="junit-frames.xsl"/>
  626. <include name="junit-noframes.xsl"/>
  627. </fileset>
  628. </copy>
  629. </target>
  630. <!--
  631. ===================================================================
  632. Create the all of the Apache Ant jars
  633. ===================================================================
  634. -->
  635. <target name="jars"
  636. depends="build"
  637. description="--> creates the Apache Ant jars">
  638. <copy todir="${build.dir}">
  639. <fileset dir=".">
  640. <include name="LICENSE"/>
  641. <include name="LICENSE.xerces"/>
  642. <include name="LICENSE.dom"/>
  643. <include name="LICENSE.sax"/>
  644. <include name="NOTICE"/>
  645. </fileset>
  646. <mapper type="glob" from="*" to="*.txt"/>
  647. </copy>
  648. <copy file="${manifest}" tofile="${manifest.tmp}"/>
  649. <manifest file="${manifest.tmp}">
  650. <section name="${optional.package}/">
  651. <attribute name="Extension-name"
  652. value="org.apache.tools.ant"/>
  653. <attribute name="Specification-Title"
  654. value="Apache Ant"/>
  655. <attribute name="Specification-Version"
  656. value="${manifest-version}"/>
  657. <attribute name="Specification-Vendor"
  658. value="Apache Software Foundation"/>
  659. <attribute name="Implementation-Title"
  660. value="org.apache.tools.ant"/>
  661. <attribute name="Implementation-Version"
  662. value="${manifest-version}"/>
  663. <attribute name="Implementation-Vendor"
  664. value="Apache Software Foundation"/>
  665. </section>
  666. </manifest>
  667. <jar destfile="${build.lib}/${name}-launcher.jar"
  668. basedir="${build.classes}">
  669. <selector refid="ant.launcher"/>
  670. <manifest>
  671. <attribute name="Main-Class" value="org.apache.tools.ant.launch.Launcher"/>
  672. </manifest>
  673. </jar>
  674. <jar destfile="${build.lib}/${name}.jar"
  675. basedir="${build.classes}"
  676. manifest="${manifest}">
  677. <not>
  678. <selector id="non-core">
  679. <or>
  680. <filename name="${optional.package}/**"/>
  681. <filename name="${optional.type.package}/**"/>
  682. <filename name="${util.package}/depend/**"/>
  683. <filename name="${util.package}/optional/**"/>
  684. <selector refid="needs.apache-log4j"/>
  685. <selector refid="needs.commons-logging"/>
  686. <selector refid="needs.apache-regexp"/>
  687. <selector refid="needs.apache-oro"/>
  688. <selector refid="needs.jdk1.4+"/>
  689. <selector refid="needs.javamail"/>
  690. <selector refid="ant.launcher"/>
  691. </or>
  692. </selector>
  693. </not>
  694. <metainf dir="${build.dir}">
  695. <include name="LICENSE.txt"/>
  696. <include name="NOTICE.txt"/>
  697. </metainf>
  698. <manifest>
  699. <section name="${ant.package}/">
  700. <attribute name="Extension-name"
  701. value="org.apache.tools.ant"/>
  702. <attribute name="Specification-Title"
  703. value="Apache Ant"/>
  704. <attribute name="Specification-Version"
  705. value="${manifest-version}"/>
  706. <attribute name="Specification-Vendor"
  707. value="Apache Software Foundation"/>
  708. <attribute name="Implementation-Title"
  709. value="org.apache.tools.ant"/>
  710. <attribute name="Implementation-Version"
  711. value="${manifest-version}"/>
  712. <attribute name="Implementation-Vendor"
  713. value="Apache Software Foundation"/>
  714. </section>
  715. </manifest>
  716. <fileset dir="${docs.dir}">
  717. <include name="images/ant_logo_large.gif"/>
  718. </fileset>
  719. </jar>
  720. <jar destfile="${build.lib}/${bootstrap.jar}"
  721. basedir="${build.classes}"
  722. manifest="${manifest}">
  723. <include name="${ant.package}/Main.class"/>
  724. <metainf dir="${build.dir}">
  725. <include name="LICENSE.txt"/>
  726. <include name="NOTICE.txt"/>
  727. </metainf>
  728. <manifest>
  729. <attribute name="Class-Path"
  730. value="ant.jar xml-apis.jar xercesImpl.jar xalan.jar"/>
  731. </manifest>
  732. </jar>
  733. <jar destfile="${build.lib}/ant-nodeps.jar"
  734. basedir="${build.classes}"
  735. manifest="${manifest.tmp}">
  736. <and>
  737. <selector refid="non-core"/>
  738. <not>
  739. <or>
  740. <selector refid="needs.trax"/>
  741. <selector refid="needs.xalan1"/>
  742. <selector refid="needs.xslp"/>
  743. <selector refid="needs.apache-resolver"/>
  744. <selector refid="needs.junit"/>
  745. <selector refid="needs.apache-regexp"/>
  746. <selector refid="needs.apache-oro"/>
  747. <selector refid="needs.apache-bcel"/>
  748. <selector refid="needs.apache-log4j"/>
  749. <selector refid="needs.commons-logging"/>
  750. <selector refid="needs.apache-bsf"/>
  751. <selector refid="needs.stylebook"/>
  752. <selector refid="needs.javamail"/>
  753. <selector refid="needs.icontract"/>
  754. <selector refid="needs.netrexx"/>
  755. <selector refid="needs.weblogic.ejbc"/>
  756. <selector refid="needs.weblogic.ddcreator"/>
  757. <selector refid="needs.weblogic.server"/>
  758. <selector refid="needs.commons-net"/>
  759. <selector refid="needs.starteam"/>
  760. <selector refid="needs.vaj"/>
  761. <selector refid="needs.antlr"/>
  762. <selector refid="needs.jmf"/>
  763. <selector refid="needs.jai"/>
  764. <selector refid="needs.jdepend"/>
  765. <selector refid="needs.swing"/>
  766. <selector refid="needs.jsch"/>
  767. <selector refid="needs.apache-httpclient"/>
  768. </or>
  769. </not>
  770. </and>
  771. <metainf dir="${build.dir}">
  772. <include name="LICENSE.txt"/>
  773. <include name="NOTICE.txt"/>
  774. </metainf>
  775. </jar>
  776. <macrodef name="optional-jar">
  777. <attribute name="dep"/>
  778. <sequential>
  779. <jar destfile="${build.lib}/${optional.jars.prefix}-@{dep}.jar"
  780. basedir="${build.classes}"
  781. manifest="${manifest.tmp}">
  782. <selector refid="needs.@{dep}"/>
  783. </jar>
  784. </sequential>
  785. </macrodef>
  786. <optional-jar dep="trax"/>
  787. <optional-jar dep="xalan1"/>
  788. <optional-jar dep="xslp"/>
  789. <optional-jar dep="apache-resolver"/>
  790. <optional-jar dep="junit"/>
  791. <optional-jar dep="apache-regexp"/>
  792. <optional-jar dep="apache-oro"/>
  793. <optional-jar dep="apache-bcel"/>
  794. <optional-jar dep="apache-log4j"/>
  795. <optional-jar dep="commons-logging"/>
  796. <optional-jar dep="apache-bsf"/>
  797. <optional-jar dep="stylebook"/>
  798. <optional-jar dep="javamail"/>
  799. <optional-jar dep="icontract"/>
  800. <optional-jar dep="netrexx"/>
  801. <optional-jar dep="commons-net"/>
  802. <optional-jar dep="starteam"/>
  803. <optional-jar dep="vaj"/>
  804. <optional-jar dep="antlr"/>
  805. <optional-jar dep="jmf"/>
  806. <optional-jar dep="jai"/>
  807. <optional-jar dep="swing"/>
  808. <optional-jar dep="jsch"/>
  809. <optional-jar dep="jdepend"/>
  810. <optional-jar dep="apache-httpclient"/>
  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 srcdir="${tests.dir}"
  1246. destdir="${build.tests}"
  1247. debug="${debug}"
  1248. target="${javac.target}"
  1249. source="${javac.source}"
  1250. deprecation="${deprecation}" >
  1251. <classpath refid="tests-classpath"/>
  1252. <selector refid="conditional-patterns"/>
  1253. </javac>
  1254. <!-- Used by AntlibTest.testAntlibResource: -->
  1255. <jar jarfile="${build.tests}/org/apache/tools/ant/taskdefs/test2-antlib.jar">
  1256. <zipfileset dir="${tests.etc.dir}" fullpath="taskdefs/test.antlib.xml">
  1257. <include name="taskdefs/test2.antlib.xml"/>
  1258. </zipfileset>
  1259. </jar>
  1260. </target>
  1261. <target name="dump-info" depends="dump-sys-properties,run-which"/>
  1262. <target name="dump-sys-properties" unless="which.present"
  1263. depends="xml-check">
  1264. <echo message="java.vm.info=${java.vm.info}"/>
  1265. <echo message="java.vm.name=${java.vm.name}"/>
  1266. <echo message="java.vm.vendor=${java.vm.vendor}"/>
  1267. <echo message="java.vm.version=${java.vm.version}"/>
  1268. <echo message="os.arch=${os.arch}"/>
  1269. <echo message="os.name=${os.name}"/>
  1270. <echo message="os.version=${os.version}"/>
  1271. <echo message="file.encoding=${file.encoding}"/>
  1272. <echo message="user.language=${user.language}"/>
  1273. </target>
  1274. <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors -->
  1275. <target name="xml-check" depends="check_for_optional_packages"
  1276. if="xalan.envcheck" unless="which.present">
  1277. <java classname="org.apache.xalan.xslt.EnvironmentCheck"/>
  1278. </target>
  1279. <target name="run-which" depends="check_for_optional_packages"
  1280. if="which.present">
  1281. <java classname="org.apache.env.Which" taskname="which"/>
  1282. </target>
  1283. <!-- test to see if we are online or not. can take a while when we are off line, so
  1284. setting the property is a good shortcut-->
  1285. <target name="probe-offline">
  1286. <condition property="offline">
  1287. <or>
  1288. <isset property="offline"/>
  1289. <not>
  1290. <http url="http://www.apache.org/"/>
  1291. </not>
  1292. </or>
  1293. </condition>
  1294. <echo level="verbose" > offline=${offline}</echo>
  1295. </target>
  1296. <!--
  1297. ===================================================================
  1298. Run testcase
  1299. ===================================================================
  1300. -->
  1301. <target name="test" depends="run-tests,run-single-test" description="--> run JUnit tests"/>
  1302. <target name="run-tests" depends="dump-info,compile-tests,probe-offline" if="junit.present" unless="testcase">
  1303. <condition property="run.junitreport">
  1304. <or>
  1305. <isset property="xalan2.present"/>
  1306. <and>
  1307. <isset property="xalan.present"/>
  1308. <isset property="bsf.present"/>
  1309. </and>
  1310. </or>
  1311. </condition>
  1312. <junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}"
  1313. filtertrace="${junit.filtertrace}"
  1314. fork="${junit.fork}" forkmode="${junit.forkmode}"
  1315. failureproperty="tests.failed">
  1316. <!-- <jvmarg value="-classic"/> -->
  1317. <classpath refid="tests-classpath"/>
  1318. <sysproperty key="ant.home" value="${ant.home}"/>
  1319. <sysproperty key="build.tests" file="${build.tests}"/>
  1320. <sysproperty key="offline" value="${offline}"/>
  1321. <sysproperty key="build.tests.value" value="${build.tests.value}"/>
  1322. <sysproperty key="tests-classpath.value"
  1323. value="${tests-classpath.value}"/>
  1324. <formatter type="brief" usefile="false"/>
  1325. <batchtest>
  1326. <fileset dir="${tests.dir}">
  1327. <include name="**/*Test*"/>
  1328. <!-- abstract classes, not testcases -->
  1329. <exclude name="${ant.package}/taskdefs/TaskdefsTest.java"/>
  1330. <exclude name="${ant.package}/BuildFileTest.java"/>
  1331. <exclude name="${regexp.package}/RegexpMatcherTest.java"/>
  1332. <exclude name="${regexp.package}/RegexpTest.java"/>
  1333. <exclude name="${optional.package}/AbstractXSLTLiaisonTest.java"/>
  1334. <exclude name="${ant.package}/types/AbstractFileSetTest.java"/>
  1335. <exclude name="${ant.package}/types/selectors/BaseSelectorTest.java"/>
  1336. <!-- helper classes, not testcases -->
  1337. <exclude name="org/example/**"/>
  1338. <exclude name="${ant.package}/taskdefs/TaskdefTest*Task.java"/>
  1339. <!-- interactive tests -->
  1340. <exclude name="${ant.package}/taskdefs/TestProcess.java"/>
  1341. <exclude name="${optional.package}/splash/SplashScreenTest.java"/>
  1342. <!-- only run these tests if their required libraries are
  1343. installed -->
  1344. <selector refid="conditional-patterns"/>
  1345. <!-- tests excluded if the test is run in offline mode -->
  1346. <patternset refid="onlinetests"/>
  1347. <!-- failing tests excluded unless run.failing.tests is set -->
  1348. <patternset refid="teststhatfail"/>
  1349. <!-- runtime dependencies that are different from compile
  1350. time dependencies -->
  1351. <exclude name="${optional.package}/ReplaceRegExpTest.java"
  1352. unless="some.regexp.support"/>
  1353. <exclude name="${optional.package}/sitraka/*.java"
  1354. unless="some.regexp.support"/>
  1355. <exclude name="${ant.package}/types/selectors/ContainsRegexpTest.java"
  1356. unless="some.regexp.support"/>
  1357. <exclude name="${optional.package}/Rhino*.java"
  1358. unless="bsf.present"/>
  1359. <exclude name="${optional.package}/Rhino*.java"
  1360. unless="rhino.present"/>
  1361. <exclude name="${optional.package}/script/*.java"
  1362. unless="bsf.present"/>
  1363. <exclude name="${optional.package}/script/*.java"
  1364. unless="rhino.present"/>
  1365. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1366. unless="bsf.present"/>
  1367. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1368. unless="beanshell.present"/>
  1369. <!-- fail if testcases can be loaded from the system classloader -->
  1370. <exclude name="${ant.package}/AntClassLoaderDelegationTest.java"
  1371. if="tests.are.on.system.classpath"/>
  1372. <exclude name="${optional.package}/junit/JUnitClassLoaderTest.java"
  1373. if="tests.are.on.system.classpath"/>
  1374. <exclude name="${optional.package}/sitraka/XMLReportTest.java"
  1375. if="tests.are.on.system.classpath"/>
  1376. <!-- these tests need to be localised before being ran???? -->
  1377. <exclude name="${optional.package}/PvcsTest.java"/>
  1378. <!-- These tests need a TraX implementation like xalan2 or saxon -->
  1379. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1380. unless="trax.impl.present"/>
  1381. <exclude name="${optional.package}/XsltTest.java"
  1382. unless="trax.impl.present"/>
  1383. <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
  1384. unless="trax.impl.present"/>
  1385. <exclude name="${optional.package}/junit/JUnitReportTest.java"
  1386. unless="run.junitreport"/>
  1387. <exclude name="${ant.package}/taskdefs/StyleTest.java"
  1388. unless="trax.impl.present"/>
  1389. <!-- needs BSF to work -->
  1390. <exclude name="${optional.package}/XalanLiaisonTest.java"
  1391. unless="bsf.present"/>
  1392. <exclude name="${optional.package}/XalanLiaisonTest.java"
  1393. unless="xerces1.present"/>
  1394. <exclude name="${optional.package}/XslpLiaisonTest.java"
  1395. unless="xerces1.present"/>
  1396. <!-- needs resolver.jar to work -->
  1397. <exclude name="${optional.package}/XmlValidateCatalogTest.java"
  1398. unless="apache.resolver.present"/>
  1399. <!-- needs jasperc -->
  1400. <exclude name="${optional.package}/JspcTest.java"
  1401. unless="jasper.present"/>
  1402. <!-- misc oneoff tests -->
  1403. <exclude name="${optional.package}/WsdlToDotnetTest.java"
  1404. unless="dotnetapps.found"/>
  1405. <exclude name="${optional.package}/DotnetTest.java"
  1406. unless="dotnetapps.found"/>
  1407. <!-- These tests only passes if testcases and Ant classes have
  1408. been loaded by the same classloader - will throw
  1409. IllegalAccessExceptions otherwise. -->
  1410. <exclude name="${ant.package}/taskdefs/SQLExecTest.java"
  1411. unless="tests.and.ant.share.classloader"/>
  1412. <exclude name="${optional.package}/sos/SOSTest.java"
  1413. unless="tests.and.ant.share.classloader"/>
  1414. <exclude name="${optional.package}/vss/MSVSSTest.java"
  1415. unless="tests.and.ant.share.classloader"/>
  1416. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1417. unless="tests.and.ant.share.classloader"/>
  1418. <exclude name="${optional.package}/metamata/MAuditParserTest.java"
  1419. unless="tests.and.ant.share.classloader"/>
  1420. <exclude name="${ant.package}/taskdefs/ProcessDestroyerTest.java"
  1421. unless="tests.and.ant.share.classloader"/>
  1422. <exclude name="${ant.package}/taskdefs/ProtectedJarMethodsTest.java"
  1423. unless="tests.and.ant.share.classloader"/>
  1424. <!-- can only run if cvs is installed on your machine
  1425. enable by setting the property have.cvs
  1426. -->
  1427. <exclude name="${ant.package}/taskdefs/AbstractCvsTaskTest.java"
  1428. unless="have.cvs"/>
  1429. <!-- needs a local ftp server and the entry of a user/password combination -->
  1430. <exclude name="${optional.package}/net/FTPTest.java"/>
  1431. <!-- test needs special setup -->
  1432. <exclude name="${optional.package}/ssh/ScpTest.java"/>
  1433. </fileset>
  1434. </batchtest>
  1435. </junit>
  1436. <fail if="tests.failed">At least one test has failed.</fail>
  1437. </target>
  1438. <target name="run-single-test" if="testcase" depends="compile-tests,run-single-test-only"
  1439. description="--> runs the single unit test defined in the testcase property"/>
  1440. <target name="run-single-test-only" if="testcase"
  1441. description="--> runs the single unit test defined in the testcase property">
  1442. <junit printsummary="${junit.summary}"
  1443. haltonfailure="${test.haltonfailure}"
  1444. fork="${junit.fork}"
  1445. filtertrace="${junit.filtertrace}">
  1446. <!-- <jvmarg value="-classic"/> -->
  1447. <sysproperty key="ant.home" value="${ant.home}"/>
  1448. <sysproperty key="build.tests" file="${build.tests}"/>
  1449. <sysproperty key="build.tests.value" value="${build.tests.value}"/>
  1450. <sysproperty key="offline" value="${offline}"/>
  1451. <sysproperty key="tests-classpath.value"
  1452. value="${tests-classpath.value}"/>
  1453. <classpath refid="tests-classpath"/>
  1454. <formatter type="plain" usefile="false"/>
  1455. <test name="${testcase}"/>
  1456. </junit>
  1457. </target>
  1458. <target name="interactive-tests" description="--> runs interactive tests"
  1459. depends="compile-tests"
  1460. if="jdk1.3+">
  1461. <java classpathref="tests-classpath"
  1462. classname="org.apache.tools.ant.taskdefs.TestProcess"
  1463. fork="true"/>
  1464. </target>
  1465. <!--
  1466. ===================================================================
  1467. Main target - runs dist-lite by default
  1468. ===================================================================
  1469. -->
  1470. <target name="main"
  1471. description="--> creates a minimum distribution in ./dist"
  1472. depends="dist-lite"/>
  1473. </project>