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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  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.19.0-GA"/>
  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="compile16" depends="prepare">
  59. <javac srcdir="${src.dir}"
  60. destdir="${build.classes.dir}"
  61. debug="on"
  62. deprecation="on"
  63. source="1.6"
  64. target="1.6"
  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. <compilerarg value="-parameters" />
  79. </javac>
  80. </target>
  81. <target name="runtest" depends="test-compile">
  82. <junit fork="true" printsummary="true" dir="${test.run.dir}">
  83. <jvmarg value="-XX:-FailOverToOldVerifier" />
  84. <classpath refid="test.classpath"/>
  85. <formatter type="xml" extension=".xml"/>
  86. <test name="javassist.JvstTest" outfile="TestLog" />
  87. </junit>
  88. </target>
  89. <target name="sample" depends="compile">
  90. <javac srcdir="${basedir}"
  91. destdir="${build.classes.dir}"
  92. debug="on"
  93. deprecation="on"
  94. optimize="off"
  95. includes="sample/**"
  96. excludes="sample/hotswap/**,sample/evolve/sample/**">
  97. <classpath refid="classpath"/>
  98. </javac>
  99. <copy file="sample/vector/Test.j"
  100. todir="${build.classes.dir}/sample/vector"/>
  101. <javac srcdir="${basedir}/sample/evolve"
  102. destdir="${build.classes.dir}/sample/evolve/"
  103. debug="on"
  104. deprecation="on"
  105. optimize="off"
  106. includes="sample/**">
  107. <classpath refid="classpath"/>
  108. </javac>
  109. <copy todir="${build.classes.dir}/sample/evolve">
  110. <fileset dir="sample/evolve"/>
  111. </copy>
  112. <copy file="${build.classes.dir}/sample/evolve/WebPage.class"
  113. tofile="${build.classes.dir}/sample/evolve/WebPage.class.0"/>
  114. <copy file="${build.classes.dir}/sample/evolve/sample/evolve/WebPage.class"
  115. tofile="${build.classes.dir}/sample/evolve/WebPage.class.1"/>
  116. <javac srcdir="${basedir}/sample/hotswap"
  117. destdir="${build.classes.dir}"
  118. debug="on"
  119. deprecation="on"
  120. optimize="off"
  121. includes="*">
  122. <classpath refid="classpath"/>
  123. </javac>
  124. <mkdir dir="${build.classes.dir}/logging"/>
  125. <javac srcdir="${basedir}/sample/hotswap/logging"
  126. destdir="${build.classes.dir}/logging"
  127. debug="on"
  128. deprecation="on"
  129. optimize="off"
  130. includes="*">
  131. <classpath refid="classpath"/>
  132. </javac>
  133. <echo>To run the sample programs without ant, change the current directory
  134. to ${build.classes.dir}.</echo>
  135. </target>
  136. <target name="jar" depends="compile16">
  137. <jar jarfile="${target.jar}" update="true" manifest="${src.dir}/META-INF/MANIFEST.MF">
  138. <fileset dir="${build.classes.dir}">
  139. <include name="**/*.class"/>
  140. </fileset>
  141. </jar>
  142. <jar jarfile="${target-src.jar}" manifest="${src.dir}/META-INF/MANIFEST.MF">
  143. <fileset dir="${src.dir}">
  144. <include name="javassist/**"/>
  145. </fileset>
  146. </jar>
  147. </target>
  148. <target name="javadocs">
  149. <mkdir dir="html"/>
  150. <javadoc
  151. Locale="en_US"
  152. packagenames="javassist.*"
  153. excludepackagenames="javassist.compiler.*,javassist.convert.*,javassist.scopedpool.*,javassist.bytecode.stackmap.*"
  154. sourcepath="src/main"
  155. defaultexcludes="yes"
  156. destdir="html"
  157. author="true"
  158. version="true"
  159. use="true"
  160. public="true"
  161. nohelp="true"
  162. windowtitle="Javassist API">
  163. <doctitle><![CDATA[<h1>Javassist</h1>]]></doctitle>
  164. <bottom><![CDATA[<i>Javassist, a Java-bytecode translator toolkit.<br>
  165. Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.</i>]]></bottom>
  166. </javadoc>
  167. </target>
  168. <target name="dist" depends="jar,javadocs">
  169. <delete file="${dist-version}.zip"/>
  170. <delete file="TestLog.xml"/>
  171. <zip zipfile="${dist-version}.zip">
  172. <zipfileset dir="${basedir}" prefix="${dist-version}">
  173. <include name="html/**"/>
  174. <include name="sample/**"/>
  175. <include name="src/main/**"/>
  176. <include name="tutorial/**"/>
  177. <include name="*.html"/>
  178. <include name="*.xml"/>
  179. <include name="${target.jar}"/>
  180. </zipfileset>
  181. </zip>
  182. </target>
  183. <target name="clean">
  184. <delete dir="build"/>
  185. <delete dir="html"/>
  186. <delete file="${target.jar}"/>
  187. <delete file="${dist-version}.zip"/>
  188. </target>
  189. <!-- =================================================================== -->
  190. <!-- Run samples -->
  191. <!-- =================================================================== -->
  192. <target name = "sample-all"
  193. depends="sample-test,sample-reflect,sample-duplicate,sample-vector">
  194. <echo>** please run sample-rmi, sample-evolve, and</echo>
  195. <echo> sample-hotswap (or -hotswap5) separately **</echo>
  196. </target>
  197. <target name = "sample-test" depends="sample" >
  198. <java fork="true" dir="${run.dir}" classname="sample.Test">
  199. <classpath refid="classpath"/>
  200. </java>
  201. </target>
  202. <target name = "sample-reflect" depends="sample" >
  203. <java fork="true" dir="${run.dir}" classname="javassist.tools.reflect.Loader">
  204. <classpath refid="classpath"/>
  205. <arg line="sample.reflect.Main Joe" />
  206. </java>
  207. </target>
  208. <target name = "sample-duplicate" depends="sample" >
  209. <echo>run sample.duplicate.Viewer without reflection</echo>
  210. <java fork="true" dir="${run.dir}" classname="sample.duplicate.Viewer">
  211. <classpath refid="classpath"/>
  212. </java>
  213. <echo>run sample.duplicate.Viewer with reflection</echo>
  214. <java fork="true" dir="${run.dir}" classname="sample.duplicate.Main">
  215. <classpath refid="classpath"/>
  216. </java>
  217. </target>
  218. <target name = "sample-vector" depends="sample" >
  219. <echo>sample.preproc.Compiler sample/vector/Test.j</echo>
  220. <java fork="true" dir="${run.dir}" classname="sample.preproc.Compiler">
  221. <classpath refid="classpath"/>
  222. <arg line="sample/vector/Test.j"/>
  223. </java>
  224. <echo>javac sample/vector/Test.java</echo>
  225. <javac srcdir="${build.classes.dir}"
  226. destdir="${build.classes.dir}"
  227. includes="sample/vector/Test.java">
  228. <classpath refid="classpath"/>
  229. </javac>
  230. <java fork="true" dir="${run.dir}" classname="sample.vector.Test" />
  231. </target>
  232. <target name = "sample-rmi" depends="sample" >
  233. <echo>** Please open sample/rmi/webdemo.html with your browser **</echo>
  234. <java fork="true" dir="${run.dir}" classname="sample.rmi.Counter">
  235. <classpath refid="classpath"/>
  236. <arg value="5001" />
  237. </java>
  238. </target>
  239. <target name = "sample-evolve" depends="sample" >
  240. <echo>** Please open http://localhost:5003/demo.html with your browser **</echo>
  241. <java fork="true" dir="${run.dir}" classname="sample.evolve.DemoLoader">
  242. <classpath refid="classpath"/>
  243. <arg value="5003" />
  244. </java>
  245. </target>
  246. <!-- for JDK 1.4 -->
  247. <target name = "sample-hotswap" depends="sample">
  248. <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
  249. <echo>** for JDK 1.4</echo>
  250. <java fork="true" dir="${run.dir}" classname="Test">
  251. <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000" />
  252. <classpath refid="classpath"/>
  253. </java>
  254. </target>
  255. <!-- for Java 5 -->
  256. <target name = "sample-hotswap5" depends="sample">
  257. <echo>** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH</echo>
  258. <echo>** for JDK 1.5 or later</echo>
  259. <java fork="true" dir="${run.dir}" classname="Test">
  260. <jvmarg line="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000" />
  261. <classpath refid="classpath"/>
  262. </java>
  263. </target>
  264. </project>