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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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 dir="${src.bin.dir}" todir="${bin.dir}"/>
  123. <chmod perm="+x">
  124. <fileset dir="${bin.dir}">
  125. <patternset refid="chmod.patterns"/>
  126. </fileset>
  127. </chmod>
  128. <fixcrlf srcdir="${bin.dir}" includes="ant,antRun" cr="remove"/>
  129. <fixcrlf srcdir="${bin.dir}" includes="*.bat" cr="add"/>
  130. </target>
  131. <!-- =================================================================== -->
  132. <!-- Creates the API documentation -->
  133. <!-- =================================================================== -->
  134. <target name="javadocs" depends="prepare" description="Creates the API documentation">
  135. <mkdir dir="${build.javadocs}"/>
  136. <javadoc packagenames="${packages}"
  137. sourcepath="${basedir}/${src.dir}"
  138. destdir="${build.javadocs}"
  139. author="true"
  140. version="true"
  141. windowtitle="${Name} API"
  142. doctitle="${Name}"
  143. bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
  144. </javadoc>
  145. </target>
  146. <!-- =================================================================== -->
  147. <!-- Creates the distribution -->
  148. <!-- =================================================================== -->
  149. <target name="dist" depends="main,jar,javadocs" description="Creates the distribution">
  150. <mkdir dir="${ant.dist.dir}"/>
  151. <mkdir dir="${ant.dist.dir}/bin"/>
  152. <mkdir dir="${ant.dist.dir}/lib"/>
  153. <mkdir dir="${ant.dist.dir}/docs"/>
  154. <mkdir dir="${ant.dist.dir}/docs/api"/>
  155. <mkdir dir="${ant.dist.dir}/src"/>
  156. <copy dir="${src.dir}" todir="${ant.dist.dir}/src"/>
  157. <copy dir="${lib.dir}" todir="${ant.dist.dir}/lib"/>
  158. <copy file="build.xml" tofile="${ant.dist.dir}/lib/build.xml"/>
  159. <copy dir="src/bin" todir="${ant.dist.dir}/bin"/>
  160. <copy dir="${docs.dir}" todir="${ant.dist.dir}/docs"/>
  161. <copy dir="${build.javadocs}" todir="${ant.dist.dir}/docs/api"/>
  162. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="ant,antRun" cr="remove"/>
  163. <fixcrlf srcdir="${ant.dist.dir}/bin" includes="*.bat" cr="add"/>
  164. <chmod perm="+x">
  165. <fileset dir="${ant.dist.dir}/bin">
  166. <patternset refid="chmod.patterns"/>
  167. </fileset>
  168. </chmod>
  169. <copy file="README" tofile="${ant.dist.dir}/README"/>
  170. <copy file="WHATSNEW" tofile="${ant.dist.dir}/WHATSNEW"/>
  171. <copy file="TODO" tofile="${ant.dist.dir}/TODO"/>
  172. <copy file="LICENSE" tofile="${ant.dist.dir}/LICENSE"/>
  173. </target>
  174. <!-- =================================================================== -->
  175. <!-- Packages the distribution with ZIP -->
  176. <!-- =================================================================== -->
  177. <target name="dist-zip" depends="dist">
  178. <zip zipfile="${Name}-${version}.zip" basedir="${ant.dist.dir}" includes="**"/>
  179. </target>
  180. <!-- =================================================================== -->
  181. <!-- Packages the distribution with TAR-GZIP -->
  182. <!-- =================================================================== -->
  183. <target name="dist-tgz" depends="dist">
  184. <tar tarfile="${Name}-${version}.tar" basedir="${ant.dist.dir}" includes="**"/>
  185. <gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
  186. </target>
  187. <!-- =================================================================== -->
  188. <!-- Installs the ant.jar library and binary files into ant.home -->
  189. <!-- =================================================================== -->
  190. <target name="bootstrap" depends="main" description="Installs the ant.jar library and binary files into ant.home">
  191. <echo message="copying bootstrapped files into bin and lib"/>
  192. <copy dir="${lib.dir}" todir="lib"/>
  193. <copy dir="${bin.dir}" todir="bin"/>
  194. </target>
  195. <target name="install" depends="dist" if="ant.install">
  196. <echo message="installing full copy of ant into ${ant.install}"/>
  197. <mkdir dir="${ant.install}"/>
  198. <copy dir="${ant.dist.dir}" todir="${ant.install}"/>
  199. <chmod perm="+x">
  200. <fileset dir="${ant.install}/bin">
  201. <patternset refid="chmod.patterns"/>
  202. </fileset>
  203. </chmod>
  204. </target>
  205. <target name="fullinstall" depends="install"/>
  206. <target name="mininstall" depends="main" if="ant.install">
  207. <echo message="copy minimal ant installation into ${ant.install}"/>
  208. <mkdir dir="${ant.install}"/>
  209. <copy dir="${lib.dir}" todir="${ant.install}/lib"/>
  210. <copy dir="${bin.dir}" todir="${ant.install}/bin"/>
  211. <chmod perm="+x">
  212. <fileset dir="${ant.install}/bin">
  213. <patternset refid="chmod.patterns"/>
  214. </fileset>
  215. </chmod>
  216. </target>
  217. <!-- =================================================================== -->
  218. <!-- Cleans up generated stuff -->
  219. <!-- =================================================================== -->
  220. <target name="clean">
  221. <delete dir="${build.dir}"/>
  222. <delete dir="${ant.dist.dir}"/>
  223. </target>
  224. <!-- =================================================================== -->
  225. <!-- Total cleanup -->
  226. <!-- =================================================================== -->
  227. <target name="total-clean" depends="clean">
  228. <delete dir="${bin.dir}"/>
  229. <delete file="${lib.dir}/${name}.jar"/>
  230. <delete file="${Name}-${version}.zip"/>
  231. <delete file="${Name}-${version}.tar"/>
  232. <delete file="${Name}-${version}.tar.gz"/>
  233. </target>
  234. <!-- in progress ! (may not work) -->
  235. <target name="get.snapshot">
  236. <get src="http://jakarta.apache.org/build/tmp/ant/ant.src.zip" dest="ant-src.zip" />
  237. <unzip src="ant-src.zip" dest="." />
  238. </target>
  239. <target name="make.snapshot">
  240. <cvs cvsRoot=":pserver:anoncvs@jakarta.apache.org:/home/cvspublic"
  241. package="jakarta-ant"
  242. dest="." />
  243. <zip zipfile="/www/jakarta.apache.org/builds/tmp/ant/ant.src.zip" basedir="." includes="jakarta-ant/**"/>
  244. </target>
  245. <!-- =================================================================== -->
  246. <!-- Compile testcases -->
  247. <!-- =================================================================== -->
  248. <target name="compiletests" depends="jar" if="junit.present">
  249. <mkdir dir="${build.tests}"/>
  250. <javac srcdir="${src.tests.dir}"
  251. destdir="${build.tests}"
  252. debug="on"
  253. deprecation="off" >
  254. <classpath>
  255. <pathelement location="${lib.dir}/${name}.jar" />
  256. <path refid="classpath" />
  257. </classpath>
  258. </javac>
  259. </target>
  260. <!-- =================================================================== -->
  261. <!-- Run testcase -->
  262. <!-- =================================================================== -->
  263. <target name="runtests" depends="compiletests" if="junit.present">
  264. <junit printsummary="no" fork="yes" haltonfailure="yes">
  265. <classpath>
  266. <pathelement location="${lib.dir}/${name}.jar" />
  267. <pathelement location="${build.tests}" />
  268. <path refid="classpath" />
  269. <pathelement path="${java.class.path}" />
  270. </classpath>
  271. <formatter type="plain" usefile="false" />
  272. <batchtest>
  273. <fileset dir="${src.tests.dir}">
  274. <include name="**/*Test*" />
  275. <!-- abstract class, not a testcase -->
  276. <exclude name="org/apache/tools/ant/taskdefs/TaskdefsTest.java" />
  277. <!-- these depend on order -->
  278. <exclude name="org/apache/tools/ant/taskdefs/GUnzipTest.java" />
  279. <exclude name="org/apache/tools/ant/taskdefs/GzipTest.java" />
  280. </fileset>
  281. </batchtest>
  282. <test name="org.apache.tools.ant.taskdefs.GzipTest" />
  283. <test name="org.apache.tools.ant.taskdefs.GUnzipTest" />
  284. </junit>
  285. <!-- clean up again -->
  286. <delete dir="src/etc/testcases/taskdefs/taskdefs.tmp" />
  287. <delete dir="src/etc/testcases/taskdefs.tmp" />
  288. </target>
  289. <target name="run.single.test" if="testcase" depends="compiletests">
  290. <junit printsummary="no" fork="yes" haltonfailure="yes">
  291. <classpath>
  292. <pathelement location="${lib.dir}/${name}.jar" />
  293. <pathelement location="${build.tests}" />
  294. <path refid="classpath" />
  295. <pathelement path="${java.class.path}" />
  296. </classpath>
  297. <formatter type="plain" usefile="false" />
  298. <test name="${testcase}" />
  299. </junit>
  300. </target>
  301. </project>