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

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