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

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