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

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