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

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