making changes to Util
[Bob.git] / build.xml
blob3b571d56235da1d3cc263d984f36a4006dec897b
1 \r
2 <project name="bob" default="usage" basedir=".">\r
3         \r
4         \r
5     <!-- <property name="build.sysclasspath" value="last" /> \r
6     -->\r
7     <property name="ant.build.javac.target" value="1.6" /> \r
8         \r
9     <path id="bob.classpath" >\r
10                 \r
11                 <fileset dir="${java.home}/lib" >\r
12                     <include name="*.jar"/>\r
13                 </fileset>\r
14                 <pathelement path="templates/" />\r
15         <pathelement path="build/bootstrap" />\r
16         <pathelement path="build/src" />\r
17                 <pathelement path="build/gen" />\r
18                 <pathelement path="build/test" />\r
19         <pathelement path="test/xml/" />\r
20                 <pathelement path="lib/" />\r
21         <pathelement path="." />\r
22                 <fileset dir="lib/">\r
23                     <include name="*.jar" />\r
24                         <include name="*.properties" />\r
25                 </fileset>\r
26                 \r
27     </path>\r
28         \r
29         \r
30     <path id="run.classpath" >\r
31                 \r
32                 <!--\r
33                 <pathelement path="build/bob.jar" />\r
34                 <pathelement path="bob.jar" />\r
35                 -->\r
36                 <pathelement path="templates" />\r
37                 <pathelement path="build/src" />\r
38                 <pathelement path="build/gen" />\r
39                 <pathelement path="lib" />\r
40                 <fileset dir="lib">\r
41                     <include name="*.jar" />\r
42                         <include name="*.properties" />\r
43                 </fileset>\r
44                 <fileset dir="${java.home}/lib" >\r
45                     <include name="*.jar"/>\r
46                 </fileset>\r
47     </path>\r
48     \r
49         \r
50     <target name="usage">\r
51                 \r
52                 <echo message="BOBJava build targets..."/>\r
53                 \r
54                 <echo message=""/>\r
55                 <echo message="init"/>\r
56                 <echo message="clean"/>\r
57                 \r
58                 <echo message=""/>\r
59                 <echo message="bootstrap-src"/>\r
60                 <echo message="bootstrap-gen"/>\r
61                 <echo message="bootstrap-compile"/>\r
62                 \r
63                 <echo message=""/>\r
64                 <echo message="compile-src"/>\r
65                 <echo message="compile-tests"/>\r
66                 <echo message="compile-all"/>\r
67                 <echo message="compile-gen"/>\r
68                 \r
69                 <echo message=""/>\r
70                 <echo message="release"/>\r
71                 <echo message="run-gen"/>\r
72         <echo message="run-cc"/>\r
73         <echo message="run-docs"/>\r
74                 <echo message="run-gendocs"/>\r
75                 <echo message="run-tests"/>\r
76                 <echo message="run-test"/>\r
77     </target>\r
79     \r
80     <!-- =============================== -->\r
81     <!-- TASK DEFINITIONS               -->\r
82     <!-- =============================== -->\r
83     <taskdef name="if" classpathref="bob.classpath" classname="ise.antelope.tasks.IfTask"/>\r
84         <taskdef name="sablecc" classpathref="bob.classpath" classname="org.sablecc.ant.taskdef.Sablecc"/>\r
85         \r
86     \r
87     <!-- =============================== -->\r
88     <!-- INITIALIZE THE BUILD PROCESS    -->\r
89     <!-- =============================== -->\r
90     <target name="init" >\r
91                 <loadproperties srcFile="build.properties" />\r
92         <mkdir dir="gen"/>\r
93     </target>\r
94         \r
95         \r
96     <!-- =============================== -->\r
97     <!-- CLEAN OUT THE BUILD FILES       -->\r
98     <!-- =============================== -->\r
99     <target name="clean">\r
100                 <delete dir="build" />\r
101                 <delete dir="gen" />\r
102                 <delete dir="bootstrap" />\r
103     </target>\r
106     <!-- =============================== -->\r
107     <!-- COMPILE targets                 -->\r
108     <!-- =============================== -->\r
109     <target name="compile-all" depends="init,compile-src,compile-tests"/>\r
112     <!-- <target name="bootstrap-src" depends="bootstrap-gen">\r
113                 \r
114                 <echo message="BOOTSTRAPPING SOURCE..."/>\r
115                 <mkdir dir="${dir.build}/src"/>\r
116                 <javac srcdir="${dir.src}" \r
117                         destdir="${dir.build}/src" \r
118                         classpathref="bob.classpath" \r
119                         fork="yes" \r
120                         deprecation="on" >\r
121                     <!- <exclude name="com/interrupt/bob/core/**"/>\r
122                     ->\r
123                 </javac>\r
124         \r
125         </target>\r
126         -->\r
127         \r
128     <target name="bootstrap-gen" depends="init">\r
129                 \r
130         \r
131                 <echo message="BOOTSTRAP COMPILING 'Main'..."/>\r
132                 <mkdir dir="${dir.build}/src"/>\r
133         <javac srcdir="${dir.src}" \r
134                         destdir="${dir.build}/src" \r
135                         classpathref="bob.classpath" \r
136                         fork="yes" \r
137                         deprecation="on" \r
138                 nowarn="on" >\r
139                 </javac>\r
140                 \r
141         <echo message="" />\r
142         <echo message="" />\r
143         <echo message="BOOTSTRAP GENERATING 'Bob' Core..."/>\r
144                 <java classname="com.interrupt.bob.Main" classpathref="bob.classpath" fork="yes" > \r
145                         \r
146                         <arg line="-gen ${dir.bootstrap} -base . -end .xml -def ${bootstrap.files} -sys ${bootstrap.files}" /> \r
147                 </java>\r
148         \r
149     </target>\r
150         \r
151         <target name="bootstrap-compile" depends="bootstrap-gen">\r
152                         \r
153                 <echo message="COMPILING BOOTSTRAP SOURCE"/>\r
154                 <mkdir dir="${dir.build}/bootstrap" />\r
155                 <javac srcdir="${dir.bootstrap}" destdir="${dir.build}/bootstrap" debug="true" \r
156                     classpathref="bob.classpath" fork="yes" deprecation="on" nowarn="on" />\r
157                 \r
158     </target>\r
159         \r
160         \r
161     <target name="compile-src" depends="bootstrap-compile">\r
162                 \r
163                 <echo message="COMPILING JAVA SOURCE"/>\r
164                 <!--<mkdir dir="${dir.build}/src"/>\r
165                 -->\r
166                 <javac srcdir="${dir.src}/" destdir="${dir.build}/src" debug="true" \r
167                     classpathref="bob.classpath" fork="yes" deprecation="on" nowarn="on" />\r
168                 \r
169     </target>\r
170         \r
171     \r
172     <target name="compile-tests" depends="init,compile-src,compile-gen">\r
173                 \r
174                 <echo message="COMPILING JAVA TESTS"/>\r
175                 <mkdir dir="${dir.build}/test"/>\r
176                 <javac srcdir="${dir.test.src}" destdir="${dir.build}/test" \r
177                     classpathref="bob.classpath" fork="yes" deprecation="on" nowarn="on" />\r
178     </target>\r
179     \r
180     \r
181     <target name="compile-gen" depends="init, run-gen, run-cc">\r
182                 \r
183                 <echo message="COMPILING GEN SOURCE"/>\r
184                 <mkdir dir="${dir.build}/gen"/>\r
185                 <javac srcdir="gen" destdir="${dir.build}/gen" \r
186                     classpathref="bob.classpath" fork="yes" deprecation="on" nowarn="on" />\r
187         <copy todir="${dir.build}/gen">\r
188             <fileset dir="gen" includes="**/*.dat"/>\r
189         </copy>\r
190                 \r
191     </target>\r
194     <!-- =============================== -->\r
195     <!-- RELEASE                        -->\r
196     <!-- =============================== -->\r
197     <target name="release" depends="compile-gen, compile-src" >\r
198         <jar destfile="${dir.build}/bob.jar" includes="velocity.properties">\r
199                 \r
200             <fileset dir="${dir.build}/gen">\r
201                         <include name="com/interrupt/bob/core/**/*.class"/>\r
202                         <include name="com/interrupt/bob/handler/**/*.class"/>\r
203                 <include name="com/interrupt/cc/**/*.class"/>\r
204                 <include name="com/interrupt/cc/**/*.dat"/>\r
205                 </fileset>\r
206             <fileset dir="${dir.build}/src"/>\r
207             <fileset file="lib/velocity.properties" />\r
208             <fileset dir="templates/" />\r
209         </jar>\r
210     </target>\r
211     \r
212     \r
213     <!-- =============================== -->\r
214     <!-- RUN TARGETS                    -->\r
215     <!-- =============================== -->\r
216         <target name="predicate-run" >\r
217                 \r
218                 <available file="gen/" property="genExists" />\r
219                 <if name="genExists">\r
220                     <else>\r
221                                 <mkdir dir="gen" />\r
222                     </else>\r
223                 </if>\r
224         </target>\r
225         \r
226         <target name="run-cc" depends="init, predicate-run"> \r
227                 \r
228                 <available file="gen/com/interrupt/cc/xpath" property="ccExists" />\r
229                 <if name="ccExists">\r
230                     <else>\r
231                         <sablecc src="cc" outputdirectory="gen" includes="*.sablecc" />\r
232                     </else>\r
233                 </if>\r
234         </target>\r
235         \r
236         <target name="run-gen" depends="init, predicate-run" >\r
237                 \r
238                 <available file="gen/com/interrupt/bob" property="bobExists" />\r
239                 <if name="bobExists">\r
240                         <else>\r
241                                 <java classname="com.interrupt.bob.Main" classpathref="bob.classpath" fork="yes" >\r
242                                         <arg line="-gen ${gen.dir} -base . -end .xml -def ${all.files} -sys ${all.files}" />\r
243                                 </java>\r
244                 </else>\r
245                 </if>\r
246     </target>\r
247     \r
248     <target name="run-docs" depends="compile-gen" >\r
249                 \r
250                 <javadoc destdir="doc/api" \r
251                     windowtitle="BOB API" \r
252                     sourcepath="src/:gen/"\r
253                     classpathref="bob.classpath" >\r
254         \r
255                     <package name="com.interrupt.bob" />\r
256                     <package name="com.interrupt.bob.base" />\r
257                     <package name="com.interrupt.bob.generator" />\r
258                     <package name="com.interrupt.bob.handler" />\r
259                     <package name="com.interrupt.bob.processor" />\r
260                     <package name="com.interrupt.bob.util" />\r
261                     <package name="com.interrupt.callback" />\r
262                 </javadoc>\r
263     </target>\r
264     \r
265     <target name="run-gendocs" depends="run-gen" >\r
266                 \r
267                 <javadoc destdir="${gen.dir}/doc" \r
268                     windowtitle="Generated API" \r
269                     packagenames="${gen.packages}"\r
270                     sourcepath="${gen.dir}"\r
271                     classpathref="bob.classpath" >\r
272                 </javadoc>\r
273     </target>\r
274     \r
275     \r
276     <target name="run-tests" depends="compile-tests" >\r
277                 \r
278                 <echo message="RUNNING UNIT TESTS in directory:  ${dir.test.src}"/>\r
279                 <java classname="junit.textui.TestRunner" classpathref="bob.classpath" fork="yes" >\r
280                         <arg line="-Dbob.base=. -Dbob.end=.xml -Dbob.def=${all.files}" />\r
281                     <arg value="com.interrupt.bob.AllTests" />\r
282                 </java>\r
283     </target>\r
285     <target name="run-test" depends="compile-tests" >\r
286                 \r
287                 <echo message="RUNNING a single UNIT TEST in directory:  ${dir.test.src}"/>\r
288                 <java classname="junit.textui.TestRunner" classpathref="bob.classpath" fork="yes" >\r
289                         <arg line="-Dbob.base=. -Dbob.end=.xml -Dbob.def=${all.files}" />\r
290                     <arg value="com.interrupt.bob.TestBob" />\r
291                 </java>\r
292     </target>\r
293         \r
294         <target name='run-class' depends="init" > \r
295                 \r
296                 <java classname="com.interrupt.bob.base.Bob" classpathref="bob.classpath" fork="yes" >\r
297                         <arg line="-Dbob.base=. -Dbob.end=.xml -Dbob.def=${all.files}" />\r
298                         \r
299                 </java>\r
300                 \r
301         </target> \r
302         \r
303 </project>\r