You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <?xml version="1.0"?>
  2. <!-- =================================================================== -->
  3. <!-- JBoss build file -->
  4. <!-- =================================================================== -->
  5. <project name="javassist" default="jar" basedir=".">
  6. <property name="dist-version" value="javassist-3.18.1-Beta1"/>
  7. <property environment="env"/>
  8. <property name="target.jar" value="javassist.jar"/>
  9. <property name="target-src.jar" value="javassist-src.jar"/>
  10. <property name="lib.dir" value="${basedir}/lib"/>
  11. <property name="src.dir" value="${basedir}/src/main"/>
  12. <property name="build.dir" value="${basedir}/target"/>
  13. <property name="build.classes.dir" value="${build.dir}/classes"/>
  14. <property name="test.src.dir" value="${basedir}/src/test"/>
  15. <property name="test.build.dir" value="${build.dir}/test-classes"/>
  16. <property name="test.run.dir" value="${basedir}/runtest"/>
  17. <property name="test.reports.dir" value = "${build.dir}/test-output"/>
  18. <property name="run.dir" value="${build.classes.dir}"/>
  19. <!-- Build classpath -->
  20. <path id="classpath">
  21. <pathelement location="${build.classes.dir}"/>
  22. </path>
  23. <property name="build.classpath" refid="classpath"/>
  24. <path id="test.compile.classpath">
  25. <pathelement location="${build.classes.dir}"/>
  26. <pathelement location="${lib.dir}/junit.jar"/>
  27. </path>
  28. <property name="test.compile.classpath" refid="test.compile.classpath"/>
  29. <path id="test.classpath">
  30. <pathelement location="${test.build.dir}"/>
  31. <pathelement location="${lib.dir}/junit.jar"/>
  32. <pathelement location="${build.classes.dir}"/>
  33. </path>
  34. <property name="test.classpath" refid="test.classpath"/>
  35. <!-- =================================================================== -->
  36. <!-- Prepares the build directory -->
  37. <!-- =================================================================== -->
  38. <target name="prepare" >
  39. <mkdir dir="${build.dir}"/>
  40. <mkdir dir="${build.classes.dir}"/>
  41. <mkdir dir="${test.build.dir}"/>
  42. <mkdir dir="${test.reports.dir}"/>
  43. <mkdir dir="${test.run.dir}"/>
  44. </target>
  45. <!-- =================================================================== -->
  46. <!-- Compiles the source code -->
  47. <!-- =================================================================== -->
  48. <target name="compile" depends="prepare">
  49. <javac srcdir="${src.dir}"
  50. destdir="${build.classes.dir}"
  51. debug="on"
  52. deprecation="on"
  53. optimize="off"
  54. includes="**">
  55. <classpath refid="classpath"/>
  56. </javac>
  57. </target>
  58. <target name="compile14" depends="prepare">
  59. <javac srcdir="${src.dir}"
  60. destdir="${build.classes.dir}"
  61. debug="on"
  62. deprecation="on"
  63. source="1.4"
  64. target="1.4"
  65. optimize="off"
  66. includes="**">
  67. <classpath refid="classpath"/>
  68. </javac>
  69. </target>
  70. <target name="test-compile" depends="compile">
  71. <javac srcdir="${test.src.dir}"
  72. destdir="${test.build.dir}"
  73. debug="on"
  74. deprecation="on"
  75. optimize="off"
  76. includes="**">
  77. <classpath refid="test.compile.classpath"/>
  78. </javac>
  79. </target>
  80. <target name="runtest" depends="test-compile">
  81. <junit fork="true" printsummary="true" dir="${test.run.dir}">
  82. <jvmarg value="-XX:-FailOverToOldVerifier" />
  83. <classpath refid="test.classpath"/>
  84. <formatter type="xml" extension=".xml"/>
  85. <test name="javassist.JvstTest" outfile="TestLog" />
  86. </junit>
  87. </target>
  88. <target name="sample" depends="compile">
  89. <javac srcdir="${basedir}"
  90. destdir="${build.classes.dir}"
  91. debug="on"
  92. deprecation="on"
  93. optimize="off"
  94. includes="sample/**"
  95. excludes="sample/hotswap/**,sample/evolve/sample/**">
  96. <classpath refid="classpath"/>
  97. </javac>
  98. <copy file="sample/vector/Test.j"
  99. todir="${build.classes.dir}/sample/vector"/>
  100. <javac srcdir="${basedir}/sample/evolve"
  101. destdir="${build.classes.dir}/sample/evolve/"
  102. debug="on"
  103. deprecation="on"
  104. optimize="off"
  105. includes="sample/**">
  106. <classpath refid="classpath"/>
  107. </javac>
  108. <copy todir="${build.classes.dir}/sample/evolve">
  109. <fileset dir="sample/evolve"/>
  110. </copy>
  111. <copy file="${build.classes.dir}/sample/evolve/WebPage.class"
  112. tofile="${build.classes.dir}/sample/evolve/WebPage.class.0"/>
  113. <copy file="${build.classes.dir}/sample/evolve/sample/evolve/WebPage.class"
  114. tofile="${build.classes.dir}/sample/evolve/WebPage.class.1"/>
  115. <javac srcdir="${basedir}/sample/hotswap"
  116. destdir="${build.classes.dir}"
  117. debug="on"
  118. deprecation="on"
  119. optimize="off"
  120. includes="*">
  121. <classpath refid="classpath"/>
  122. </javac>
  123. <mkdir dir="${build.classes.dir}/logging"/>
  124. <javac srcdir="${basedir}/sample/hotswap/logging"
  125. destdir="${build.classes.dir}/logging"
  126. debug="on"
  127. deprecation="on"
  128. optimize="off"
  129. includes="*">
  130. <classpath refid="classpath"/>
  131. </javac>
  132. <echo>To run the sample programs without ant, change the current directory
  133. to ${build.classes.dir}.</echo>
  134. </target>
  135. <target name="jar" depends="compile14">
  136. <jar jarfile="${target.jar}" update="true" manifest="${src.dir}/META-INF/MANIFEST.MF">
  137. <fileset dir="${build.classes.dir}">
  138. <include name="**/*.class"/>
  139. </fileset>
  140. </jar>
  141. <jar jarfile="${target-src.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
  142. <fileset dir="${src.dir}">
  143. <include name="javassist/**"/>
  144. </fileset>
  145. </jar>
  146. </target>
  147. <target name="javadocs">
  148. <mkdir dir="html"/>
  149. <javadoc
  150. Locale="en_US"
  151. packagenames="javassist.*"
  152. excludepackagenames="javassist.compiler.*,javassist.convert.*,javassist.scopedpool.*,javassist.bytecode.stackmap.*"
  153. sourcepath="src/main"
  154. defaultexcludes="yes"
  155. destdir="html"
  156. author="true"
  157. version="true"
  158. use="true"
  159. public="true"
  160. nohelp="true"
  161. windowtitle="Javassist API">
  162. <doctitle><![CDATA[<h1>Javassist</h1>]]></doctitle>
  163. <bottom><![CDATA[<i>Javassist, a Java-bytecode translator toolkit.<br>
  164. Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
  165. </javadoc>
  166. </target>
  167. <target name="dist" depends="jar,javadocs">
  168. <delete file="${dist-version}.zip"/>
  169. <delete file="TestLog.xml"/>
  170. <zip zipfile="${dist-version}.zip">
  171. <zipfileset dir="${basedir}" prefix="${dist-version}">
  172. <include name="html/**"/>
  173. <include name="sample/**"/>
  174. <include name="src/main/**"/>
  175. <include name="tutorial/**"/>
  176. <include name="*.html"/>
  177. <include name="*.xml"/>
  178. <include name="${target.jar}"/>
  179. </zipfileset>
  180. </zip>
  181. </target>
  182. <target name="clean">
  183. <delete dir="build"/>
  184. <delete dir="html"/>
  185. <delete file="${target.jar}"/>
  186. <delete file="${dist-version}.zip"/>
  187. </target>
  188. <!-- =================================================================== -->
  189. <!-- Run samples -->
  190. <!-- =================================================================== -->
  191. <target name = "sample-all"
  192. depends="sample-test,sample-reflect,sample-duplicate,sample-vector">
  193. <echo>** please run sample-rmi, sample-evolve, and</echo>
  194. <echo> sample-hotswap (or -hotswap5) separately **</echo>
  195. </target>
  196. <target name = "sample-test" depends="sample" >
  197. <java fork="true" dir="${run.dir}" classname="sample.Test">
  198. <classpath refid="classpath"/>
  199. </java>
  200. </target>
  201. <target name = "sample-reflect" depends="sample" >
  202. <java fork="true" dir="${run.dir}" classname="javassist.tools.reflect.Loader">
  203. <classpath refid="classpath"/>
  204. <arg line="sample.reflect.Main Joe" />
  205. </java>
  206. </target>
  207. <target name = "sample-duplicate" depends="sample" >
  208. <echo>run sample.duplicate.Viewer without reflection</echo>
  209. <java fork="true" dir="${run.dir}" classname="sample.duplicate.Viewer">
  210. <classpath refid="classpath"/>
  211. </java>
  212. <echo>run sample.duplicate.Viewer with reflection</echo>
  213. <java fork="true" dir="${run.dir}" classname="sample.duplicate.Main">
  214. <classpath refid="classpath"/>
  215. </java>
  216. </target>
  217. <target name = "sample-vector" depends="sample" >
  218. <echo>sample.preproc.Compiler sample/vector/Test.j</echo>
  219. <java fork="true" dir="${run.dir}" classname="sample.preproc.Compiler">
  220. <classpath refid="classpath"/>
  221. <arg line="sample/vector/Test.j"/>
  222. </java>
  223. <echo>javac sample/vector/Test.java</echo>
  224. <javac srcdir="${build.classes.dir}"
  225. destdir="${build.classes.dir}"
  226. includes="sample/vector/Test.java">
  227. <classpath refid="classpath"/>
  228. </javac>
  229. <java fork="true" dir="${run.dir}" classname="sample.vector.Test" />
  230. </target>
  231. <target name = "sample-rmi" depends="sample" >
  232. <echo>** Please open sample/rmi/webdemo.html with your browser **</echo>
  233. <java fork="true" dir="${run.dir}" classname="sample.rmi.Counter">
  234. <classpath refid="classpath"/>
  235. <arg value="5001" />
  236. </java>
  237. </target>
  238. <target name = "sample-evolve" depends="sample" >
  239. <echo>** Please open http://localhost:5003/demo.html with your browser **</echo>
  240. <java fork="true" dir="${run.dir}" classname="sample.evolve.DemoLoader">
  241. <classpath refid="classpath"/>
  242. <arg value="5003" />
  243. </java>
  244. </target>
  245. <!-- for JDK 1.4 -->
  246. <target name = "sample-hotswap" depends="sample">
  247. <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
  248. <echo>** for JDK 1.4</echo>
  249. <java fork="true" dir="${run.dir}" classname="Test">
  250. <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" />
  251. <classpath refid="classpath"/>
  252. </java>
  253. </target>
  254. <!-- for Java 5 -->
  255. <target name = "sample-hotswap5" depends="sample">
  256. <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
  257. <echo>** for JDK 1.5 or later</echo>
  258. <java fork="true" dir="${run.dir}" classname="Test">
  259. <jvmarg line="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000" />
  260. <classpath refid="classpath"/>
  261. </java>
  262. </target>
  263. </project>