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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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.2alpha3"/>
  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. </patternset>
  38. <!-- =================================================================== -->
  39. <!-- Check to see what optional dependencies are available -->
  40. <!-- =================================================================== -->
  41. <target name="check_for_optional_packages">
  42. <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
  43. <available property="jdk1.3+" classname="java.lang.StrictMath" />
  44. <available property="bsf.present" classname="com.ibm.bsf.BSFManager" />
  45. <available property="netrexx.present" classname="netrexx.lang.Rexx" />
  46. <available property="xslp.present"
  47. classname="com.kvisco.xsl.XSLProcessor" />
  48. <available property="xalan.present"
  49. classname="org.apache.xalan.xslt.XSLTProcessorFactory" />
  50. <available property="ejb.ejbc.present" classname="weblogic.ejbc" />
  51. <available property="ejb.DDCreator.present" classname="weblogic.ejb.utils.DDCreator" />
  52. <available property="ejb.wls.present" classname="weblogic.Server" />
  53. <available property="junit.present" classname="junit.framework.TestCase" />
  54. <available property="ftp.present" classname="com.oroinc.net.ftp.FTPClient" />
  55. <available property="starteam.present" classname="com.starbase.util.Platform" />
  56. </target>
  57. <!-- =================================================================== -->
  58. <!-- Prepares the build directory -->
  59. <!-- =================================================================== -->
  60. <target name="prepare">
  61. <mkdir dir="${build.dir}"/>
  62. <tstamp />
  63. </target>
  64. <!-- =================================================================== -->
  65. <!-- Compiles the source code -->
  66. <!-- =================================================================== -->
  67. <target name="compile" depends="prepare,check_for_optional_packages">
  68. <mkdir dir="${build.classes}"/>
  69. <javac srcdir="${src.dir}"
  70. destdir="${build.classes}"
  71. debug="on"
  72. deprecation="off"
  73. optimize="on" >
  74. <classpath refid="classpath" />
  75. <exclude name="**/Script.java" unless="bsf.present" />
  76. <exclude name="**/NetRexxC.java" unless="netrexx.present" />
  77. <exclude name="**/XslpLiaison.java" unless="xslp.present" />
  78. <exclude name="**/XalanLiaison.java" unless="xalan.present" />
  79. <exclude name="**/Ejbc*.java" unless="ejb.ejbc.present" />
  80. <exclude name="**/DDCreator*.java" unless="ejb.DDCreator.present" />
  81. <exclude name="**/WLRun.java" unless="ejb.wls.present" />
  82. <exclude name="**/WLStop.java" unless="ejb.wls.present" />
  83. <exclude name="**/EjbJar.java" unless="jdk1.2+" />
  84. <exclude name="**/*DeploymentTool.java" unless="jdk1.2+" />
  85. <exclude name="**/junit/*" unless="junit.present" />
  86. <exclude name="**/FTP*.java" unless="ftp.present" />
  87. <exclude name="**/AntStarTeam*.java" unless="starteam.present" />
  88. </javac>
  89. <copy todir="${build.classes}">
  90. <fileset dir="${src.dir}">
  91. <include name="**/*.properties" />
  92. </fileset>
  93. </copy>
  94. <filter token="VERSION" value="${version}" />
  95. <filter token="DATE" value="${TODAY}" />
  96. <filter token="TIME" value="${TSTAMP}" />
  97. <copy todir="${build.classes}"
  98. overwrite="true"
  99. filtering="on">
  100. <fileset dir="${src.dir}">
  101. <include name="**/version.txt" />
  102. <include name="**/defaultManifest.mf" />
  103. </fileset>
  104. </copy>
  105. </target>
  106. <!-- =================================================================== -->
  107. <!-- Creates the jar archive -->
  108. <!-- =================================================================== -->
  109. <target name="jar" depends="compile">
  110. <mkdir dir="${lib.dir}"/>
  111. <jar jarfile="${lib.dir}/${name}.jar"
  112. basedir="${build.classes}"
  113. includes="org/**"
  114. manifest="${manifest}"
  115. />
  116. </target>
  117. <!-- =================================================================== -->
  118. <!-- Creates the binary structure -->
  119. <!-- =================================================================== -->
  120. <target name="main" depends="jar" description="Creates the binary structure">
  121. <mkdir dir="${bin.dir}"/>
  122. <copy todir="${bin.dir}">
  123. <fileset dir="${src.bin.dir}"/>
  124. </copy>
  125. <chmod perm="+x">
  126. <fileset dir="${bin.dir}">
  127. <patternset refid="chmod.patterns"/>
  128. </fileset>
  129. </chmod>
  130. <fixcrlf srcdir="${bin.dir}" includes="ant,antRun" cr="remove"/>
  131. <fixcrlf srcdir="${bin.dir}" includes="*.bat" cr="add"/>
  132. </target>
  133. <!-- =================================================================== -->
  134. <!-- Creates the API documentation -->
  135. <!-- =================================================================== -->
  136. <target name="javadocs" depends="prepare" description="Creates the API documentation">
  137. <mkdir dir="${build.javadocs}"/>
  138. <javadoc packagenames="${packages}"
  139. sourcepath="${basedir}/${src.dir}"
  140. destdir="${build.javadocs}"
  141. author="true"
  142. version="true"
  143. windowtitle="${Name} API"
  144. doctitle="${Name}"
  145. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  146. </javadoc>
  147. </target>
  148. <!-- =================================================================== -->
  149. <!-- Creates the distribution -->
  150. <!-- =================================================================== -->
  151. <target name="dist" depends="main,jar,javadocs" description="Creates the distribution">
  152. <mkdir dir="${ant.dist.dir}"/>
  153. <mkdir dir="${ant.dist.dir}/bin"/>
  154. <mkdir dir="${ant.dist.dir}/lib"/>
  155. <mkdir dir="${ant.dist.dir}/docs"/>
  156. <mkdir dir="${ant.dist.dir}/docs/api"/>
  157. <mkdir dir="${ant.dist.dir}/src"/>
  158. <copy todir="${ant.dist.dir}/src">
  159. <fileset dir="${src.dir}"/>
  160. </copy>
  161. <copy todir="${ant.dist.dir}/lib">
  162. <fileset dir="${lib.dir}"/>
  163. </copy>
  164. <copy file="build.xml" tofile="${ant.dist.dir}/lib/build.xml"/>
  165. <copy todir="${ant.dist.dir}/bin">
  166. <fileset dir="src/bin"/>
  167. </copy>
  168. <copy todir="${ant.dist.dir}/docs">
  169. <fileset dir="${docs.dir}"/>
  170. </copy>
  171. <copy todir="${ant.dist.dir}/docs/api">
  172. <fileset dir="${build.javadocs}"/>
  173. </copy>
  174. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="ant,antRun" cr="remove"/>
  175. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="*.bat" cr="add"/>
  176. <chmod perm="+x">
  177. <fileset dir="${ant.dist.dir}/bin">
  178. <patternset refid="chmod.patterns"/>
  179. </fileset>
  180. </chmod>
  181. <copy file="README" tofile="${ant.dist.dir}/README"/>
  182. <copy file="WHATSNEW" tofile="${ant.dist.dir}/WHATSNEW"/>
  183. <copy file="TODO" tofile="${ant.dist.dir}/TODO"/>
  184. <copy file="LICENSE" tofile="${ant.dist.dir}/LICENSE"/>
  185. </target>
  186. <!-- =================================================================== -->
  187. <!-- Packages the distribution with ZIP -->
  188. <!-- =================================================================== -->
  189. <target name="dist-zip" depends="dist">
  190. <zip zipfile="${Name}-${version}.zip" basedir="${ant.dist.dir}" includes="**"/>
  191. </target>
  192. <!-- =================================================================== -->
  193. <!-- Packages the distribution with TAR-GZIP -->
  194. <!-- =================================================================== -->
  195. <target name="dist-tgz" depends="dist">
  196. <tar tarfile="${Name}-${version}.tar" basedir="${ant.dist.dir}" includes="**"/>
  197. <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
  198. </target>
  199. <!-- =================================================================== -->
  200. <!-- Installs the ant.jar library and binary files into ant.home -->
  201. <!-- =================================================================== -->
  202. <target name="bootstrap" depends="main" description="Installs the ant.jar library and binary files into ant.home">
  203. <echo message="copying bootstrapped files into bin and lib"/>
  204. <copy todir="lib">
  205. <fileset dir="${lib.dir}"/>
  206. </copy>
  207. <copy todir="bin">
  208. <fileset dir="${bin.dir}"/>
  209. </copy>
  210. </target>
  211. <target name="install" depends="dist" if="ant.install">
  212. <echo message="installing full copy of ant into ${ant.install}"/>
  213. <mkdir dir="${ant.install}"/>
  214. <copy todir="${ant.install}">
  215. <fileset dir="${ant.dist.dir}"/>
  216. </copy>
  217. <chmod perm="+x">
  218. <fileset dir="${ant.install}/bin">
  219. <patternset refid="chmod.patterns"/>
  220. </fileset>
  221. </chmod>
  222. </target>
  223. <target name="fullinstall" depends="install"/>
  224. <target name="mininstall" depends="main" if="ant.install">
  225. <echo message="copy minimal ant installation into ${ant.install}"/>
  226. <mkdir dir="${ant.install}"/>
  227. <copy todir="${ant.install}/lib">
  228. <fileset dir="${lib.dir}"/>
  229. </copy>
  230. <copy todir="${ant.install}/bin">
  231. <fileset dir="${bin.dir}"/>
  232. </copy>
  233. <chmod perm="+x">
  234. <fileset dir="${ant.install}/bin">
  235. <patternset refid="chmod.patterns"/>
  236. </fileset>
  237. </chmod>
  238. </target>
  239. <!-- =================================================================== -->
  240. <!-- Cleans up generated stuff -->
  241. <!-- =================================================================== -->
  242. <target name="clean">
  243. <delete dir="${build.dir}"/>
  244. <delete dir="${ant.dist.dir}"/>
  245. </target>
  246. <!-- =================================================================== -->
  247. <!-- Total cleanup -->
  248. <!-- =================================================================== -->
  249. <target name="total-clean" depends="clean">
  250. <delete dir="${bin.dir}"/>
  251. <delete file="${lib.dir}/${name}.jar"/>
  252. <delete file="${Name}-${version}.zip"/>
  253. <delete file="${Name}-${version}.tar"/>
  254. <delete file="${Name}-${version}.tar.gz"/>
  255. </target>
  256. <!-- in progress ! (may not work) -->
  257. <target name="get.snapshot">
  258. <get src="http://jakarta.apache.org/build/tmp/ant/ant.src.zip" dest="ant-src.zip" />
  259. <unzip src="ant-src.zip" dest="." />
  260. </target>
  261. <target name="make.snapshot">
  262. <cvs cvsRoot=":pserver:anoncvs@jakarta.apache.org:/home/cvspublic"
  263. package="jakarta-ant"
  264. dest="." />
  265. <zip zipfile="/www/jakarta.apache.org/builds/tmp/ant/ant.src.zip" basedir="." includes="jakarta-ant/**"/>
  266. </target>
  267. <!-- =================================================================== -->
  268. <!-- Compile testcases -->
  269. <!-- =================================================================== -->
  270. <target name="compiletests" depends="jar" if="junit.present">
  271. <mkdir dir="${build.tests}"/>
  272. <javac srcdir="${src.tests.dir}"
  273. destdir="${build.tests}"
  274. debug="on"
  275. deprecation="off" >
  276. <classpath>
  277. <pathelement location="${lib.dir}/${name}.jar" />
  278. <path refid="classpath" />
  279. </classpath>
  280. </javac>
  281. </target>
  282. <!-- =================================================================== -->
  283. <!-- Run testcase -->
  284. <!-- =================================================================== -->
  285. <target name="runtests" depends="compiletests" if="junit.present">
  286. <junit printsummary="no" haltonfailure="yes">
  287. <classpath>
  288. <pathelement location="${lib.dir}/${name}.jar" />
  289. <pathelement location="${build.tests}" />
  290. <path refid="classpath" />
  291. <pathelement path="${java.class.path}" />
  292. </classpath>
  293. <formatter type="plain" usefile="false" />
  294. <batchtest>
  295. <fileset dir="${src.tests.dir}">
  296. <include name="**/*Test*" />
  297. <!-- abstract class, not a testcase -->
  298. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  299. <!-- these depend on order -->
  300. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  301. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  302. </fileset>
  303. </batchtest>
  304. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  305. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  306. </junit>
  307. <!-- clean up again -->
  308. <delete dir="src/etc/testcases/taskdefs/taskdefs.tmp" />
  309. <delete dir="src/etc/testcases/taskdefs.tmp" />
  310. </target>
  311. <target name="run.single.test" if="testcase" depends="compiletests">
  312. <junit printsummary="no" haltonfailure="yes">
  313. <classpath>
  314. <pathelement location="${lib.dir}/${name}.jar" />
  315. <pathelement location="${build.tests}" />
  316. <path refid="classpath" />
  317. <pathelement path="${java.class.path}" />
  318. </classpath>
  319. <formatter type="plain" usefile="false" />
  320. <test name="${testcase}" />
  321. </junit>
  322. </target>
  323. </project>