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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <?xml version="1.0"?>
  2. <!-- ======================================================================= -->
  3. <!-- Ant own build file -->
  4. <!-- ======================================================================= -->
  5. <project name="Ant" default="main" basedir=".">
  6. <!-- Give user a chance to override without editing this file
  7. (and without typing -D each time it compiles it) -->
  8. <property file="${user.home}/.ant.properties" />
  9. <property name="Name" value="Ant"/>
  10. <property name="name" value="ant"/>
  11. <property name="version" value="1.2rc2"/>
  12. <property name="ant.home" value="."/>
  13. <property name="src.bin.dir" value="src/bin"/>
  14. <property name="src.etc.dir" value="src/etc"/>
  15. <property name="src.dir" value="src/main"/>
  16. <property name="src.tests.dir" value="src/testcases"/>
  17. <property name="docs.dir" value="docs"/>
  18. <property name="build.dir" value="../build/ant"/>
  19. <property name="lib.dir" value="${build.dir}/lib"/>
  20. <property name="bin.dir" value="${build.dir}/bin"/>
  21. <property name="build.classes" value="${build.dir}/classes"/>
  22. <property name="build.javadocs" value="${build.dir}/javadocs"/>
  23. <property name="build.tests" value="${build.dir}/testcases"/>
  24. <property name="ant.dist.dir" value="../dist/ant"/>
  25. <path id="classpath">
  26. </path>
  27. <property name="packages" value="org.apache.tools.*"/>
  28. <property name="manifest" value="src/etc/manifest"/>
  29. <property name="build.compiler" value="classic"/>
  30. <property name="build.compiler.emacs" value="on"/>
  31. <!-- =================================================================== -->
  32. <!-- Define a global set of patterns that can be referenced by -->
  33. <!-- its id attribute -->
  34. <!-- =================================================================== -->
  35. <patternset id="chmod.patterns">
  36. <include name="**/ant" />
  37. <include name="**/antRun" />
  38. <include name="**/bootstrap.sh" />
  39. </patternset>
  40. <!-- =================================================================== -->
  41. <!-- Check to see what optional dependencies are available -->
  42. <!-- =================================================================== -->
  43. <target name="check_for_optional_packages">
  44. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  45. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  46. <available property="bsf.present" classname="com.ibm.bsf.BSFManager" />
  47. <available property="netrexx.present" classname="netrexx.lang.Rexx" />
  48. <available property="xslp.present"
  49. classname="com.kvisco.xsl.XSLProcessor" />
  50. <available property="xalan.present"
  51. classname="org.apache.xalan.xslt.XSLTProcessorFactory" />
  52. <available property="ejb.ejbc.present" classname="weblogic.ejbc" />
  53. <available property="ejb.DDCreator.present" classname="weblogic.ejb.utils.DDCreator" />
  54. <available property="ejb.wls.present" classname="weblogic.Server" />
  55. <available property="junit.present" classname="junit.framework.TestCase" />
  56. <available property="ftp.present" classname="com.oroinc.net.ftp.FTPClient" />
  57. <available property="starteam.present" classname="com.starbase.util.Platform" />
  58. </target>
  59. <!-- =================================================================== -->
  60. <!-- Prepares the build directory -->
  61. <!-- =================================================================== -->
  62. <target name="prepare">
  63. <mkdir dir="${build.dir}"/>
  64. <tstamp />
  65. </target>
  66. <!-- =================================================================== -->
  67. <!-- Compiles the source code -->
  68. <!-- =================================================================== -->
  69. <target name="compile" depends="prepare,check_for_optional_packages">
  70. <mkdir dir="${build.classes}"/>
  71. <javac srcdir="${src.dir}"
  72. destdir="${build.classes}"
  73. debug="on"
  74. deprecation="off"
  75. optimize="on" >
  76. <classpath refid="classpath" />
  77. <exclude name="**/Script.java" unless="bsf.present" />
  78. <exclude name="**/NetRexxC.java" unless="netrexx.present" />
  79. <exclude name="**/XslpLiaison.java" unless="xslp.present" />
  80. <exclude name="**/XalanLiaison.java" unless="xalan.present" />
  81. <exclude name="**/Ejbc*.java" unless="ejb.ejbc.present" />
  82. <exclude name="**/DDCreator*.java" unless="ejb.DDCreator.present" />
  83. <exclude name="**/WLRun.java" unless="ejb.wls.present" />
  84. <exclude name="**/WLStop.java" unless="ejb.wls.present" />
  85. <exclude name="**/EjbJar.java" unless="jdk1.2+" />
  86. <exclude name="**/*DeploymentTool.java" unless="jdk1.2+" />
  87. <exclude name="**/junit/*" unless="junit.present" />
  88. <exclude name="**/FTP*.java" unless="ftp.present" />
  89. <exclude name="**/AntStarTeam*.java" unless="starteam.present" />
  90. </javac>
  91. <copy todir="${build.classes}">
  92. <fileset dir="${src.dir}">
  93. <include name="**/*.properties" />
  94. </fileset>
  95. </copy>
  96. <filter token="VERSION" value="${version}" />
  97. <filter token="DATE" value="${TODAY}" />
  98. <filter token="TIME" value="${TSTAMP}" />
  99. <copy todir="${build.classes}"
  100. overwrite="true"
  101. filtering="on">
  102. <fileset dir="${src.dir}">
  103. <include name="**/version.txt" />
  104. <include name="**/defaultManifest.mf" />
  105. </fileset>
  106. </copy>
  107. </target>
  108. <!-- =================================================================== -->
  109. <!-- Creates the jar archive -->
  110. <!-- =================================================================== -->
  111. <target name="jar" depends="compile">
  112. <mkdir dir="${lib.dir}"/>
  113. <jar jarfile="${lib.dir}/${name}.jar"
  114. basedir="${build.classes}"
  115. includes="org/**"
  116. manifest="${manifest}"
  117. />
  118. </target>
  119. <!-- =================================================================== -->
  120. <!-- Creates the binary structure -->
  121. <!-- =================================================================== -->
  122. <target name="main" depends="jar" description="Creates the binary structure">
  123. <mkdir dir="${bin.dir}"/>
  124. <copy todir="${bin.dir}">
  125. <fileset dir="${src.bin.dir}"/>
  126. </copy>
  127. <chmod perm="+x">
  128. <fileset dir="${bin.dir}">
  129. <patternset refid="chmod.patterns"/>
  130. </fileset>
  131. </chmod>
  132. <fixcrlf srcdir="${bin.dir}" includes="ant,antRun" cr="remove"/>
  133. <fixcrlf srcdir="${bin.dir}" includes="*.bat" cr="add"/>
  134. </target>
  135. <!-- =================================================================== -->
  136. <!-- Creates the API documentation -->
  137. <!-- =================================================================== -->
  138. <target name="javadocs" depends="prepare" description="Creates the API documentation">
  139. <mkdir dir="${build.javadocs}"/>
  140. <javadoc packagenames="${packages}"
  141. sourcepath="${basedir}/${src.dir}"
  142. destdir="${build.javadocs}"
  143. author="true"
  144. version="true"
  145. windowtitle="${Name} API"
  146. doctitle="${Name}"
  147. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  148. </javadoc>
  149. </target>
  150. <!-- =================================================================== -->
  151. <!-- Creates the distribution -->
  152. <!-- =================================================================== -->
  153. <target name="dist" depends="main,jar,javadocs" description="Creates the distribution">
  154. <mkdir dir="${ant.dist.dir}"/>
  155. <mkdir dir="${ant.dist.dir}/bin"/>
  156. <mkdir dir="${ant.dist.dir}/lib"/>
  157. <mkdir dir="${ant.dist.dir}/docs"/>
  158. <mkdir dir="${ant.dist.dir}/docs/api"/>
  159. <mkdir dir="${ant.dist.dir}/src"/>
  160. <copy todir="${ant.dist.dir}/src">
  161. <fileset dir="${src.dir}"/>
  162. </copy>
  163. <copy todir="${ant.dist.dir}/lib">
  164. <fileset dir="${lib.dir}"/>
  165. </copy>
  166. <copy file="build.xml" tofile="${ant.dist.dir}/lib/build.xml"/>
  167. <copy todir="${ant.dist.dir}/bin">
  168. <fileset dir="src/bin"/>
  169. </copy>
  170. <copy todir="${ant.dist.dir}/docs">
  171. <fileset dir="${docs.dir}"/>
  172. </copy>
  173. <copy todir="${ant.dist.dir}/docs/api">
  174. <fileset dir="${build.javadocs}"/>
  175. </copy>
  176. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="ant,antRun" cr="remove"/>
  177. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="*.bat" cr="add"/>
  178. <chmod perm="+x">
  179. <fileset dir="${ant.dist.dir}/bin">
  180. <patternset refid="chmod.patterns"/>
  181. </fileset>
  182. </chmod>
  183. <copy file="README" tofile="${ant.dist.dir}/README"/>
  184. <copy file="WHATSNEW" tofile="${ant.dist.dir}/WHATSNEW"/>
  185. <copy file="TODO" tofile="${ant.dist.dir}/TODO"/>
  186. <copy file="LICENSE" tofile="${ant.dist.dir}/LICENSE"/>
  187. </target>
  188. <!-- =================================================================== -->
  189. <!-- Packages the distribution with ZIP -->
  190. <!-- =================================================================== -->
  191. <target name="dist-zip" depends="dist">
  192. <zip zipfile="${Name}-${version}.zip" basedir="${ant.dist.dir}" includes="**"/>
  193. </target>
  194. <!-- =================================================================== -->
  195. <!-- Packages the distribution with TAR-GZIP -->
  196. <!-- =================================================================== -->
  197. <target name="dist-tgz" depends="dist">
  198. <tar tarfile="${Name}-${version}.tar" basedir="${ant.dist.dir}" includes="**"/>
  199. <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
  200. </target>
  201. <!-- =================================================================== -->
  202. <!-- Installs the ant.jar library and binary files into ant.home -->
  203. <!-- =================================================================== -->
  204. <target name="bootstrap" depends="main" description="Installs the ant.jar library and binary files into ant.home">
  205. <echo message="copying bootstrapped files into bin and lib"/>
  206. <copy todir="lib">
  207. <fileset dir="${lib.dir}"/>
  208. </copy>
  209. <copy todir="bin">
  210. <fileset dir="${bin.dir}"/>
  211. </copy>
  212. </target>
  213. <target name="install" depends="dist" if="ant.install">
  214. <echo message="installing full copy of ant into ${ant.install}"/>
  215. <mkdir dir="${ant.install}"/>
  216. <copy todir="${ant.install}">
  217. <fileset dir="${ant.dist.dir}"/>
  218. </copy>
  219. <chmod perm="+x">
  220. <fileset dir="${ant.install}/bin">
  221. <patternset refid="chmod.patterns"/>
  222. </fileset>
  223. </chmod>
  224. </target>
  225. <target name="fullinstall" depends="install"/>
  226. <target name="mininstall" depends="main" if="ant.install">
  227. <echo message="copy minimal ant installation into ${ant.install}"/>
  228. <mkdir dir="${ant.install}"/>
  229. <copy todir="${ant.install}/lib">
  230. <fileset dir="${lib.dir}"/>
  231. </copy>
  232. <copy todir="${ant.install}/bin">
  233. <fileset dir="${bin.dir}"/>
  234. </copy>
  235. <chmod perm="+x">
  236. <fileset dir="${ant.install}/bin">
  237. <patternset refid="chmod.patterns"/>
  238. </fileset>
  239. </chmod>
  240. </target>
  241. <!-- =================================================================== -->
  242. <!-- Cleans up generated stuff -->
  243. <!-- =================================================================== -->
  244. <target name="clean">
  245. <delete dir="${build.dir}"/>
  246. <delete dir="${ant.dist.dir}"/>
  247. </target>
  248. <!-- =================================================================== -->
  249. <!-- Total cleanup -->
  250. <!-- =================================================================== -->
  251. <target name="total-clean" depends="clean">
  252. <delete dir="${bin.dir}"/>
  253. <delete file="${lib.dir}/${name}.jar"/>
  254. <delete file="${Name}-${version}.zip"/>
  255. <delete file="${Name}-${version}.tar"/>
  256. <delete file="${Name}-${version}.tar.gz"/>
  257. </target>
  258. <!-- in progress ! (may not work) -->
  259. <target name="get.snapshot">
  260. <get src="http://jakarta.apache.org/build/tmp/ant/ant.src.zip" dest="ant-src.zip" />
  261. <unzip src="ant-src.zip" dest="." />
  262. </target>
  263. <target name="make.snapshot">
  264. <cvs cvsRoot=":pserver:anoncvs@jakarta.apache.org:/home/cvspublic"
  265. package="jakarta-ant"
  266. dest="." />
  267. <zip zipfile="/www/jakarta.apache.org/builds/tmp/ant/ant.src.zip" basedir="." includes="jakarta-ant/**"/>
  268. </target>
  269. <!-- =================================================================== -->
  270. <!-- Compile testcases -->
  271. <!-- =================================================================== -->
  272. <target name="compiletests" depends="jar" if="junit.present">
  273. <mkdir dir="${build.tests}"/>
  274. <javac srcdir="${src.tests.dir}"
  275. destdir="${build.tests}"
  276. debug="on"
  277. deprecation="off" >
  278. <classpath>
  279. <pathelement location="${lib.dir}/${name}.jar" />
  280. <path refid="classpath" />
  281. </classpath>
  282. </javac>
  283. </target>
  284. <!-- =================================================================== -->
  285. <!-- Run testcase -->
  286. <!-- =================================================================== -->
  287. <target name="runtests" depends="compiletests" if="junit.present">
  288. <junit printsummary="no" haltonfailure="yes">
  289. <classpath>
  290. <pathelement location="${lib.dir}/${name}.jar" />
  291. <pathelement location="${build.tests}" />
  292. <path refid="classpath" />
  293. <pathelement path="${java.class.path}" />
  294. </classpath>
  295. <formatter type="plain" usefile="false" />
  296. <batchtest>
  297. <fileset dir="${src.tests.dir}">
  298. <include name="**/*Test*" />
  299. <!-- abstract class, not a testcase -->
  300. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  301. <!-- these depend on order -->
  302. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  303. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  304. </fileset>
  305. </batchtest>
  306. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  307. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  308. </junit>
  309. <!-- clean up again -->
  310. <delete dir="src/etc/testcases/taskdefs/taskdefs.tmp" />
  311. <delete dir="src/etc/testcases/taskdefs.tmp" />
  312. </target>
  313. <target name="run.single.test" if="testcase" depends="compiletests">
  314. <junit printsummary="no" haltonfailure="yes">
  315. <classpath>
  316. <pathelement location="${lib.dir}/${name}.jar" />
  317. <pathelement location="${build.tests}" />
  318. <path refid="classpath" />
  319. <pathelement path="${java.class.path}" />
  320. </classpath>
  321. <formatter type="plain" usefile="false" />
  322. <test name="${testcase}" />
  323. </junit>
  324. </target>
  325. <!-- =================================================================== -->
  326. <!-- Targets to build distributions, probaly not that useful for -->
  327. <!-- anybody but the people doing Ant releases. -->
  328. <!-- =================================================================== -->
  329. <property name="JAXP_HOME" value="/usr/local/java/lib/jaxp1.0.1" />
  330. <property name="ant.srcdist.dir" value="../dist/jakarta-ant-src"/>
  331. <target name="srcbuild">
  332. <mkdir dir="${ant.srcdist.dir}" />
  333. <mkdir dir="${ant.srcdist.dir}/lib" />
  334. <copy todir="${ant.srcdist.dir}">
  335. <fileset dir=".">
  336. <exclude name="bin/**" />
  337. <exclude name="lib/**" />
  338. </fileset>
  339. </copy>
  340. <fixcrlf srcdir="${ant.srcdist.dir}" includes="ant,antRun,bootstrap.sh" cr="remove"/>
  341. <fixcrlf srcdir="${ant.srcdist.dir}" includes="*.bat" cr="add"/>
  342. <chmod perm="+x">
  343. <fileset dir="${ant.srcdist.dir}">
  344. <patternset refid="chmod.patterns"/>
  345. </fileset>
  346. </chmod>
  347. <copy todir="${ant.srcdist.dir}/lib">
  348. <fileset dir="${JAXP_HOME}">
  349. <include name="**/*.jar" />
  350. </fileset>
  351. </copy>
  352. </target>
  353. <target name="src.zip" depends="srcbuild">
  354. <zip zipfile="${ant.srcdist.dir}/../jakarta-ant-src.zip"
  355. basedir="${ant.srcdist.dir}" />
  356. </target>
  357. <target name="src.tgz" depends="srcbuild">
  358. <property name="src.tar"
  359. value="${ant.srcdist.dir}/../jakarta-ant-src.tar" />
  360. <tar tarfile="${src.tar}" basedir="${ant.srcdist.dir}" />
  361. <gzip src="${src.tar}" zipfile="${src.tar}.gz" />
  362. <delete file="${src.tar}" />
  363. </target>
  364. <target name="srcdist" description="Creates the source distribution"
  365. depends="src.zip,src.tgz" />
  366. <property name="ant.bindist.dir" value="../dist/jakarta-ant-bin"/>
  367. <target name="binbuild" depends="compile">
  368. <!-- ugly hack to build a binary distribution without optional tasks -->
  369. <delete>
  370. <fileset dir="${build.classes}">
  371. <include name="**/Script.java" />
  372. <include name="**/NetRexxC.java" />
  373. <include name="**/XslpLiaison.java" />
  374. <include name="**/XalanLiaison.java" />
  375. <include name="**/Ejbc*.java" />
  376. <include name="**/DDCreator*.java" />
  377. <include name="**/WLRun.java" />
  378. <include name="**/WLStop.java" />
  379. <include name="**/junit/*" />
  380. <include name="**/FTP*.java" />
  381. <include name="**/AntStarTeam*.java" />
  382. </fileset>
  383. </delete>
  384. <mkdir dir="${ant.bindist.dir}"/>
  385. <mkdir dir="${ant.bindist.dir}/bin"/>
  386. <mkdir dir="${ant.bindist.dir}/src"/>
  387. <mkdir dir="${ant.bindist.dir}/etc"/>
  388. <mkdir dir="${ant.bindist.dir}/lib"/>
  389. <mkdir dir="${ant.bindist.dir}/docs/api"/>
  390. <jar jarfile="${ant.bindist.dir}/lib/${name}.jar"
  391. basedir="${build.classes}"
  392. includes="org/**"
  393. manifest="${manifest}"
  394. />
  395. <copy todir="${ant.bindist.dir}/docs">
  396. <fileset dir="${docs.dir}"/>
  397. </copy>
  398. <javadoc packagenames="${packages}"
  399. sourcepath="${basedir}/${src.dir}"
  400. destdir="${ant.bindist.dir}/docs/api"
  401. author="true"
  402. version="true"
  403. windowtitle="${Name} API"
  404. doctitle="${Name}"
  405. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  406. </javadoc>
  407. <copy todir="${ant.bindist.dir}/src">
  408. <fileset dir="${src.dir}"/>
  409. </copy>
  410. <copy todir="${ant.bindist.dir}/etc">
  411. <fileset dir="${src.etc.dir}">
  412. <exclude name="testcases/**" />
  413. </fileset>
  414. </copy>
  415. <copy todir="${ant.bindist.dir}/bin">
  416. <fileset dir="${src.bin.dir}"/>
  417. </copy>
  418. <fixcrlf srcdir="${ant.bindist.dir}/bin" includes="ant,antRun" cr="remove"/>
  419. <fixcrlf srcdir="${ant.bindist.dir}/bin" includes="*.bat" cr="add"/>
  420. <chmod perm="+x">
  421. <fileset dir="${ant.bindist.dir}/bin">
  422. <patternset refid="chmod.patterns"/>
  423. </fileset>
  424. </chmod>
  425. <copy file="build.xml" tofile="${ant.bindist.dir}/lib/build.xml"/>
  426. <copy file="README" tofile="${ant.bindist.dir}/README"/>
  427. <copy file="WHATSNEW" tofile="${ant.bindist.dir}/WHATSNEW"/>
  428. <copy file="TODO" tofile="${ant.bindist.dir}/TODO"/>
  429. <copy file="LICENSE" tofile="${ant.bindist.dir}/LICENSE"/>
  430. <copy todir="${ant.bindist.dir}/lib">
  431. <fileset dir="${JAXP_HOME}">
  432. <include name="**/*.jar" />
  433. </fileset>
  434. </copy>
  435. </target>
  436. <target name="bin.zip" depends="binbuild">
  437. <zip zipfile="${ant.bindist.dir}/../jakarta-ant-bin.zip"
  438. basedir="${ant.bindist.dir}" />
  439. </target>
  440. <target name="bin.tgz" depends="binbuild">
  441. <property name="bin.tar"
  442. value="${ant.bindist.dir}/../jakarta-ant-bin.tar" />
  443. <tar tarfile="${bin.tar}" basedir="${ant.bindist.dir}" />
  444. <gzip src="${bin.tar}" zipfile="${bin.tar}.gz" />
  445. <delete file="${bin.tar}" />
  446. </target>
  447. <target name="bindist" description="Creates the binary distribution"
  448. depends="bin.zip,bin.tgz" />
  449. <property name="contributed.tasks" value="../build/ant.contrib" />
  450. <property name="optional" value="../dist/optional.jar" />
  451. <target name="optional.jar" depends="compile"
  452. description="Creates a JAR of the optional tasks">
  453. <mkdir dir="${contributed.tasks}" />
  454. <copy todir="${contributed.tasks}">
  455. <fileset dir="${build.classes}">
  456. <include name="**/optional/**" />
  457. </fileset>
  458. </copy>
  459. <jar jarfile="${optional}"
  460. basedir="${contributed.tasks}"
  461. manifest="${manifest}"
  462. />
  463. </target>
  464. <target name="release.dist" depends="srcdist,bindist,optional.jar"
  465. description="Creates all five files for a release build" />
  466. </project>