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

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