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

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