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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <?xml version="1.0"?>
  2. <!--
  3. =======================================================================
  4. Ant own build file
  5. =======================================================================
  6. -->
  7. <project name="Ant" default="main" basedir=".">
  8. <!-- Give user a chance to override without editing this file
  9. (and without typing -D each time it compiles it) -->
  10. <property file=".ant.properties" />
  11. <property file="${user.home}/.ant.properties" />
  12. <property name="Name" value="Ant"/>
  13. <property name="name" value="ant"/>
  14. <property name="version" value="1.3alpha"/>
  15. <property name="debug" value="false" />
  16. <property name="deprecation" value="false" />
  17. <property name="optimize" value="true" />
  18. <property name="junit.fork" value="false" />
  19. <!--
  20. ===================================================================
  21. Set the properties related to the source tree
  22. ===================================================================
  23. -->
  24. <property name="src.dir" value="src"/>
  25. <property name="java.dir" value="${src.dir}/main"/>
  26. <property name="script.dir" value="${src.dir}/script"/>
  27. <property name="lib.dir" value="lib"/>
  28. <property name="docs.dir" value="docs"/>
  29. <property name="tests.dir" value="src/testcases"/>
  30. <property name="tests.etc.dir" value="src/etc/testcases"/>
  31. <property name="ant.package" value="org/apache/tools/ant"/>
  32. <property name="optional.package" value="${ant.package}/taskdefs/optional"/>
  33. <property name="manifest" value="src/etc/manifest"/>
  34. <!--
  35. ===================================================================
  36. Set the properties for the build area
  37. ===================================================================
  38. -->
  39. <property name="build.dir" value="build"/>
  40. <property name="bootstrap.dir" value="bootstrap"/>
  41. <property name="build.classes" value="${build.dir}/classes"/>
  42. <property name="build.lib" value="${build.dir}/lib"/>
  43. <property name="build.javadocs" value="${build.dir}/javadocs"/>
  44. <property name="build.tests" value="${build.dir}/testcases"/>
  45. <path id="classpath">
  46. </path>
  47. <path id="tests-classpath">
  48. <pathelement location="${build.classes}" />
  49. <pathelement location="${build.tests}" />
  50. <path refid="classpath" />
  51. </path>
  52. <!--
  53. ===================================================================
  54. Set up properties for the distribution area
  55. ===================================================================
  56. -->
  57. <property name="dist.name" value="jakarta-${name}-${version}"/>
  58. <property name="dist.base" value="distribution"/>
  59. <target name="setup-distproperties">
  60. <property name="dist.dir" value="dist"/>
  61. <property name="dist.bin" value="${dist.dir}/bin"/>
  62. <property name="dist.lib" value="${dist.dir}/lib"/>
  63. <property name="dist.docs" value="${dist.dir}/docs"/>
  64. <property name="dist.javadocs" value="${dist.dir}/docs/api"/>
  65. <property name="src.dist.dir" value="dist-src"/>
  66. <property name="src.dist.src" value="${src.dist.dir}/src"/>
  67. <property name="src.dist.docs" value="${src.dist.dir}/docs"/>
  68. <property name="src.dist.lib" value="${src.dist.dir}/lib"/>
  69. </target>
  70. <!--
  71. ===================================================================
  72. Check to see what optional dependencies are available
  73. ===================================================================
  74. -->
  75. <target name="check_for_optional_packages">
  76. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  77. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  78. <available property="bsf.present"
  79. classname="com.ibm.bsf.BSFManager"
  80. classpathref="classpath" />
  81. <available property="netrexx.present"
  82. classname="netrexx.lang.Rexx"
  83. classpathref="classpath" />
  84. <available property="xslp.present"
  85. classname="com.kvisco.xsl.XSLProcessor"
  86. classpathref="classpath" />
  87. <available property="trax.present"
  88. classname="javax.xml.transform.Transformer"
  89. classpathref="classpath" />
  90. <available property="xalan.present"
  91. classname="org.apache.xalan.xslt.XSLTProcessorFactory"
  92. classpathref="classpath" />
  93. <available property="ejb.ejbc.present"
  94. classname="weblogic.ejbc"
  95. classpathref="classpath" />
  96. <available property="ejb.DDCreator.present"
  97. classname="weblogic.ejb.utils.DDCreator"
  98. classpathref="classpath" />
  99. <available property="ejb.wls.present"
  100. classname="weblogic.Server"
  101. classpathref="classpath" />
  102. <available property="junit.present"
  103. classname="junit.framework.TestCase"
  104. classpathref="classpath" />
  105. <available property="netcomp.present"
  106. classname="com.oroinc.net.ftp.FTPClient"
  107. classpathref="classpath" />
  108. <available property="starteam.present"
  109. classname="com.starbase.util.Platform"
  110. classpathref="classpath" />
  111. <available property="antlr.present"
  112. classname="antlr.Tool"
  113. classpathref="classpath"/>
  114. <available property="vaj.present"
  115. classname="com.ibm.ivj.util.base.Workspace"
  116. classpathref="classpath"/>
  117. <available property="stylebook.present"
  118. classname="org.apache.stylebook.Engine"
  119. classpathref="classpath"/>
  120. <available property="jakarta.regexp.present"
  121. classname="org.apache.regexp.RE"
  122. classpathref="classpath"/>
  123. <available property="jakarta.oro.present"
  124. classname="org.apache.oro.text.regex.Perl5Matcher"
  125. classpathref="classpath" />
  126. <available property="jmf.present"
  127. classname="javax.sound.sampled.Clip"
  128. classpathref="classpath"/>
  129. </target>
  130. <!--
  131. ===================================================================
  132. Prepare the build
  133. ===================================================================
  134. -->
  135. <target name="prepare">
  136. <tstamp />
  137. </target>
  138. <!--
  139. ===================================================================
  140. Build the code
  141. ===================================================================
  142. -->
  143. <target name="build" depends="prepare, check_for_optional_packages">
  144. <mkdir dir="${build.dir}"/>
  145. <mkdir dir="${build.classes}"/>
  146. <mkdir dir="${build.lib}"/>
  147. <javac srcdir="${java.dir}"
  148. destdir="${build.classes}"
  149. debug="${debug}"
  150. deprecation="${deprecation}"
  151. optimize="${optimize}" >
  152. <classpath refid="classpath" />
  153. <exclude name="${ant.package}/util/regexp/JakartaRegexpMatcher.java"
  154. unless="jakarta.regexp.present" />
  155. <exclude name="${ant.package}/util/regexp/JakartaOroMatcher.java"
  156. unless="jakarta.oro.present" />
  157. <exclude name="${optional.package}/Script.java" unless="bsf.present" />
  158. <exclude name="${optional.package}/StyleBook.java" unless="stylebook.present" />
  159. <exclude name="${optional.package}/NetRexxC.java" unless="netrexx.present" />
  160. <exclude name="${optional.package}/XslpLiaison.java" unless="xslp.present" />
  161. <exclude name="${optional.package}/XalanLiaison.java" unless="xalan.present" />
  162. <exclude name="${optional.package}/TraXLiaison.java" unless="trax.present" />
  163. <exclude name="${optional.package}/ejb/Ejbc*.java" unless="ejb.ejbc.present" />
  164. <exclude name="${optional.package}/ejb/DDCreator*.java" unless="ejb.DDCreator.present" />
  165. <exclude name="${optional.package}/ejb/WLRun.java" unless="ejb.wls.present" />
  166. <exclude name="${optional.package}/ejb/WLStop.java" unless="ejb.wls.present" />
  167. <exclude name="${optional.package}/ejb/EjbJar.java" unless="jdk1.2+" />
  168. <exclude name="${optional.package}/ejb/*DeploymentTool.java" unless="jdk1.2+" />
  169. <exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
  170. <exclude name="${optional.package}/junit/*" unless="junit.present" />
  171. <exclude name="${optional.package}/net/*.java" unless="netcomp.present" />
  172. <exclude name="${optional.package}/scm/AntStarTeam*.java" unless="starteam.present" />
  173. <exclude name="${optional.package}/ANTLR.java" unless="antlr.present" />
  174. <exclude name="${optional.package}/ide/VAJ*.java" unless="vaj.present" />
  175. <exclude name="${optional.package}/perforce/*.java" unless="jakarta.oro.present" />
  176. <exclude name="${optional.package}/sound/*.java" unless="jmf.present" />
  177. </javac>
  178. <copy todir="${build.classes}">
  179. <fileset dir="${java.dir}">
  180. <include name="**/*.properties" />
  181. </fileset>
  182. </copy>
  183. <filter token="VERSION" value="${version}" />
  184. <filter token="DATE" value="${TODAY}" />
  185. <filter token="TIME" value="${TSTAMP}" />
  186. <copy todir="${build.classes}"
  187. overwrite="true"
  188. filtering="on">
  189. <fileset dir="${java.dir}">
  190. <include name="**/version.txt" />
  191. <include name="**/defaultManifest.mf" />
  192. </fileset>
  193. </copy>
  194. </target>
  195. <!--
  196. ===================================================================
  197. Create the ant jars: ant.jar and optional.jar
  198. ===================================================================
  199. -->
  200. <target name="jars" depends="build">
  201. <jar jarfile="${build.lib}/${name}.jar"
  202. basedir="${build.classes}"
  203. manifest="${manifest}">
  204. <exclude name="org/apache/tools/ant/taskdefs/optional/**" />
  205. </jar>
  206. <jar jarfile="${build.lib}/optional.jar"
  207. basedir="${build.classes}"
  208. manifest="${manifest}">
  209. <include name="org/apache/tools/ant/taskdefs/optional/**" />
  210. </jar>
  211. </target>
  212. <!--
  213. ===================================================================
  214. Create the essential distribution that can run ant
  215. ===================================================================
  216. -->
  217. <target name="dist-lite" depends="jars, setup-distproperties">
  218. <mkdir dir="${dist.dir}"/>
  219. <mkdir dir="${dist.bin}"/>
  220. <mkdir dir="${dist.lib}"/>
  221. <copy todir="${dist.lib}">
  222. <fileset dir="${build.lib}"/>
  223. </copy>
  224. <copy todir="${dist.bin}">
  225. <fileset dir="${script.dir}/" />
  226. </copy>
  227. <chmod dir="${dist.dir}" perm="go-rwx" />
  228. <chmod perm="u+x">
  229. <fileset dir="${dist.bin}">
  230. <include name="**/ant" />
  231. <include name="**/antRun" />
  232. </fileset>
  233. </chmod>
  234. <fixcrlf srcdir="${dist.bin}" cr="add" includes="*.bat" />
  235. <fixcrlf srcdir="${dist.bin}" cr="remove" includes="*.sh" />
  236. <fixcrlf srcdir="${dist.bin}" cr="remove" includes="ant" />
  237. </target>
  238. <!--
  239. ===================================================================
  240. Create the complete distribution
  241. ===================================================================
  242. -->
  243. <target name="dist" depends="dist-lite,javadocs">
  244. <mkdir dir="${dist.docs}"/>
  245. <mkdir dir="${dist.javadocs}"/>
  246. <copy todir="${dist.lib}">
  247. <fileset dir="${lib.dir}">
  248. <include name="*.jar" />
  249. <include name="*.zip" />
  250. <exclude name="ant.jar"/>
  251. <exclude name="optional.jar"/>
  252. </fileset>
  253. </copy>
  254. <copy todir="${dist.docs}">
  255. <fileset dir="${docs.dir}"/>
  256. </copy>
  257. <copy todir="${dist.javadocs}">
  258. <fileset dir="${build.javadocs}"/>
  259. </copy>
  260. <copy todir="${dist.dir}">
  261. <fileset dir=".">
  262. <include name="README"/>
  263. <include name="LICENSE"/>
  264. <include name="TODO"/>
  265. <include name="WHATSNEW"/>
  266. </fileset>
  267. </copy>
  268. <chmod dir="${dist.dir}" perm="go-rwx" />
  269. </target>
  270. <!--
  271. ===================================================================
  272. Target to create bootstrap build
  273. ===================================================================
  274. -->
  275. <target name="bootstrap">
  276. <antcall target="dist-lite">
  277. <param name="dist.dir" value="${bootstrap.dir}" />
  278. </antcall>
  279. </target>
  280. <!--
  281. ===================================================================
  282. Create the source distribution
  283. ===================================================================
  284. -->
  285. <target name="src-dist" depends="setup-distproperties">
  286. <mkdir dir="${src.dist.dir}" />
  287. <copy todir="${src.dist.lib}">
  288. <fileset dir="${lib.dir}">
  289. <include name="*.jar" />
  290. <include name="*.zip" />
  291. </fileset>
  292. </copy>
  293. <copy todir="${src.dist.src}">
  294. <fileset dir="${src.dir}"/>
  295. </copy>
  296. <copy todir="${src.dist.docs}">
  297. <fileset dir="${docs.dir}"/>
  298. </copy>
  299. <copy todir="${src.dist.dir}">
  300. <fileset dir=".">
  301. <include name="README"/>
  302. <include name="LICENSE"/>
  303. <include name="TODO"/>
  304. <include name="WHATSNEW"/>
  305. <include name="build.bat"/>
  306. <include name="build.sh"/>
  307. <include name="bootstrap.bat"/>
  308. <include name="bootstrap.sh"/>
  309. <include name="build.xml"/>
  310. </fileset>
  311. </copy>
  312. <fixcrlf srcdir="${src.dist.dir}" includes="*.sh" cr="remove"/>
  313. <fixcrlf srcdir="${src.dist.dir}" includes="*.bat" cr="add"/>
  314. <chmod perm="+x">
  315. <fileset dir="${src.dist.dir}">
  316. <include name="*.sh" />
  317. </fileset>
  318. </chmod>
  319. <fixcrlf srcdir="${src.dist.src}" includes="**/*.java" cr="remove"/>
  320. </target>
  321. <!--
  322. ===================================================================
  323. Create the binary distribution
  324. ===================================================================
  325. -->
  326. <target name="distribution">
  327. <mkdir dir="${dist.base}"/>
  328. <antcall target="dist">
  329. <param name="dist.dir" value="${dist.name}" />
  330. </antcall>
  331. <zip zipfile="${dist.base}/${dist.name}-bin.zip"
  332. basedir="${dist.name}/.."
  333. includes="${dist.name}/**"
  334. excludes="${dist.name}/lib/optional.jar"/>
  335. <tar longfile="gnu"
  336. tarfile="${dist.base}/${dist.name}-bin.tar"
  337. basedir="${dist.name}/.."
  338. includes="${dist.name}/**"
  339. excludes="${dist.name}/lib/optional.jar"/>
  340. <gzip zipfile="${dist.base}/${dist.name}-bin.tar.gz"
  341. src="${dist.base}/${dist.name}-bin.tar"/>
  342. <delete file="${dist.base}/${dist.name}-bin.tar"/>
  343. <copy file="${dist.name}/lib/optional.jar" tofile="${dist.base}/${dist.name}-optional.jar"/>
  344. <delete dir="${dist.name}" />
  345. <antcall target="src-dist">
  346. <param name="src.dist.dir" value="${dist.name}" />
  347. </antcall>
  348. <zip zipfile="${dist.base}/${dist.name}-src.zip"
  349. basedir="${dist.name}/.."
  350. includes="${dist.name}/**"/>
  351. <tar longfile="gnu"
  352. tarfile="${dist.base}/${dist.name}-src.tar"
  353. basedir="${dist.name}/.."
  354. includes="${dist.name}/**"/>
  355. <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
  356. src="${dist.base}/${dist.name}-src.tar"/>
  357. <delete file="${dist.base}/${dist.name}-src.tar"/>
  358. <delete dir="${dist.name}" />
  359. </target>
  360. <!--
  361. ===================================================================
  362. Cleans up build and distribution directories
  363. ===================================================================
  364. -->
  365. <target name="clean" depends="setup-distproperties">
  366. <delete dir="${build.dir}" />
  367. <delete dir="${dist.dir}" />
  368. <delete dir="${dist.base}" />
  369. <delete>
  370. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  371. </delete>
  372. </target>
  373. <!--
  374. ===================================================================
  375. Cleans everything
  376. ===================================================================
  377. -->
  378. <target name="allclean" depends="clean">
  379. <delete file="${bootstrap.dir}/bin/antRun" />
  380. <delete file="${bootstrap.dir}/bin/antRun.bat" />
  381. </target>
  382. <!--
  383. ===================================================================
  384. Installs ant
  385. ===================================================================
  386. -->
  387. <target name="install" if="ant.install">
  388. <antcall target="dist">
  389. <param name="dist.dir" value="${ant.install}" />
  390. </antcall>
  391. </target>
  392. <target name="install-lite" if="ant.install">
  393. <antcall target="dist-lite">
  394. <param name="dist.dir" value="${ant.install}" />
  395. </antcall>
  396. </target>
  397. <!--
  398. ===================================================================
  399. Creates the API documentation
  400. ===================================================================
  401. -->
  402. <target name="javadoc_check">
  403. <uptodate property="javadoc.notrequired" targetfile="${build.javadocs}/packages.html" >
  404. <srcfiles dir= "${java.dir}" includes="**/*.java"/>
  405. </uptodate>
  406. </target>
  407. <target name="javadocs" depends="prepare, javadoc_check"
  408. unless="javadoc.notrequired"
  409. description="Creates the API documentation">
  410. <mkdir dir="${build.javadocs}"/>
  411. <javadoc packagenames="org.apache.*"
  412. sourcepath="${java.dir}"
  413. destdir="${build.javadocs}"
  414. author="true"
  415. version="true"
  416. windowtitle="${Name} API"
  417. doctitle="${Name}"
  418. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  419. <group title="Ant Core" packages="org.apache.tools.ant*" />
  420. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*" />
  421. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*" />
  422. </javadoc>
  423. </target>
  424. <!--
  425. ===================================================================
  426. Compile testcases
  427. ===================================================================
  428. -->
  429. <target name="compile-tests" depends="build" if="junit.present">
  430. <mkdir dir="${build.tests}"/>
  431. <javac srcdir="${tests.dir}"
  432. destdir="${build.tests}"
  433. debug="${debug}"
  434. deprecation="${deprecation}" >
  435. <classpath refid="tests-classpath" />
  436. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  437. unless="antlr.present" />
  438. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  439. unless="jakarta.regexp.present" />
  440. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  441. unless="jakarta.oro.present" />
  442. </javac>
  443. </target>
  444. <!--
  445. ===================================================================
  446. Run testcase
  447. ===================================================================
  448. -->
  449. <target name="run-tests" depends="compile-tests" if="junit.present">
  450. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  451. <jvmarg value="-classic"/>
  452. <classpath refid="tests-classpath"/>
  453. <sysproperty key="build.tests" value="${build.tests}"/>
  454. <formatter type="plain" usefile="false" />
  455. <batchtest>
  456. <fileset dir="${tests.dir}">
  457. <include name="**/*Test*" />
  458. <!-- abstract class, not a testcase -->
  459. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  460. <exclude name="org/apache/tools/ant/util/regexp/RegexpMatcherTest.java" />
  461. <!-- currently fails - will be sorted out soon -->
  462. <exclude name="org/apache/tools/ant/types/CommandlineJavaTest.java" />
  463. <!-- these depend on order -->
  464. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  465. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  466. <!-- only run this test if ANTLR is installed -->
  467. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  468. unless="antlr.present" />
  469. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  470. unless="jakarta.regexp.present" />
  471. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  472. unless="jakarta.oro.present" />
  473. </fileset>
  474. </batchtest>
  475. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  476. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  477. </junit>
  478. <!-- clean up again -->
  479. <delete dir="${tests.etc.dir}/taskdefs/optional/antlr/antlr.tmp" />
  480. <delete dir="${tests.etc.dir}/taskdefs/taskdefs.tmp" />
  481. <delete dir="${tests.etc.dir}/taskdefs.tmp" />
  482. <delete file="${tests.etc.dir}/taskdefs/tmp.jar" />
  483. </target>
  484. <target name="run-single-test" if="testcase" depends="compile-tests">
  485. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  486. <jvmarg value="-classic"/>
  487. <sysproperty key="build.tests" value="${build.tests}"/>
  488. <classpath refid="tests-classpath"/>
  489. <formatter type="plain" usefile="false" />
  490. <test name="${testcase}" />
  491. </junit>
  492. </target>
  493. <!--
  494. ===================================================================
  495. Main target - runs dist-lite by default
  496. ===================================================================
  497. -->
  498. <target name="main" depends="dist-lite"/>
  499. </project>