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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  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. <exclude name="${optional.package}/junit/XMLResultAggregator.java"
  178. unless="trax.present" />
  179. <exclude name="${optional.package}/junit/AggregateTransformer.java"
  180. unless="trax.present" />
  181. </javac>
  182. <copy todir="${build.classes}">
  183. <fileset dir="${java.dir}">
  184. <include name="**/*.properties" />
  185. </fileset>
  186. </copy>
  187. <filter token="VERSION" value="${version}" />
  188. <filter token="DATE" value="${TODAY}" />
  189. <filter token="TIME" value="${TSTAMP}" />
  190. <copy todir="${build.classes}"
  191. overwrite="true"
  192. filtering="on">
  193. <fileset dir="${java.dir}">
  194. <include name="**/version.txt" />
  195. <include name="**/defaultManifest.mf" />
  196. </fileset>
  197. </copy>
  198. <copy todir="${build.classes}/${optional.package}/junit">
  199. <fileset dir="${java.dir}/${optional.package}/junit">
  200. <include name="html/**" />
  201. <include name="xsl/**" />
  202. </fileset>
  203. </copy>
  204. </target>
  205. <!--
  206. ===================================================================
  207. Create the ant jars: ant.jar and optional.jar
  208. ===================================================================
  209. -->
  210. <target name="jars" depends="build">
  211. <jar jarfile="${build.lib}/${name}.jar"
  212. basedir="${build.classes}"
  213. manifest="${manifest}">
  214. <exclude name="org/apache/tools/ant/taskdefs/optional/**" />
  215. </jar>
  216. <jar jarfile="${build.lib}/optional.jar"
  217. basedir="${build.classes}"
  218. manifest="${manifest}">
  219. <include name="org/apache/tools/ant/taskdefs/optional/**" />
  220. </jar>
  221. </target>
  222. <!--
  223. ===================================================================
  224. Create the essential distribution that can run ant
  225. ===================================================================
  226. -->
  227. <target name="dist-lite" depends="jars, setup-distproperties">
  228. <mkdir dir="${dist.dir}"/>
  229. <mkdir dir="${dist.bin}"/>
  230. <mkdir dir="${dist.lib}"/>
  231. <copy todir="${dist.lib}">
  232. <fileset dir="${build.lib}"/>
  233. </copy>
  234. <copy todir="${dist.bin}">
  235. <fileset dir="${script.dir}/" />
  236. </copy>
  237. <chmod dir="${dist.dir}" perm="go-rwx" />
  238. <chmod perm="u+x">
  239. <fileset dir="${dist.bin}">
  240. <include name="**/ant" />
  241. <include name="**/antRun" />
  242. </fileset>
  243. </chmod>
  244. <fixcrlf srcdir="${dist.bin}" cr="add" includes="*.bat" />
  245. <fixcrlf srcdir="${dist.bin}" cr="remove" includes="*.sh" />
  246. <fixcrlf srcdir="${dist.bin}" cr="remove" includes="ant" />
  247. </target>
  248. <!--
  249. ===================================================================
  250. Create the complete distribution
  251. ===================================================================
  252. -->
  253. <target name="dist" depends="dist-lite,javadocs">
  254. <mkdir dir="${dist.docs}"/>
  255. <mkdir dir="${dist.javadocs}"/>
  256. <copy todir="${dist.lib}">
  257. <fileset dir="${lib.dir}">
  258. <include name="*.jar" />
  259. <include name="*.zip" />
  260. <exclude name="ant.jar"/>
  261. <exclude name="optional.jar"/>
  262. </fileset>
  263. </copy>
  264. <copy todir="${dist.docs}">
  265. <fileset dir="${docs.dir}"/>
  266. </copy>
  267. <copy todir="${dist.javadocs}">
  268. <fileset dir="${build.javadocs}"/>
  269. </copy>
  270. <copy todir="${dist.dir}">
  271. <fileset dir=".">
  272. <include name="README"/>
  273. <include name="LICENSE"/>
  274. <include name="TODO"/>
  275. <include name="WHATSNEW"/>
  276. </fileset>
  277. </copy>
  278. <chmod dir="${dist.dir}" perm="go-rwx" />
  279. </target>
  280. <!--
  281. ===================================================================
  282. Target to create bootstrap build
  283. ===================================================================
  284. -->
  285. <target name="bootstrap">
  286. <antcall target="dist-lite">
  287. <param name="dist.dir" value="${bootstrap.dir}" />
  288. </antcall>
  289. </target>
  290. <!--
  291. ===================================================================
  292. Create the source distribution
  293. ===================================================================
  294. -->
  295. <target name="src-dist" depends="setup-distproperties">
  296. <mkdir dir="${src.dist.dir}" />
  297. <copy todir="${src.dist.lib}">
  298. <fileset dir="${lib.dir}">
  299. <include name="*.jar" />
  300. <include name="*.zip" />
  301. </fileset>
  302. </copy>
  303. <copy todir="${src.dist.src}">
  304. <fileset dir="${src.dir}"/>
  305. </copy>
  306. <copy todir="${src.dist.docs}">
  307. <fileset dir="${docs.dir}"/>
  308. </copy>
  309. <copy todir="${src.dist.dir}">
  310. <fileset dir=".">
  311. <include name="README"/>
  312. <include name="LICENSE"/>
  313. <include name="TODO"/>
  314. <include name="WHATSNEW"/>
  315. <include name="build.bat"/>
  316. <include name="build.sh"/>
  317. <include name="bootstrap.bat"/>
  318. <include name="bootstrap.sh"/>
  319. <include name="build.xml"/>
  320. </fileset>
  321. </copy>
  322. <fixcrlf srcdir="${src.dist.dir}" includes="*.sh" cr="remove"/>
  323. <fixcrlf srcdir="${src.dist.dir}" includes="*.bat" cr="add"/>
  324. <chmod perm="+x">
  325. <fileset dir="${src.dist.dir}">
  326. <include name="*.sh" />
  327. </fileset>
  328. </chmod>
  329. <fixcrlf srcdir="${src.dist.src}" includes="**/*.java" cr="remove"/>
  330. </target>
  331. <!--
  332. ===================================================================
  333. Create the binary distribution
  334. ===================================================================
  335. -->
  336. <target name="distribution">
  337. <mkdir dir="${dist.base}"/>
  338. <antcall target="dist">
  339. <param name="dist.dir" value="${dist.name}" />
  340. </antcall>
  341. <zip zipfile="${dist.base}/${dist.name}-bin.zip"
  342. basedir="${dist.name}/.."
  343. includes="${dist.name}/**"
  344. excludes="${dist.name}/lib/optional.jar"/>
  345. <tar longfile="gnu"
  346. tarfile="${dist.base}/${dist.name}-bin.tar"
  347. basedir="${dist.name}/.."
  348. includes="${dist.name}/**"
  349. excludes="${dist.name}/lib/optional.jar"/>
  350. <gzip zipfile="${dist.base}/${dist.name}-bin.tar.gz"
  351. src="${dist.base}/${dist.name}-bin.tar"/>
  352. <delete file="${dist.base}/${dist.name}-bin.tar"/>
  353. <copy file="${dist.name}/lib/optional.jar" tofile="${dist.base}/${dist.name}-optional.jar"/>
  354. <delete dir="${dist.name}" />
  355. <antcall target="src-dist">
  356. <param name="src.dist.dir" value="${dist.name}" />
  357. </antcall>
  358. <zip zipfile="${dist.base}/${dist.name}-src.zip"
  359. basedir="${dist.name}/.."
  360. includes="${dist.name}/**"/>
  361. <tar longfile="gnu"
  362. tarfile="${dist.base}/${dist.name}-src.tar"
  363. basedir="${dist.name}/.."
  364. includes="${dist.name}/**"/>
  365. <gzip zipfile="${dist.base}/${dist.name}-src.tar.gz"
  366. src="${dist.base}/${dist.name}-src.tar"/>
  367. <delete file="${dist.base}/${dist.name}-src.tar"/>
  368. <delete dir="${dist.name}" />
  369. </target>
  370. <!--
  371. ===================================================================
  372. Cleans up build and distribution directories
  373. ===================================================================
  374. -->
  375. <target name="clean" depends="setup-distproperties">
  376. <delete dir="${build.dir}" />
  377. <delete dir="${dist.dir}" />
  378. <delete dir="${dist.base}" />
  379. <delete>
  380. <fileset dir="." includes="**/*~" defaultexcludes="no"/>
  381. </delete>
  382. </target>
  383. <!--
  384. ===================================================================
  385. Cleans everything
  386. ===================================================================
  387. -->
  388. <target name="allclean" depends="clean">
  389. <delete file="${bootstrap.dir}/bin/antRun" />
  390. <delete file="${bootstrap.dir}/bin/antRun.bat" />
  391. </target>
  392. <!--
  393. ===================================================================
  394. Installs ant
  395. ===================================================================
  396. -->
  397. <target name="install" if="ant.install">
  398. <antcall target="dist">
  399. <param name="dist.dir" value="${ant.install}" />
  400. </antcall>
  401. </target>
  402. <target name="install-lite" if="ant.install">
  403. <antcall target="dist-lite">
  404. <param name="dist.dir" value="${ant.install}" />
  405. </antcall>
  406. </target>
  407. <!--
  408. ===================================================================
  409. Creates the API documentation
  410. ===================================================================
  411. -->
  412. <target name="javadoc_check">
  413. <uptodate property="javadoc.notrequired" targetfile="${build.javadocs}/packages.html" >
  414. <srcfiles dir= "${java.dir}" includes="**/*.java"/>
  415. </uptodate>
  416. </target>
  417. <target name="javadocs" depends="prepare, javadoc_check"
  418. unless="javadoc.notrequired"
  419. description="Creates the API documentation">
  420. <mkdir dir="${build.javadocs}"/>
  421. <javadoc packagenames="org.apache.*"
  422. sourcepath="${java.dir}"
  423. destdir="${build.javadocs}"
  424. author="true"
  425. version="true"
  426. windowtitle="${Name} API"
  427. doctitle="${Name}"
  428. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  429. <group title="Ant Core" packages="org.apache.tools.ant*" />
  430. <group title="Core Tasks" packages="org.apache.tools.ant.taskdefs*" />
  431. <group title="Optional Tasks" packages="org.apache.tools.ant.taskdefs.optional*" />
  432. </javadoc>
  433. </target>
  434. <!--
  435. ===================================================================
  436. Compile testcases
  437. ===================================================================
  438. -->
  439. <target name="compile-tests" depends="build" if="junit.present">
  440. <mkdir dir="${build.tests}"/>
  441. <javac srcdir="${tests.dir}"
  442. destdir="${build.tests}"
  443. debug="${debug}"
  444. deprecation="${deprecation}" >
  445. <classpath refid="tests-classpath" />
  446. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  447. unless="antlr.present" />
  448. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  449. unless="jakarta.regexp.present" />
  450. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  451. unless="jakarta.oro.present" />
  452. </javac>
  453. </target>
  454. <!--
  455. ===================================================================
  456. Run testcase
  457. ===================================================================
  458. -->
  459. <target name="run-tests" depends="compile-tests" if="junit.present">
  460. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  461. <jvmarg value="-classic"/>
  462. <classpath refid="tests-classpath"/>
  463. <sysproperty key="build.tests" value="${build.tests}"/>
  464. <formatter type="plain" usefile="false" />
  465. <batchtest>
  466. <fileset dir="${tests.dir}">
  467. <include name="**/*Test*" />
  468. <!-- abstract class, not a testcase -->
  469. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  470. <exclude name="org/apache/tools/ant/util/regexp/RegexpMatcherTest.java" />
  471. <!-- currently fails - will be sorted out soon -->
  472. <exclude name="org/apache/tools/ant/types/CommandlineJavaTest.java" />
  473. <!-- these depend on order -->
  474. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  475. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  476. <!-- only run this test if ANTLR is installed -->
  477. <exclude name="org/apache/tools/ant/taskdefs/optional/ANTLRTest.java"
  478. unless="antlr.present" />
  479. <exclude name="org/apache/tools/ant/util/regexp/JakartaRegexpMatcherTest.java"
  480. unless="jakarta.regexp.present" />
  481. <exclude name="org/apache/tools/ant/util/regexp/JakartaOroMatcherTest.java"
  482. unless="jakarta.oro.present" />
  483. </fileset>
  484. </batchtest>
  485. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  486. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  487. </junit>
  488. <!-- clean up again -->
  489. <delete dir="${tests.etc.dir}/taskdefs/optional/antlr/antlr.tmp" />
  490. <delete dir="${tests.etc.dir}/taskdefs/taskdefs.tmp" />
  491. <delete dir="${tests.etc.dir}/taskdefs.tmp" />
  492. <delete file="${tests.etc.dir}/taskdefs/tmp.jar" />
  493. </target>
  494. <target name="run-single-test" if="testcase" depends="compile-tests">
  495. <junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
  496. <jvmarg value="-classic"/>
  497. <sysproperty key="build.tests" value="${build.tests}"/>
  498. <classpath refid="tests-classpath"/>
  499. <formatter type="plain" usefile="false" />
  500. <test name="${testcase}" />
  501. </junit>
  502. </target>
  503. <!--
  504. ===================================================================
  505. Main target - runs dist-lite by default
  506. ===================================================================
  507. -->
  508. <target name="main" depends="dist-lite"/>
  509. </project>