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

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