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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634
  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.package}/script/**/*"/>
  187. <filename name="${optional.type.package}/Script*"/>
  188. </or>
  189. </selector>
  190. <selector id="needs.stylebook">
  191. <filename name="${optional.package}/StyleBook*"/>
  192. </selector>
  193. <selector id="needs.javamail">
  194. <or>
  195. <filename name="${ant.package}/taskdefs/email/MimeMailer*"/>
  196. </or>
  197. </selector>
  198. <selector id="needs.icontract">
  199. <filename name="${optional.package}/IContract*"/>
  200. </selector>
  201. <selector id="needs.netrexx">
  202. <filename name="${optional.package}/NetRexxC*"/>
  203. </selector>
  204. <selector id="needs.weblogic.ejbc">
  205. <filename name="${optional.package}/ejb/Ejbc*"/>
  206. </selector>
  207. <selector id="needs.weblogic.ddcreator">
  208. <filename name="${optional.package}/ejb/DDCreator*"/>
  209. </selector>
  210. <selector id="needs.weblogic.server">
  211. <or>
  212. <filename name="${optional.package}/ejb/WLRun*"/>
  213. <filename name="${optional.package}/ejb/WLStop*"/>
  214. </or>
  215. </selector>
  216. <selector id="needs.commons.net">
  217. <or>
  218. <filename name="${optional.package}/net/FTP*"/>
  219. <filename name="${optional.package}/net/RExec*"/>
  220. <filename name="${optional.package}/net/TelnetTask*"/>
  221. </or>
  222. </selector>
  223. <selector id="needs.starteam">
  224. <or>
  225. <filename name="${optional.package}/scm/AntStarTeam*"/>
  226. <filename name="${optional.package}/starteam/*"/>
  227. </or>
  228. </selector>
  229. <selector id="needs.vaj">
  230. <filename name="${optional.package}/ide/VAJ*"/>
  231. </selector>
  232. <selector id="needs.antlr">
  233. <filename name="${optional.package}/ANTLR*"/>
  234. </selector>
  235. <selector id="needs.jmf">
  236. <filename name="${optional.package}/sound/*"/>
  237. </selector>
  238. <selector id="needs.jai">
  239. <or>
  240. <filename name="${optional.package}/image/*"/>
  241. <filename name="${ant.package}/types/optional/image/*"/>
  242. </or>
  243. </selector>
  244. <selector id="needs.jdepend">
  245. <filename name="${optional.package}/jdepend/*"/>
  246. </selector>
  247. <selector id="needs.swing">
  248. <filename name="${optional.package}/splash/*"/>
  249. </selector>
  250. <selector id="needs.jsch">
  251. <filename name="${optional.package}/ssh/*"/>
  252. </selector>
  253. <patternset id="onlinetests">
  254. <exclude name="**/GetTest.java" if="offline"/>
  255. <exclude name="**/SignJarTest.java" if="offline"/>
  256. </patternset>
  257. <patternset id="teststhatfail">
  258. <exclude name="${optional.package}/BeanShellScriptTest.java"/>
  259. <exclude name="${ant.package}/taskdefs/ImportTest.java"/>
  260. </patternset>
  261. <!--
  262. ===================================================================
  263. Set up a patternsets that matches the parts of our JUnit testsuite
  264. that may be useful for task developers.
  265. ===================================================================
  266. -->
  267. <patternset id="useful.tests">
  268. <include name="${ant.package}/BuildFileTest*"/>
  269. <include name="${regexp.package}/RegexpMatcherTest*"/>
  270. <include name="${regexp.package}/RegexpTest*"/>
  271. <include name="${optional.package}/AbstractXSLTLiaisonTest*"/>
  272. <include name="${ant.package}/types/AbstractFileSetTest*"/>
  273. </patternset>
  274. <!--
  275. ===================================================================
  276. Set up a patternsets that matches the parts of our site that
  277. should not be part of the distribution.
  278. ===================================================================
  279. -->
  280. <patternset id="site.excludes">
  281. <exclude name="bindownload.html"/>
  282. <exclude name="srcdownload.html"/>
  283. <exclude name="*.cgi"/>
  284. </patternset>
  285. <!--
  286. ===================================================================
  287. Check to see what optional dependencies are available
  288. ===================================================================
  289. -->
  290. <target name="check_for_optional_packages">
  291. <available property="jdk1.3+" classname="java.lang.StrictMath"/>
  292. <available property="jdk1.4+" classname="java.lang.CharSequence"/>
  293. <available property="kaffe" classname="kaffe.util.NotImplemented"/>
  294. <available property="bsf.present"
  295. classname="org.apache.bsf.BSFManager"
  296. classpathref="classpath"/>
  297. <available property="netrexx.present"
  298. classname="netrexx.lang.Rexx"
  299. classpathref="classpath"/>
  300. <available property="trax.present"
  301. classname="javax.xml.transform.Transformer"
  302. classpathref="classpath"/>
  303. <condition property="trax.impl.present">
  304. <or>
  305. <and>
  306. <isset property="javax.xml.transform.TransformerFactory"/>
  307. <available classname="${javax.xml.transform.TransformerFactory}"
  308. classpathref="classpath"/>
  309. </and>
  310. <available resource="META-INF/services/javax.xml.transform.TransformerFactory"/>
  311. </or>
  312. </condition>
  313. <available property="xslp.present"
  314. classname="com.kvisco.xsl.XSLProcessor"
  315. classpathref="classpath"/>
  316. <available property="apache.resolver.present"
  317. classname="org.apache.xml.resolver.tools.CatalogResolver"
  318. classpathref="classpath" />
  319. <available property="xalan.present"
  320. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  321. classpathref="classpath"/>
  322. <available property="xalan2.present"
  323. classname="org.apache.xalan.transformer.TransformerImpl"
  324. classpathref="classpath"/>
  325. <available property="ejb.ejbc.present"
  326. classname="weblogic.ejbc"
  327. classpathref="classpath"/>
  328. <available property="ejb.DDCreator.present"
  329. classname="weblogic.ejb.utils.DDCreator"
  330. classpathref="classpath"/>
  331. <available property="ejb.wls.present"
  332. classname="weblogic.Server"
  333. classpathref="classpath"/>
  334. <available property="junit.present"
  335. classname="junit.framework.TestCase"
  336. classpathref="classpath"/>
  337. <available property="commons.net.present"
  338. classname="org.apache.commons.net.ftp.FTPClient"
  339. classpathref="classpath"/>
  340. <available property="starteam.present"
  341. classname="com.starbase.util.Platform"
  342. classpathref="classpath"/>
  343. <available property="antlr.present"
  344. classname="antlr.Tool"
  345. classpathref="classpath"/>
  346. <available property="vaj.present"
  347. classname="com.ibm.ivj.util.base.Workspace"
  348. classpathref="classpath"/>
  349. <available property="stylebook.present"
  350. classname="org.apache.stylebook.Engine"
  351. classpathref="classpath"/>
  352. <available property="jakarta.regexp.present"
  353. classname="org.apache.regexp.RE"
  354. classpathref="classpath"/>
  355. <available property="jakarta.oro.present"
  356. classname="org.apache.oro.text.regex.Perl5Matcher"
  357. classpathref="classpath"/>
  358. <available property="jmf.present"
  359. classname="javax.sound.sampled.Clip"
  360. classpathref="classpath"/>
  361. <available property="jai.present"
  362. classname="javax.media.jai.JAI"
  363. classpathref="classpath"/>
  364. <available property="icontract.present"
  365. classname="com.reliablesystems.iContract.IContracted"
  366. classpathref="classpath"/>
  367. <available property="jdepend.present"
  368. classname="jdepend.framework.JDepend"
  369. classpathref="classpath"/>
  370. <available property="log4j.present"
  371. classname="org.apache.log4j.Category"
  372. classpathref="classpath"/>
  373. <available property="commons.logging.present"
  374. classname="org.apache.commons.logging.LogFactory"
  375. classpathref="classpath"/>
  376. <available property="xalan.envcheck"
  377. classname="org.apache.xalan.xslt.EnvironmentCheck"
  378. classpathref="classpath"/>
  379. <available property="which.present"
  380. classname="org.apache.env.Which"
  381. classpathref="classpath"/>
  382. <available property="xerces.present"
  383. classname="org.apache.xerces.parsers.SAXParser"
  384. classpathref="classpath"/>
  385. <available property="bcel.present"
  386. classname="org.apache.bcel.Constants"
  387. classpathref="classpath"/>
  388. <available property="sunuue.present"
  389. classname="sun.misc.UUEncoder"
  390. classpathref="classpath"/>
  391. <condition property="javamail.complete">
  392. <and>
  393. <available classname="javax.activation.DataHandler"
  394. classpathref="classpath"/>
  395. <available classname="javax.mail.Transport"
  396. classpathref="classpath"/>
  397. </and>
  398. </condition>
  399. <condition property="some.regexp.support">
  400. <or>
  401. <isset property="jdk1.4+"/>
  402. <isset property="jakarta.regexp.present"/>
  403. <isset property="jakarta.oro.present"/>
  404. </or>
  405. </condition>
  406. <condition property="tests.and.ant.share.classloader">
  407. <or>
  408. <equals arg1="${junit.fork}" arg2="true"/>
  409. <equals arg1="${build.sysclasspath}" arg2="only"/>
  410. </or>
  411. </condition>
  412. <condition property="sun.tools.present">
  413. <and>
  414. <available classname="sun.tools.native2ascii.Main"/>
  415. <available classname="com.sun.tools.javah.Main"/>
  416. </and>
  417. </condition>
  418. <available property="base64.present" classname="sun.misc.BASE64Encoder"/>
  419. <property name="build.tests.resolved" location="${build.tests}"/>
  420. <condition property="tests.are.on.system.classpath">
  421. <or>
  422. <!-- relative paths in CLASSPATH -->
  423. <contains string="${java.class.path}"
  424. substring="${build.tests}"/>
  425. <!-- absolute paths in CLASSPATH -->
  426. <contains string="${java.class.path}"
  427. substring="${build.tests.resolved}"/>
  428. </or>
  429. </condition>
  430. <condition property="jasper.present">
  431. <and>
  432. <available classname="org.apache.jasper.compiler.Compiler"/>
  433. <available classname="org.apache.jasper.JasperException"/>
  434. </and>
  435. </condition>
  436. <condition property="swing.present">
  437. <or>
  438. <not>
  439. <isset property="kaffe"/>
  440. </not>
  441. <available classname="javax.swing.ImageIcon"
  442. classpathref="classpath"/>
  443. </or>
  444. </condition>
  445. <condition property="wsdl.found">
  446. <or>
  447. <available file="wsdl" filepath="${env.PATH}"/>
  448. <available file="wsdl.exe" filepath="${env.PATH}"/>
  449. <available file="wsdl.exe" filepath="${env.Path}"/>
  450. </or>
  451. </condition>
  452. <echo level="verbose"> wsdl.found=${wsdl.found}</echo>
  453. <condition property="csc.found">
  454. <or>
  455. <available file="csc" filepath="${env.PATH}"/>
  456. <available file="csc.exe" filepath="${env.PATH}"/>
  457. <available file="csc.exe" filepath="${env.Path}"/>
  458. </or>
  459. </condition>
  460. <echo level="verbose"> csc.found=${csc.found}</echo>
  461. <condition property="dotnetapps.found">
  462. <and>
  463. <isset property="csc.found"/>
  464. <isset property="wsdl.found"/>
  465. </and>
  466. </condition>
  467. <echo level="verbose"> dotnetapps.found=${dotnetapps.found}</echo>
  468. <available property="rhino.present"
  469. classname="org.mozilla.javascript.Scriptable"
  470. classpathref="classpath"/>
  471. <available property="beanshell.present"
  472. classname="bsh.StringUtil"
  473. classpathref="classpath"/>
  474. <available property="jsch.present"
  475. classname="com.jcraft.jsch.Session"
  476. classpathref="classpath"/>
  477. </target>
  478. <!--
  479. ===================================================================
  480. Prepare the build
  481. ===================================================================
  482. -->
  483. <target name="prepare">
  484. <tstamp>
  485. <format property="year" pattern="yyyy"/>
  486. </tstamp>
  487. <filterchain id="ant.filters">
  488. <replacetokens>
  489. <token key="VERSION" value="${version}"/>
  490. <token key="DATE" value="${TODAY}"/>
  491. <token key="TIME" value="${TSTAMP}"/>
  492. </replacetokens>
  493. </filterchain>
  494. </target>
  495. <!--
  496. ===================================================================
  497. Build the code
  498. ===================================================================
  499. -->
  500. <target name="build"
  501. depends="prepare, check_for_optional_packages"
  502. description="--> compiles the source code">
  503. <mkdir dir="${build.dir}"/>
  504. <mkdir dir="${build.classes}"/>
  505. <mkdir dir="${build.lib}"/>
  506. <javac srcdir="${java.dir}"
  507. destdir="${build.classes}"
  508. debug="${debug}"
  509. deprecation="${deprecation}"
  510. target="${javac.target}"
  511. optimize="${optimize}" >
  512. <classpath refid="classpath"/>
  513. <selector id="conditional-patterns">
  514. <not>
  515. <or>
  516. <selector refid="needs.jdk1.3+" unless="jdk1.3+"/>
  517. <selector refid="needs.jdk1.4+" unless="jdk1.4+"/>
  518. <selector refid="needs.sun.tools" unless="sun.tools.present"/>
  519. <selector refid="needs.sun.uue" unless="sunuue.present"/>
  520. <selector refid="needs.sun.b64" unless="base64.present"/>
  521. <selector refid="needs.trax" unless="trax.present"/>
  522. <selector refid="needs.xalan1" unless="xalan.present"/>
  523. <selector refid="needs.xalan2" unless="xalan2.present"/>
  524. <selector refid="needs.xslp" unless="xslp.present"/>
  525. <selector refid="needs.apache.resolver" unless="apache.resolver.present"/>
  526. <selector refid="needs.junit" unless="junit.present"/>
  527. <selector refid="needs.jakarta.regexp"
  528. unless="jakarta.regexp.present"/>
  529. <selector refid="needs.jakarta.oro" unless="jakarta.oro.present"/>
  530. <selector refid="needs.jakarta.bcel" unless="bcel.present"/>
  531. <selector refid="needs.jakarta.log4j" unless="log4j.present"/>
  532. <selector refid="needs.commons.logging"
  533. unless="commons.logging.present"/>
  534. <selector refid="needs.bsf" unless="bsf.present"/>
  535. <selector refid="needs.stylebook" unless="stylebook.present"/>
  536. <selector refid="needs.javamail" unless="javamail.complete"/>
  537. <selector refid="needs.icontract" unless="icontract.present"/>
  538. <selector refid="needs.netrexx" unless="netrexx.present"/>
  539. <selector refid="needs.weblogic.ejbc" unless="ejb.ejbc.present"/>
  540. <selector refid="needs.weblogic.ddcreator"
  541. unless="ejb.DDCreator.present"/>
  542. <selector refid="needs.weblogic.server" unless="ejb.wls.present"/>
  543. <selector refid="needs.commons.net" unless="commons.net.present"/>
  544. <selector refid="needs.starteam" unless="starteam.present"/>
  545. <selector refid="needs.vaj" unless="vaj.present"/>
  546. <selector refid="needs.antlr" unless="antlr.present"/>
  547. <selector refid="needs.jmf" unless="jmf.present"/>
  548. <selector refid="needs.jai" unless="jai.present"/>
  549. <selector refid="needs.jdepend" unless="jdepend.present"/>
  550. <selector refid="needs.swing" unless="swing.present"/>
  551. <selector refid="needs.jsch" unless="jsch.present"/>
  552. </or>
  553. </not>
  554. </selector>
  555. </javac>
  556. <copy todir="${build.classes}">
  557. <fileset dir="${java.dir}">
  558. <include name="**/*.properties"/>
  559. <include name="**/*.dtd"/>
  560. </fileset>
  561. </copy>
  562. <copy todir="${build.classes}"
  563. overwrite="true" encoding="UTF-8">
  564. <fileset dir="${java.dir}">
  565. <include name="**/version.txt"/>
  566. <include name="**/defaultManifest.mf"/>
  567. </fileset>
  568. <filterchain refid="ant.filters"/>
  569. </copy>
  570. <copy todir="${build.classes}/${optional.package}/junit/xsl">
  571. <fileset dir="${etc.dir}">
  572. <include name="junit-frames.xsl"/>
  573. <include name="junit-noframes.xsl"/>
  574. </fileset>
  575. </copy>
  576. </target>
  577. <!--
  578. ===================================================================
  579. Create the Apache Ant jars: ant.jar and optional.jar
  580. ===================================================================
  581. -->
  582. <target name="jars"
  583. depends="build"
  584. description="--> creates the Apache Ant jars">
  585. <copy todir="${build.dir}">
  586. <fileset dir=".">
  587. <include name="LICENSE"/>
  588. <include name="LICENSE.xerces"/>
  589. <include name="LICENSE.dom"/>
  590. <include name="LICENSE.sax"/>
  591. </fileset>
  592. <mapper type="glob" from="*" to="*.txt"/>
  593. </copy>
  594. <copy file="${manifest}" tofile="${manifest.tmp}"/>
  595. <manifest file="${manifest.tmp}">
  596. <section name="${optional.package}/">
  597. <attribute name="Extension-name"
  598. value="org.apache.tools.ant"/>
  599. <attribute name="Specification-Title"
  600. value="Apache Ant"/>
  601. <attribute name="Specification-Version"
  602. value="${manifest-version}"/>
  603. <attribute name="Specification-Vendor"
  604. value="Apache Software Foundation"/>
  605. <attribute name="Implementation-Title"
  606. value="org.apache.tools.ant"/>
  607. <attribute name="Implementation-Version"
  608. value="${manifest-version}"/>
  609. <attribute name="Implementation-Vendor"
  610. value="Apache Software Foundation"/>
  611. </section>
  612. </manifest>
  613. <jar destfile="${build.lib}/${name}.jar"
  614. basedir="${build.classes}"
  615. manifest="${manifest}">
  616. <not>
  617. <selector id="non-core">
  618. <or>
  619. <filename name="${optional.package}/**"/>
  620. <filename name="${optional.type.package}/**"/>
  621. <filename name="${util.package}/depend/**"/>
  622. <filename name="${util.package}/optional/**"/>
  623. <selector refid="needs.jakarta.log4j"/>
  624. <selector refid="needs.commons.logging"/>
  625. <selector refid="needs.jakarta.regexp"/>
  626. <selector refid="needs.jakarta.oro"/>
  627. <selector refid="needs.jdk1.4+"/>
  628. <selector refid="needs.javamail"/>
  629. </or>
  630. </selector>
  631. </not>
  632. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  633. <manifest>
  634. <section name="${ant.package}/">
  635. <attribute name="Extension-name"
  636. value="org.apache.tools.ant"/>
  637. <attribute name="Specification-Title"
  638. value="Apache Ant"/>
  639. <attribute name="Specification-Version"
  640. value="${manifest-version}"/>
  641. <attribute name="Specification-Vendor"
  642. value="Apache Software Foundation"/>
  643. <attribute name="Implementation-Title"
  644. value="org.apache.tools.ant"/>
  645. <attribute name="Implementation-Version"
  646. value="${manifest-version}"/>
  647. <attribute name="Implementation-Vendor"
  648. value="Apache Software Foundation"/>
  649. </section>
  650. </manifest>
  651. <fileset dir="${docs.dir}">
  652. <include name="images/ant_logo_large.gif"/>
  653. </fileset>
  654. </jar>
  655. <jar destfile="${build.lib}/optional.jar"
  656. basedir="${build.classes}"
  657. manifest="${manifest.tmp}">
  658. <selector refid="non-core"/>
  659. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  660. </jar>
  661. <jar destfile="${build.lib}/${bootstrap.jar}"
  662. basedir="${build.classes}"
  663. manifest="${manifest}">
  664. <include name="${ant.package}/Main.class"/>
  665. <metainf dir="${build.dir}" includes="LICENSE.txt"/>
  666. <manifest>
  667. <attribute name="Class-Path"
  668. value="ant.jar xml-apis.jar xercesImpl.jar optional.jar xalan.jar"/>
  669. </manifest>
  670. </jar>
  671. <jar destfile="${build.lib}/nodeps.jar"
  672. basedir="${build.classes}"
  673. manifest="${manifest.tmp}">
  674. <and>
  675. <selector refid="non-core"/>
  676. <not>
  677. <or>
  678. <selector refid="needs.trax"/>
  679. <selector refid="needs.xalan1"/>
  680. <selector refid="needs.xalan2"/>
  681. <selector refid="needs.xslp"/>
  682. <selector refid="needs.apache.resolver"/>
  683. <selector refid="needs.junit"/>
  684. <selector refid="needs.jakarta.regexp"/>
  685. <selector refid="needs.jakarta.oro"/>
  686. <selector refid="needs.jakarta.bcel"/>
  687. <selector refid="needs.jakarta.log4j"/>
  688. <selector refid="needs.commons.logging"/>
  689. <selector refid="needs.bsf"/>
  690. <selector refid="needs.stylebook"/>
  691. <selector refid="needs.javamail"/>
  692. <selector refid="needs.icontract"/>
  693. <selector refid="needs.netrexx"/>
  694. <selector refid="needs.weblogic.ejbc"/>
  695. <selector refid="needs.weblogic.ddcreator"/>
  696. <selector refid="needs.weblogic.server"/>
  697. <selector refid="needs.commons.net"/>
  698. <selector refid="needs.starteam"/>
  699. <selector refid="needs.vaj"/>
  700. <selector refid="needs.antlr"/>
  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,*.cmd"/>
  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}" maxparallel="${chmod.maxparallel}"/>
  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}" maxparallel="${chmod.maxparallel}"/>
  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,*.cmd"/>
  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 destfile="${dist.base}/bin/${dist.name}-bin.tar.gz"
  1096. src="${dist.base}/bin/${dist.name}-bin.tar"/>
  1097. <bzip2 destfile="${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 destfile="${dist.base}/src/${dist.name}-src.tar.gz"
  1135. src="${dist.base}/src/${dist.name}-src.tar"/>
  1136. <bzip2 destfile="${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. <tag name="ant.attribute" enabled="false" description="Attribute:" scope="types"/>
  1226. <tag name="ant.attribute.group" enabled="false" description="Attribute group:" scope="types"/>
  1227. <tag name="ant.element" enabled="false" description="Nested element:" scope="types"/>
  1228. <group title="Apache Ant Core" packages="org.apache.tools.ant*"/>
  1229. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*"/>
  1230. <group title="Core Types" packages="org.apache.tools.ant.types*"/>
  1231. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*"/>
  1232. <group title="Optional Types" packages="org.apache.tools.ant.types.optional*"/>
  1233. <group title="Ant Utilities" packages="org.apache.tools.ant.util*"/>
  1234. <bottom>Copyright &#169; 2000-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  1235. </javadoc>
  1236. </target>
  1237. <target name="test-javadocs" depends="prepare, javadoc_check"
  1238. unless="tests.javadoc.notrequired"
  1239. description="--> creates the API documentation for test utilities">
  1240. <mkdir dir="${build.tests.javadocs}"/>
  1241. <javadoc useexternalfile="yes"
  1242. destdir="${build.tests.javadocs}"
  1243. author="true"
  1244. version="true"
  1245. locale="en"
  1246. windowtitle="${Name} Test Utilities"
  1247. doctitle="${Name}">
  1248. <fileset dir="${tests.dir}">
  1249. <patternset refid="useful.tests"/>
  1250. </fileset>
  1251. <bottom>Copyright &#169; 2000-${year} Apache Software Foundation. All Rights Reserved.</bottom>
  1252. </javadoc>
  1253. </target>
  1254. <!--
  1255. ===================================================================
  1256. Compile testcases
  1257. ===================================================================
  1258. -->
  1259. <target name="compile-tests" depends="build" if="junit.present">
  1260. <mkdir dir="${build.tests}"/>
  1261. <javac srcdir="${tests.dir}"
  1262. destdir="${build.tests}"
  1263. debug="${debug}"
  1264. target="${javac.target}"
  1265. deprecation="${deprecation}" >
  1266. <classpath refid="tests-classpath"/>
  1267. <selector refid="conditional-patterns"/>
  1268. </javac>
  1269. </target>
  1270. <target name="dump-info" depends="dump-sys-properties,run-which"/>
  1271. <target name="dump-sys-properties" unless="which.present"
  1272. depends="xml-check">
  1273. <echo message="java.vm.info=${java.vm.info}"/>
  1274. <echo message="java.vm.name=${java.vm.name}"/>
  1275. <echo message="java.vm.vendor=${java.vm.vendor}"/>
  1276. <echo message="java.vm.version=${java.vm.version}"/>
  1277. <echo message="os.arch=${os.arch}"/>
  1278. <echo message="os.name=${os.name}"/>
  1279. <echo message="os.version=${os.version}"/>
  1280. <echo message="file.encoding=${file.encoding}"/>
  1281. <echo message="user.language=${user.language}"/>
  1282. </target>
  1283. <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors -->
  1284. <target name="xml-check" depends="check_for_optional_packages"
  1285. if="xalan.envcheck" unless="which.present">
  1286. <java classname="org.apache.xalan.xslt.EnvironmentCheck"/>
  1287. </target>
  1288. <target name="run-which" depends="check_for_optional_packages"
  1289. if="which.present">
  1290. <java classname="org.apache.env.Which" taskname="which"/>
  1291. </target>
  1292. <!-- test to see if we are online or not. can take a while when we are off line, so
  1293. setting the property is a good shortcut-->
  1294. <target name="probe-offline">
  1295. <condition property="offline">
  1296. <or>
  1297. <isset property="offline"/>
  1298. <not>
  1299. <http url="http://www.apache.org/"/>
  1300. </not>
  1301. </or>
  1302. </condition>
  1303. <echo level="verbose" > offline=${offline}</echo>
  1304. </target>
  1305. <!--
  1306. ===================================================================
  1307. Run testcase
  1308. ===================================================================
  1309. -->
  1310. <target name="test" depends="run-tests" description="--> run JUnit tests"/>
  1311. <target name="run-tests" depends="dump-info,compile-tests,probe-offline" if="junit.present">
  1312. <condition property="run.junitreport">
  1313. <or>
  1314. <isset property="xalan2.present"/>
  1315. <and>
  1316. <isset property="xalan.present"/>
  1317. <isset property="bsf.present"/>
  1318. </and>
  1319. </or>
  1320. </condition>
  1321. <junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}"
  1322. filtertrace="${junit.filtertrace}"
  1323. fork="${junit.fork}"
  1324. failureproperty="tests.failed">
  1325. <!-- <jvmarg value="-classic"/> -->
  1326. <classpath refid="tests-classpath"/>
  1327. <sysproperty key="ant.home" value="${ant.home}"/>
  1328. <sysproperty key="build.tests" value="${build.tests}"/>
  1329. <sysproperty key="tests-classpath.value"
  1330. value="${tests-classpath.value}"/>
  1331. <formatter type="brief" usefile="false"/>
  1332. <batchtest>
  1333. <fileset dir="${tests.dir}">
  1334. <include name="**/*Test*"/>
  1335. <!-- abstract classes, not testcases -->
  1336. <exclude name="${ant.package}/taskdefs/TaskdefsTest.java"/>
  1337. <exclude name="${ant.package}/BuildFileTest.java"/>
  1338. <exclude name="${regexp.package}/RegexpMatcherTest.java"/>
  1339. <exclude name="${regexp.package}/RegexpTest.java"/>
  1340. <exclude name="${optional.package}/AbstractXSLTLiaisonTest.java"/>
  1341. <exclude name="${ant.package}/types/AbstractFileSetTest.java"/>
  1342. <exclude name="${ant.package}/types/selectors/BaseSelectorTest.java"/>
  1343. <!-- helper classes, not testcases -->
  1344. <exclude name="org/example/**"/>
  1345. <exclude name="${ant.package}/taskdefs/TaskdefTest*Task.java"/>
  1346. <!-- interactive tests -->
  1347. <exclude name="${ant.package}/taskdefs/TestProcess.java"/>
  1348. <exclude name="${optional.package}/splash/SplashScreenTest.java"/>
  1349. <!-- only run these tests if their required libraries are
  1350. installed -->
  1351. <selector refid="conditional-patterns"/>
  1352. <!-- tests excluded if the test is run in offline mode -->
  1353. <patternset refid="onlinetests"/>
  1354. <!-- failing tests excluded unless run.failing.tests is set -->
  1355. <patternset refid="teststhatfail"/>
  1356. <!-- runtime dependencies that are different from compile
  1357. time dependencies -->
  1358. <exclude name="${optional.package}/ReplaceRegExpTest.java"
  1359. unless="some.regexp.support"/>
  1360. <exclude name="${optional.package}/sitraka/*.java"
  1361. unless="some.regexp.support"/>
  1362. <exclude name="${ant.package}/types/selectors/ContainsRegexpTest.java"
  1363. unless="some.regexp.support"/>
  1364. <exclude name="${optional.package}/RhinoScriptTest.java"
  1365. unless="bsf.present"/>
  1366. <exclude name="${optional.package}/RhinoScriptTest.java"
  1367. unless="rhino.present"/>
  1368. <exclude name="${optional.package}/script/*.java"
  1369. unless="rhino.present"/>
  1370. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1371. unless="bsf.present"/>
  1372. <exclude name="${optional.package}/BeanShellScriptTest.java"
  1373. unless="beanshell.present"/>
  1374. <!-- fail if testcases can be loaded from the system classloader -->
  1375. <exclude name="${optional.package}/junit/JUnitClassLoaderTest.java"
  1376. if="tests.are.on.system.classpath"/>
  1377. <exclude name="${optional.package}/sitraka/XMLReportTest.java"
  1378. if="tests.are.on.system.classpath"/>
  1379. <!-- these tests need to be localised before being ran???? -->
  1380. <exclude name="${optional.package}/PvcsTest.java"/>
  1381. <!-- These tests need a TraX implementation like xalan2 or saxon -->
  1382. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1383. unless="trax.impl.present"/>
  1384. <exclude name="${optional.package}/XsltTest.java"
  1385. unless="trax.impl.present"/>
  1386. <exclude name="${ant.package}/types/XMLCatalogBuildFileTest.java"
  1387. unless="trax.impl.present"/>
  1388. <exclude name="${optional.package}/junit/JUnitReportTest.java"
  1389. unless="run.junitreport"/>
  1390. <!-- needs BSF to work -->
  1391. <exclude name="${optional.package}/XalanLiaisonTest.java"
  1392. unless="bsf.present"/>
  1393. <!-- needs resolver.jar to work -->
  1394. <exclude name="${optional.package}/XmlValidateCatalogTest.java"
  1395. unless="apache.resolver.present"/>
  1396. <!-- needs jasperc -->
  1397. <exclude name="${optional.package}/JspcTest.java"
  1398. unless="jasper.present"/>
  1399. <!-- misc oneoff tests -->
  1400. <exclude name="${optional.package}/WsdlToDotnetTest.java"
  1401. unless="dotnetapps.found"/>
  1402. <exclude name="${optional.package}/DotnetTest.java"
  1403. unless="dotnetapps.found"/>
  1404. <!-- These tests only passes if testcases and Ant classes have
  1405. been loaded by the same classloader - will throw
  1406. IllegalAccessExceptions otherwise. -->
  1407. <exclude name="${ant.package}/taskdefs/SQLExecTest.java"
  1408. unless="tests.and.ant.share.classloader"/>
  1409. <exclude name="${optional.package}/sos/SOSTest.java"
  1410. unless="tests.and.ant.share.classloader"/>
  1411. <exclude name="${optional.package}/vss/MSVSSTest.java"
  1412. unless="tests.and.ant.share.classloader"/>
  1413. <exclude name="${optional.package}/TraXLiaisonTest.java"
  1414. unless="tests.and.ant.share.classloader"/>
  1415. <exclude name="${optional.package}/metamata/MAuditParserTest.java"
  1416. unless="tests.and.ant.share.classloader"/>
  1417. <exclude name="${ant.package}/taskdefs/ProcessDestroyerTest.java"
  1418. unless="tests.and.ant.share.classloader"/>
  1419. <!-- can only run if cvs is installed on your machine
  1420. enable by setting the property have.cvs
  1421. -->
  1422. <exclude name="${ant.package}/taskdefs/AbstractCvsTaskTest.java"
  1423. unless="have.cvs"/>
  1424. <!-- test needs special setup -->
  1425. <exclude name="${optional.package}/ssh/ScpTest.java"/>
  1426. </fileset>
  1427. </batchtest>
  1428. </junit>
  1429. <fail if="tests.failed">At least one test has failed.</fail>
  1430. </target>
  1431. <target name="run-single-test" if="testcase" depends="compile-tests,run-single-test-only"
  1432. description="--> runs the single unit test defined in the testcase property"/>
  1433. <target name="run-single-test-only"
  1434. description="--> runs the single unit test defined in the testcase property">
  1435. <junit printsummary="${junit.summary}"
  1436. haltonfailure="${test.haltonfailure}"
  1437. fork="${junit.fork}"
  1438. filtertrace="${junit.filtertrace}">
  1439. <!-- <jvmarg value="-classic"/> -->
  1440. <sysproperty key="ant.home" value="${ant.home}"/>
  1441. <sysproperty key="build.tests" value="${build.tests}"/>
  1442. <sysproperty key="tests-classpath.value"
  1443. value="${tests-classpath.value}"/>
  1444. <classpath refid="tests-classpath"/>
  1445. <formatter type="plain" usefile="false"/>
  1446. <test name="${testcase}"/>
  1447. </junit>
  1448. </target>
  1449. <target name="interactive-tests" description="--> runs interactive tests"
  1450. depends="compile-tests"
  1451. if="jdk1.3+">
  1452. <java classpathref="tests-classpath"
  1453. classname="org.apache.tools.ant.taskdefs.TestProcess"
  1454. fork="true"/>
  1455. </target>
  1456. <!--
  1457. ===================================================================
  1458. Main target - runs dist-lite by default
  1459. ===================================================================
  1460. -->
  1461. <target name="main"
  1462. description="--> creates a minimum distribution in ./dist"
  1463. depends="dist-lite"/>
  1464. </project>