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