2 <project name="bookkeeping" default="usage" basedir=".">
5 <property name="ant.build.javac.target" value="1.5" />
7 <!-- <path id="bookkeeping.classpath">
8 <pathelement path="${dir.build}/test" />
9 <pathelement path="${dir.build}/gen" />
10 <pathelement path="${dir.build}/src" />
11 <pathelement path="xml" />
12 <fileset dir="${java.home}/lib" >
13 <include name="*.jar"/>
16 <include name="**/*.jar" />
17 <include name="**/*.properties"/>
22 <path id="bookkeeping.classpath">
23 <pathelement path="${dir.build}/gen" />
24 <pathelement path="${dir.build}/src" />
25 <pathelement path="${dir.build}/test" />
26 <pathelement path="lib/" />
27 <pathelement path="xml/" />
28 <pathelement path="xml/http/" />
29 <pathelement path="test/xml/" />
30 <pathelement path="test/xml/http/" />
31 <pathelement path="." />
33 <include name="**/*.jar" />
34 <include name="**/*.properties"/>
36 <fileset dir="${java.home}/lib" >
37 <include name="**/*.jar"/>
42 <!-- Define the Cactus tasks -->
43 <path id="cactus.classpath" >
44 <pathelement location="lib/cactus/cactus-1.7.2.jar"/>
45 <pathelement location="lib/cactus/cactus-ant-1.7.2.jar"/>
46 <pathelement location="lib/cactus/commons-httpclient-2.0.2.jar"/>
47 <pathelement location="lib/cactus/commons-logging-1.0.4.jar"/>
48 <pathelement location="lib/cactus/aspectjrt-1.2.1.jar"/>
49 <pathelement location="lib/cactus/httpunit-1.6.jar"/>
50 <pathelement location="lib/cactus/nekohtml-0.9.1.jar"/>
51 <pathelement location="lib/cactus/servletapi-2.3.jar"/>
52 <pathelement location="lib/cactus/cargo-0.5.jar"/>
54 <taskdef resource="cactus.tasks" classpathref="cactus.classpath" />
59 <echo message="'bookkeeping' build targets..."/>
62 <echo message="init"/>
63 <echo message="clean"/>
64 <echo message="compile-all"/>
65 <echo message="compile-src"/>
66 <echo message="compile-tests"/>
67 <echo message="compile-gen"/>
70 <echo message="run-gen"/>
71 <echo message="run-cc"/>
72 <echo message="run-tests"/>
73 <echo message="run-test"/>
74 <echo message="run-docs"/>
75 <echo message="run-class"/>
76 <echo message="deploy"/>
77 <echo message="deploy-war"/>
79 <echo message="release"/>
80 <echo message="release-war"/>
82 <echo message="cactus-deploy"/>
83 <echo message="cactus-run"/>
86 <echo message="compile-htest"/>
87 <echo message="run-htest"/>
92 <!-- =============================== -->
93 <!-- TASK DEFINITIONS -->
94 <!-- =============================== -->
95 <taskdef name="if" classpathref="bookkeeping.classpath" classname="ise.antelope.tasks.IfTask"/>
96 <taskdef name="sablecc" classpathref="bookkeeping.classpath" classname="org.sablecc.ant.taskdef.Sablecc"/>
99 <!-- =============================== -->
100 <!-- INITIALIZE THE BUILD PROCESS -->
101 <!-- =============================== -->
102 <target name="init" >
103 <loadproperties srcFile="build.properties" />
107 <!-- =============================== -->
108 <!-- CLEAN OUT THE BUILD FILES -->
109 <!-- =============================== -->
110 <target name="clean">
111 <delete dir="build" failonerror="false" />
112 <delete dir="gen" failonerror="false" />
113 <delete dir="cc/com" failonerror="false" />
117 <!-- =============================== -->
118 <!-- CREATE the generated java files -->
119 <!-- =============================== -->
120 <target name="run-gen" >
122 <available file="gen/" property="genExists" />
123 <if name="genExists">
129 <!-- BOB GENERATION -->
130 <java classname="com.interrupt.bob.Main" classpathref="bookkeeping.classpath" fork="yes" >
132 <!-- <arg line="-gen gen -base . -end .xml -def ${xml.files} -sys ${system.files}" /> -->
133 <arg line="-gen gen -base . -end .xml -def 'xml/bookkeeping.2.bookkeeping.xml xml/bookkeeping.2.transactions.xml xml/bookkeeping.2.users.xml xml/bookkeeping.authorise.xml xml/bookkeeping.system.xml xml/bookkeeping.debitPointers.xml test/xml/test.currencies.xml test/xml/test.currencies.badpointers.xml' -sys 'xml/bookkeeping.2.bookkeeping.xml xml/bookkeeping.2.transactions.xml xml/bookkeeping.2.users.xml xml/bookkeeping.authorise.xml xml/bookkeeping.system.xml xml/bookkeeping.debitPointers.xml test/xml/test.currencies.xml test/xml/test.currencies.badpointers.xml'" />
141 <!-- =============================== -->
142 <!-- COMPILE targets -->
143 <!-- =============================== -->
144 <target name="compile-all" depends="init,run-gen,compile-src,compile-tests"/>
146 <target name="compile-src" depends="init,compile-gen">
148 <echo message="COMPILING JAVA SOURCE"/>
149 <mkdir dir="${dir.build}/src"/>
151 <javac srcdir="${dir.src}" destdir="${dir.build}/src" debug="true" fork="yes" >
155 <compilerarg line="-Xlint" />
156 <arg value="com.interrupt.bookkeeping.AllTests" />
160 <pathelement path="${dir.build}/test" />
161 <pathelement path="${dir.build}/gen" />
162 <pathelement path="${dir.build}/src" />
163 <pathelement path="xml" />
164 <fileset dir="${java.home}/lib" >
165 <include name="**/*.jar"/>
168 <include name="**/*.jar" />
169 <include name="**/*.properties"/>
177 <target name="run-cc" depends="init">
179 <available file="gen/com/interrupt/bookkeeping/cc/analysis" property="ccExists" />
185 <sablecc src="cc" outputdirectory="gen" includes="*.grammar" />
187 <!-- need to hack the lexer code and there's no easy way to sub-type
188 <copy todir="gen/com/interrupt/bookkeeping/cc/lexer/" overwrite="true">
189 <fileset file="src/com/interrupt/bookkeeping/cc/lexer/Lexer.java" />
198 <target name="compile-htest" depends="init">
200 <echo message="COMPILING htest"/>
201 <javac srcdir="htest" destdir="." fork="yes" deprecation="on" >
204 <fileset dir="${java.home}/lib" >
205 <include name="**/*.jar"/>
208 <include name="**/*.jar" />
214 <target name="run-htest" depends="compile-htest,init">
216 <echo message="RUNNING htest"/>
217 <java classname="Testing" >
220 <pathelement path="." />
221 <fileset dir="${java.home}/lib" >
222 <include name="**/*.jar"/>
225 <include name="**/*.jar" />
232 <target name="compile-tests" depends="init, compile-src">
234 <echo message="COMPILING JAVA TESTS"/>
235 <mkdir dir="${dir.build}/test"/>
236 <javac srcdir="${dir.test.src}" destdir="${dir.build}/test" debug="true" deprecation="on" >
238 <!-- <compilerarg line="-Xlint" />
242 <pathelement path="${dir.build}/gen" />
243 <pathelement path="${dir.build}/src" />
244 <pathelement path="${dir.build}/test" />
245 <pathelement path="xml" />
246 <fileset dir="${java.home}/lib" >
247 <include name="**/*.jar"/>
250 <include name="**/*.jar" />
251 <include name="**/*.properties"/>
258 <target name="compile-gen" depends="init,run-gen,run-cc">
262 <!-- copy over Token with a toString() that doesn't add extra stuff
263 <copy todir="gen/com/interrupt/bookkeeping/cc/node/" overwrite="true">
264 <fileset file="src/com/interrupt/bookkeeping/cc/node/Token.java" />
268 <echo message="COMPILING GEN SOURCE"/>
269 <mkdir dir="${dir.build}/gen"/>
270 <javac srcdir="gen" destdir="${dir.build}/gen" fork="yes" debug="true" deprecation="on" >
272 <pathelement path="${dir.build}/src" />
273 <pathelement path="${dir.build}/test" />
274 <fileset dir="${java.home}/lib" >
275 <include name="**/*.jar"/>
278 <include name="**/*.jar" />
279 <include name="**/*.properties"/>
285 <!-- copy over SableCC dat files -->
286 <copy todir="${dir.build}/gen" >
287 <fileset dir="gen" includes="**/*.dat" />
294 <!-- =============================== -->
296 <!-- =============================== -->
297 <target name="run-tests" depends="compile-tests" >
299 <echo message="RUNNING UNIT TESTS in directory: ${dir.test.src}"/>
300 <!-- <java classname="junit.textui.TestRunner" classpathref="bookkeeping.classpath" fork="yes" > -->
301 <java classname="junit.textui.TestRunner" fork="yes" >
303 <arg value="com.interrupt.bookkeeping.AllTests" />
306 <pathelement path="${dir.build}/gen" />
307 <pathelement path="${dir.build}/src" />
308 <pathelement path="${dir.build}/test" />
309 <pathelement path="lib/" />
310 <pathelement path="xml/" />
311 <pathelement path="xml/http/" />
312 <pathelement path="test/xml/" />
313 <pathelement path="test/xml/http/" />
314 <pathelement path="." />
317 <include name="**/*.jar" />
318 <include name="**/*.properties"/>
320 <fileset dir="${java.home}/lib" >
321 <include name="**/*.jar"/>
329 <target name="run-test" depends="compile-tests" >
331 <echo message="RUNNING a Single UNIT TEST in directory: ${dir.test.src}"/>
332 <!-- <java classname="junit.textui.TestRunner" fork="yes" >
334 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
335 <sysproperty key="exist.initdb" value="true" />
336 <sysproperty key="exist.home" value="." />
337 <arg value="com.interrupt.bookkeeping.cc.kkell.aauth.TestAAuthentication" />
340 <pathelement path="${dir.build}/gen" />
341 <pathelement path="${dir.build}/src" />
342 <pathelement path="${dir.build}/test" />
343 <pathelement path="lib/" />
344 <pathelement path="xml/" />
345 <pathelement path="xml/http/" />
346 <pathelement path="test/xml/http/" />
347 <pathelement path="." />
349 <include name="**/*.jar" />
350 <include name="**/*.properties"/>
352 <fileset dir="${java.home}/lib" >
353 <include name="*.jar"/>
358 <java classname="junit.textui.TestRunner" fork="yes" >
360 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
361 <sysproperty key="exist.initdb" value="true" />
362 <sysproperty key="exist.home" value="." />
363 <arg value="com.interrupt.bookkeeping.TestGeneral" />
365 <pathelement path="${dir.build}/gen" />
366 <pathelement path="${dir.build}/src" />
367 <pathelement path="${dir.build}/test" />
368 <pathelement path="lib/" />
369 <pathelement path="xml/" />
370 <pathelement path="xml/http/" />
371 <pathelement path="test/xml/" />
372 <pathelement path="test/xml/http/" />
373 <pathelement path="." />
375 <include name="**/*.jar" />
376 <include name="**/*.properties"/>
378 <fileset dir="${java.home}/lib" >
379 <include name="*.jar"/>
385 <java classname="junit.textui.TestRunner" fork="yes" >
387 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
388 <sysproperty key="exist.initdb" value="true" />
389 <sysproperty key="exist.home" value="." />
391 <sysproperty key="org.xml.sax.features.validation" value="false" />
392 <sysproperty key="java.endorsed.dirs" value="lib/endorsed" />
394 <arg value="com.interrupt.bookkeeping.cc.kkell.TestBKellFunctional" />
396 <pathelement path="${dir.build}/gen" />
397 <pathelement path="${dir.build}/src" />
398 <pathelement path="${dir.build}/test" />
399 <pathelement path="lib/" />
400 <pathelement path="xml/" />
401 <pathelement path="xml/http/" />
402 <pathelement path="test/bk/" />
403 <pathelement path="test/xml/" />
404 <pathelement path="test/xml/http/" />
405 <pathelement path="." />
407 <include name="**/*.jar" />
408 <include name="**/*.properties"/>
410 <fileset dir="${java.home}/lib" >
411 <include name="**/*.jar"/>
419 <target name='cactus-deploy' depends='release-war' >
421 <echo message="DEPLOYING 'bookkeeping-cactus.war' to ${tomcat.home}/webapps " />
422 <available file="${dir.build}/bookkeeping-cactus.war" property="cactusExists" />
423 <if name="cactusExists">
425 <cactifywar destfile="${dir.build}/bookkeeping-cactus.war" srcfile="${dir.build}/webkell.war" />
428 <copy todir="${tomcat.home}/webapps/"
429 file="${dir.build}/bookkeeping-cactus.war" />
434 <target name='cactus-run' depends='cactus-deploy' >
436 <property name="CATALINA_HOME" value="${tomcat.home}" />
437 <property name="CATALINA_BASE" value="${tomcat.home}" />
438 <property name="CATALINA_TMPDIR" value="${tomcat.home}/temp" />
439 <exec executable="${tomcat.home}/bin/setclasspath.sh">
442 <cactus warfile="${dir.build}/bookkeeping-cactus.war"
443 printsummary="yes" failureproperty="tests.failed">
446 <path refid="bookkeeping.classpath"/>
450 <tomcat5x dir="${tomcat.home}" port="8080" />
453 <formatter type="xml"/>
455 <fileset dir="${dir.test.src}">
456 <include name="**/CactusTests.java"/>
457 <!-- <exclude name="**/TestAll.java"/> -->
464 <target name='run-class' depends='compile-src' >
467 <java classname="com.interrupt.bookkeeping.cc.bkell.Bkell" classpathref="bookkeeping.classpath" fork='true' >
470 <pathelement path="${dir.build}/test" />
471 <pathelement path="${dir.build}/gen" />
472 <pathelement path="${dir.build}/src" />
473 <pathelement path="xml" />
474 <fileset dir="${java.home}/lib" >
475 <include name="**/*.jar"/>
478 <include name="**/*.jar" />
479 <include name="**/*.properties"/>
485 <!-- <java classname="com.interrupt.persistence.xml.Spittoon" fork="true" >
487 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
488 <sysproperty key="exist.initdb" value="true" />
489 <sysproperty key="exist.home" value="." />
492 <pathelement path="${dir.build}/gen" />
493 <pathelement path="${dir.build}/src" />
494 <pathelement path="${dir.build}/test" />
495 <pathelement path="lib/" />
496 <pathelement path="xml/" />
497 <pathelement path="xml/http/" />
498 <pathelement path="grammar" />
499 <pathelement path="." />
501 <include name="**/*.jar" />
502 <include name="**/*.properties"/>
504 <fileset dir="${java.home}/lib" >
505 <include name="*.jar"/>
511 <!-- <java classname="com.interrupt.bookkeeping.http.BookkeepingSystemFacade" fork="true" >
512 <java classname="com.interrupt.bookkeeping.Deleteme" fork="true" >
514 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
515 <sysproperty key="exist.initdb" value="true" />
516 <sysproperty key="exist.home" value="." />
519 <pathelement path="${dir.build}/gen" />
520 <pathelement path="${dir.build}/src" />
521 <pathelement path="${dir.build}/test" />
522 <pathelement path="lib/" />
523 <pathelement path="xml/" />
524 <pathelement path="xml/http/" />
525 <pathelement path="test/bk/" />
526 <pathelement path="test/xml/" />
527 <pathelement path="test/xml/http/" />
528 <pathelement path="." />
530 <include name="**/*.jar" />
531 <include name="**/*.properties"/>
533 <fileset dir="${java.home}/lib" >
534 <include name="**/*.jar"/>
543 <target name="run-docs" depends="compile-gen" >
545 <javadoc destdir="doc/api"
546 windowtitle="Bookkeeping API"
547 sourcepath="src/:gen/"
548 classpathref="bookkeeping.classpath" >
550 <package name="com.interrupt.bookkeeping" />
551 <package name="com.interrupt.bookkeeping.account" />
552 <package name="com.interrupt.bookkeeping.action" />
554 <package name="com.interrupt.bookkeeping.cc" />
555 <package name="com.interrupt.bookkeeping.cc.bkell" />
556 <package name="com.interrupt.bookkeeping.cc.bkell.command" />
557 <package name="com.interrupt.bookkeeping.cc.executor" />
558 <package name="com.interrupt.bookkeeping.cc.analysis" />
559 <package name="com.interrupt.bookkeeping.cc.lexer" />
560 <package name="com.interrupt.bookkeeping.cc.parser" />
561 <package name="com.interrupt.bookkeeping.cc.node" />
563 <!-- DELETE 'node' package
564 <package name="com.interrupt.bookkeeping.cc.node" />
567 <package name="com.interrupt.bookkeeping.exception" />
568 <package name="com.interrupt.bookkeeping.http" />
570 <!-- DELETE 'interpreter' package
571 <package name="com.interrupt.bookkeeping.interpreter" />
574 <package name="com.interrupt.bookkeeping.journal" />
575 <package name="com.interrupt.bookkeeping.system" />
576 <package name="com.interrupt.bookkeeping.users" />
577 <package name="com.interrupt.bookkeeping.util" />
578 <package name="com.interrupt.bookkeeping.workflow" />
579 <package name="com.interrupt.persistence" />
580 <package name="com.interrupt.persistence.or" />
581 <package name="com.interrupt.persistence.xml" />
586 <!-- =============================== -->
587 <!-- DEPLOY targets -->
588 <!-- =============================== -->
590 <target name="release" depends="compile-tests" >
592 <!-- jar main classes. Jar dependencies and properties files should be zipped into a lib directory
594 <jar destfile="${dir.build}/bookkeeping.jar" >
596 <fileset dir="${dir.build}/gen" includes="**/*.class" />
597 <fileset dir="${dir.build}/gen" includes="**/*.dat" />
598 <fileset dir="${dir.build}/src" includes="**/*.class" />
600 <attribute name="Main-Class" value="com.interrupt.bookkeeping.cc.bkell.Bkell" />
601 <attribute name="Class-Path" value="${dir.lib}/Piccolo.jar ${dir.lib}/commons-cli-1.0.jar ${dir.lib}/commons-logging-api.jar ${dir.lib}/javafind.jar ${dir.lib}/commons-logging.jar ${dir.lib}/bob.jar ${dir.lib}/sablecc.jar ${dir.lib}/log4j-1.2.7.jar ${dir.lib}/velocity-1.3.1.jar ${dir.lib}/velocity-dep-1.3.1.jar ${dir.lib}/exist-optional.jar ${dir.lib}/exist-modules.jar ${dir.lib}/exist.jar ${dir.lib}/xmldb.jar ${dir.lib}/xmlrpc-1.2-patched.jar " />
608 <target name="release-war" depends="release" >
610 <echo message="Making webkell.war" />
611 <war destfile="${dir.build}/webkell.war" webxml="lib/web.xml" >
613 <fileset dir="webkell" includes="*.xhtml" />
615 <!-- <fileset dir="lib" includes="exist-data/**" />
617 <zipfileset file="lib/exist-data/**"
618 prefix="WEB-INF/exist-data" />
620 <zipfileset file="xml/*.xml"
621 prefix="WEB-INF/xml" />
623 <!-- <webinf ><includesfile name="lib/exist.conf.xml"/>
626 <zipfileset file="lib/exist-conf.xml"
629 <classes dir="${dir.build}/gen" includes="**/*.class" />
630 <classes dir="${dir.build}/gen" includes="**/*.dat" />
631 <classes dir="${dir.build}/src" includes="**/*.class" />
632 <classes dir="lib" includes="**/*.properties" />
634 <!-- ** TODO Find a better place to put this. an 'xml' directory that can be added to the classpath -->
635 <classes dir="test/xml/http" includes="**/*.xml" />
636 <classes dir="xml" file="xml/bookkeeping.system.xml" />
639 <!-- test classes to include in war -->
640 <classes dir="${dir.build}/test" includes="**/*.class" />
643 <include name="**/*.jar"/>
644 <include name="**/*.properties"/>
645 <exclude name="**/servlet-api-2.5-6.0.0rc0.jar" />
648 <attribute name="Class-Path" value="lib/cactus lib/endorsed lib/htmlunit lib/ xml/" />
653 <target name="deploy-war" depends="release-war" >
655 <echo message="Deploying webkell.war" />
656 <delete dir="${tomcat.home}/webapps/webkell" failonerror="false" />
657 <delete file="${tomcat.home}/webapps/webkell.war" failonerror="false" />
658 <copy file="${dir.build}/webkell.war" todir="${tomcat.home}/webapps" />
662 <target name="release-scratch" depends="init" >
664 <!-- jar main classes. Jar dependencies and properties files should be zipped into a lib directory
666 <jar destfile="${dir.build}/bookkeeping.jar" >
668 <fileset dir="${dir.build}/gen" includes="**/*.class" />
669 <fileset dir="${dir.build}/gen" includes="**/*.dat" />
670 <fileset dir="${dir.build}/src" includes="**/*.class" />
671 <fileset dir="." includes="xml/*.xml" />
673 <attribute name="Main-Class" value="com.interrupt.bookkeeping.cc.bkell.Bkell" />
674 <attribute name="Class-Path" value="${dir.lib}/Piccolo.jar ${dir.lib}/commons-cli-1.0.jar ${dir.lib}/commons-logging-api.jar ${dir.lib}/javafind.jar ${dir.lib}/commons-logging.jar ${dir.lib}/bob.jar ${dir.lib}/sablecc.jar ${dir.lib}/log4j-1.2.7.jar ${dir.lib}/velocity-1.3.1.jar ${dir.lib}/velocity-dep-1.3.1.jar ${dir.lib}/exist-optional.jar ${dir.lib}/exist-modules.jar ${dir.lib}/exist.jar ${dir.lib}/xmldb.jar ${dir.lib}/xmlrpc-1.2-patched.jar xml/ " />