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

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