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

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