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