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

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