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

build.xml 61 kB

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