You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 63 kB

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