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" >
45 <include name="**/*.jar" />
46 <include name="**/*.properties"/>
52 <echo message="'bookkeeping' build targets..."/>
55 <echo message="init"/>
56 <echo message="clean"/>
57 <echo message="compile-all"/>
58 <echo message="compile-src"/>
59 <echo message="compile-tests"/>
60 <echo message="compile-gen"/>
63 <echo message="run-gen"/>
64 <echo message="run-cc"/>
65 <echo message="run-tests"/>
66 <echo message="run-test"/>
67 <echo message="run-docs"/>
68 <echo message="run-class"/>
69 <echo message="deploy"/>
70 <echo message="deploy-war"/>
72 <echo message="release"/>
73 <echo message="release-war"/>
75 <echo message="cactus-deploy"/>
76 <echo message="cactus-run"/>
79 <echo message="compile-htest"/>
80 <echo message="run-htest"/>
85 <!-- =============================== -->
86 <!-- TASK DEFINITIONS -->
87 <!-- =============================== -->
88 <taskdef name="if" classpathref="bookkeeping.classpath" classname="ise.antelope.tasks.IfTask"/>
89 <taskdef name="sablecc" classpathref="bookkeeping.classpath" classname="org.sablecc.ant.taskdef.Sablecc"/>
90 <taskdef resource="cactus.tasks" >
92 <pathelement location="lib/cactus/cactus.core.framework.uberjar.javaEE.14-1.8.1.jar" />
93 <pathelement location="lib/cactus/cactus.integration.shared.api-1.8.1.jar" />
94 <pathelement location="lib/cactus/cactus.integration.ant-1.8.1.jar" />
95 <pathelement location="lib/cactus/cargo-ant-1.0-beta-2.jar" />
96 <pathelement location="lib/cactus/cargo-core-uberjar-1.0-beta-2.jar" />
97 <pathelement location="lib/cactus/commons-httpclient-3.1.jar" />
98 <pathelement location="lib/cactus/commons-logging-1.1.jar" />
99 <pathelement location="lib/cactus/aspectjrt-1.5.3.jar" />
100 <pathelement location="lib/cactus/jdom.jar" />
101 <pathelement location="lib/cactus/junit-3.8.2.jar" />
102 <pathelement location="lib/htmlunit/jaxen-1.1.1.jar" />
103 <pathelement location="lib/jsch-0.1.8.jar" />
104 <pathelement location="lib/jdepend-2.9.1.jar" />
105 <pathelement location="lib/cactus/commons-discovery-0.4.jar" />
106 <pathelement location="lib/cactus/httpunit-1.6.jar" />
107 <pathelement location="lib/cactus/nekohtml-1.9.6" />
114 <!-- =============================== -->
115 <!-- INITIALIZE THE BUILD PROCESS -->
116 <!-- =============================== -->
117 <target name="init" >
118 <loadproperties srcFile="build.properties" />
122 <!-- =============================== -->
123 <!-- CLEAN OUT THE BUILD FILES -->
124 <!-- =============================== -->
125 <target name="clean" depends="clean-src, clean-gen, clean-cc" >
126 <delete dir="build" failonerror="false" />
128 <target name="clean-src">
129 <delete dir="build/src" failonerror="false" />
131 <target name="clean-gen">
132 <delete dir="gen" failonerror="false" />
133 <delete dir="build/gen" failonerror="false" />
135 <target name="clean-cc">
136 <delete dir="cc/com" failonerror="false" />
140 <!-- =============================== -->
141 <!-- CREATE the generated java files -->
142 <!-- =============================== -->
143 <target name="run-gen" >
145 <available file="gen/" property="genExists" />
146 <if name="genExists">
152 <!-- BOB GENERATION -->
153 <java classname="com.interrupt.bob.Main" classpathref="bookkeeping.classpath" fork="yes" >
155 <!-- <arg line="-gen gen -base . -end .xml -def ${xml.files} -sys ${system.files}" /> -->
156 <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'" />
164 <!-- =============================== -->
165 <!-- COMPILE targets -->
166 <!-- =============================== -->
167 <target name="compile-all" depends="init,run-gen,compile-src,compile-tests"/>
169 <target name="compile-src" depends="init,compile-gen">
171 <echo message="COMPILING JAVA SOURCE"/>
172 <mkdir dir="${dir.build}/src"/>
174 <javac srcdir="${dir.src}" destdir="${dir.build}/src" debug="true" fork="yes" >
178 <compilerarg line="-Xlint" />
179 <arg value="com.interrupt.bookkeeping.AllTests" />
182 <pathelement path="${dir.build}/test" />
183 <pathelement path="${dir.build}/gen" />
184 <pathelement path="${dir.build}/src" />
185 <pathelement path="xml" />
186 <fileset dir="${java.home}/lib" >
187 <include name="**/*.jar"/>
190 <include name="**/*.jar" />
191 <include name="**/*.properties"/>
199 <target name="run-cc" depends="init">
201 <available file="gen/com/interrupt/bookkeeping/cc/analysis" property="ccExists" />
207 <sablecc src="cc" outputdirectory="gen" includes="*.grammar" />
209 <!-- need to hack the lexer code and there's no easy way to sub-type -->
210 <copy todir="gen/com/interrupt/bookkeeping/cc/lexer/" overwrite="true">
211 <fileset file="src/com/Lexer.java" />
220 <target name="compile-htest" depends="init">
222 <echo message="COMPILING htest"/>
223 <javac srcdir="htest" destdir="." fork="yes" deprecation="on" >
226 <fileset dir="${java.home}/lib" >
227 <include name="**/*.jar"/>
230 <include name="**/*.jar" />
236 <target name="run-htest" depends="compile-htest,init">
238 <echo message="RUNNING htest"/>
239 <java classname="Testing" >
242 <pathelement path="." />
243 <fileset dir="${java.home}/lib" >
244 <include name="**/*.jar"/>
247 <include name="**/*.jar" />
254 <target name="compile-tests" depends="init, compile-src">
256 <echo message="COMPILING JAVA TESTS"/>
257 <mkdir dir="${dir.build}/test"/>
258 <javac srcdir="${dir.test.src}" destdir="${dir.build}/test" debug="true" deprecation="on" >
260 <!-- <compilerarg line="-Xlint" />
263 <pathelement path="${dir.build}/gen" />
264 <pathelement path="${dir.build}/src" />
265 <pathelement path="${dir.build}/test" />
266 <pathelement path="xml" />
267 <fileset dir="${java.home}/lib" >
268 <include name="**/*.jar"/>
271 <include name="**/*.jar" />
272 <include name="**/*.properties"/>
279 <target name="compile-gen" depends="init,run-gen,run-cc">
282 <!-- copy over Token with a toString() that doesn't add extra stuff
283 <copy todir="gen/com/interrupt/bookkeeping/cc/node/" overwrite="true">
284 <fileset file="src/com/interrupt/bookkeeping/cc/node/Token.java" />
288 <echo message="COMPILING GEN SOURCE"/>
289 <mkdir dir="${dir.build}/gen"/>
290 <javac srcdir="gen" destdir="${dir.build}/gen" fork="yes" debug="true" deprecation="on" >
293 <pathelement path="${dir.build}/src" />
294 <pathelement path="${dir.build}/test" />
295 <fileset dir="${java.home}/lib" >
296 <include name="**/*.jar"/>
299 <include name="**/*.jar" />
300 <include name="**/*.properties"/>
306 <!-- copy over SableCC dat files -->
307 <copy todir="${dir.build}/gen" >
308 <fileset dir="gen" includes="**/*.dat" />
315 <!-- =============================== -->
317 <!-- =============================== -->
318 <target name="run-tests" depends="compile-tests" >
320 <echo message="RUNNING UNIT TESTS in directory: ${dir.test.src}"/>
321 <!-- <java classname="junit.textui.TestRunner" classpathref="bookkeeping.classpath" fork="yes" > -->
322 <java classname="junit.textui.TestRunner" fork="yes" >
324 <arg value="com.interrupt.bookkeeping.AllTests" />
327 <pathelement path="${dir.build}/gen" />
328 <pathelement path="${dir.build}/src" />
329 <pathelement path="${dir.build}/test" />
330 <pathelement path="lib/" />
331 <pathelement path="xml/" />
332 <pathelement path="xml/http/" />
333 <pathelement path="test/xml/" />
334 <pathelement path="test/xml/http/" />
335 <pathelement path="." />
338 <include name="**/*.jar" />
339 <include name="**/*.properties"/>
341 <fileset dir="${java.home}/lib" >
342 <include name="**/*.jar"/>
350 <target name="run-test" depends="compile-tests" >
352 <echo message="RUNNING a Single UNIT TEST in directory: ${dir.test.src}"/>
353 <!-- <java classname="junit.textui.TestRunner" fork="yes" >
355 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
356 <sysproperty key="exist.initdb" value="true" />
357 <sysproperty key="exist.home" value="." />
358 <arg value="com.interrupt.bookkeeping.cc.kkell.aauth.TestAAuthentication" />
361 <pathelement path="${dir.build}/gen" />
362 <pathelement path="${dir.build}/src" />
363 <pathelement path="${dir.build}/test" />
364 <pathelement path="lib/" />
365 <pathelement path="xml/" />
366 <pathelement path="xml/http/" />
367 <pathelement path="test/xml/http/" />
368 <pathelement path="." />
370 <include name="**/*.jar" />
371 <include name="**/*.properties"/>
373 <fileset dir="${java.home}/lib" >
374 <include name="*.jar"/>
379 <java classname="junit.textui.TestRunner" fork="yes" >
381 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
382 <sysproperty key="exist.initdb" value="true" />
383 <sysproperty key="exist.home" value="." />
384 <arg value="com.interrupt.bookkeeping.TestGeneral" />
386 <pathelement path="${dir.build}/gen" />
387 <pathelement path="${dir.build}/src" />
388 <pathelement path="${dir.build}/test" />
389 <pathelement path="lib/" />
390 <pathelement path="xml/" />
391 <pathelement path="xml/http/" />
392 <pathelement path="test/xml/" />
393 <pathelement path="test/xml/http/" />
394 <pathelement path="." />
396 <include name="**/*.jar" />
397 <include name="**/*.properties"/>
399 <fileset dir="${java.home}/lib" >
400 <include name="*.jar"/>
406 <java classname="junit.textui.TestRunner" fork="yes" >
408 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
409 <sysproperty key="exist.initdb" value="true" />
410 <sysproperty key="exist.home" value="." />
412 <sysproperty key="org.xml.sax.features.validation" value="false" />
413 <sysproperty key="java.endorsed.dirs" value="lib/endorsed" />
415 <arg value="com.interrupt.bookkeeping.cc.kkell.TestBKellFunctional" />
417 <pathelement path="${dir.build}/gen" />
418 <pathelement path="${dir.build}/src" />
419 <pathelement path="${dir.build}/test" />
420 <pathelement path="lib/" />
421 <pathelement path="xml/" />
422 <pathelement path="xml/http/" />
423 <pathelement path="test/bk/" />
424 <pathelement path="test/xml/" />
425 <pathelement path="test/xml/http/" />
426 <pathelement path="." />
428 <include name="**/*.jar" />
429 <include name="**/*.properties"/>
431 <fileset dir="${java.home}/lib" >
432 <include name="**/*.jar"/>
440 <target name='cactus-deploy' depends='release-war' >
442 <echo message="DEPLOYING 'bookkeeping-cactus.war' to ${tomcat.home}/webapps " />
443 <available file="build/bookkeeping-cactus.war" property="cactusExists" />
444 <if name="cactusExists">
446 <cactifywar destfile="build/bookkeeping-cactus.war" srcfile="build/webkell.war" mergewebxml="webmerge.xml" />
449 <!-- <copy todir="${tomcat.home}/webapps/"
450 file="build/bookkeeping-cactus.war" />
456 <target name='cactus-run' depends='cactus-deploy' >
458 <property name="CATALINA_HOME" value="${tomcat.home}" />
459 <property name="CATALINA_BASE" value="${tomcat.home}" />
460 <property name="CATALINA_TMPDIR" value="${tomcat.home}/temp" />
461 <exec executable="${tomcat.home}/bin/setclasspath.sh">
464 <cactus warfile="/Users/timothyw/Projects/Bookkeeping/build/bookkeeping-cactus.war"
465 printsummary="yes" failureproperty="tests.failed">
467 <cactusproperty server="false" propertiesFile="build.properties"/>
469 <path refid="bookkeeping.classpath"/>
473 <cargo containerId="tomcat5x" output="${logs.dir}/output.log" log="${logs.dir}/cargo.log" home="${tomcat.home}">
475 <property name="cargo.servlet.port" value="${cargo.servlet.port}"/>
476 <property name="cargo.logging" value="${cargo.logging}"/>
477 <deployable type="${cactus.sample.archive.type}" file="${cactified.servlet.archive.name}"/>
480 <!-- <tomcat5x dir="${tomcat.home}" port="8070" /> -->
483 <formatter type="xml"/>
485 <fileset dir="${dir.test.src}">
486 <!-- <include name="**/CactusTests.java"/> -->
487 <exclude name="**/TestAll.java"/>
494 <target name='run-class' depends='compile-src' >
497 <java classname="com.interrupt.bookkeeping.cc.bkell.Bkell" classpathref="bookkeeping.classpath" fork='true' >
500 <pathelement path="${dir.build}/test" />
501 <pathelement path="${dir.build}/gen" />
502 <pathelement path="${dir.build}/src" />
503 <pathelement path="xml" />
504 <fileset dir="${java.home}/lib" >
505 <include name="**/*.jar"/>
508 <include name="**/*.jar" />
509 <include name="**/*.properties"/>
515 <!-- <java classname="com.interrupt.persistence.xml.Spittoon" fork="true" >
517 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
518 <sysproperty key="exist.initdb" value="true" />
519 <sysproperty key="exist.home" value="." />
522 <pathelement path="${dir.build}/gen" />
523 <pathelement path="${dir.build}/src" />
524 <pathelement path="${dir.build}/test" />
525 <pathelement path="lib/" />
526 <pathelement path="xml/" />
527 <pathelement path="xml/http/" />
528 <pathelement path="grammar" />
529 <pathelement path="." />
531 <include name="**/*.jar" />
532 <include name="**/*.properties"/>
534 <fileset dir="${java.home}/lib" >
535 <include name="*.jar"/>
541 <!-- <java classname="com.interrupt.bookkeeping.http.BookkeepingSystemFacade" fork="true" >
542 <java classname="com.interrupt.bookkeeping.Deleteme" fork="true" >
544 <sysproperty key="db.url" value="xmldb:exist:///db/bookkeeping/" />
545 <sysproperty key="exist.initdb" value="true" />
546 <sysproperty key="exist.home" value="." />
549 <pathelement path="${dir.build}/gen" />
550 <pathelement path="${dir.build}/src" />
551 <pathelement path="${dir.build}/test" />
552 <pathelement path="lib/" />
553 <pathelement path="xml/" />
554 <pathelement path="xml/http/" />
555 <pathelement path="test/bk/" />
556 <pathelement path="test/xml/" />
557 <pathelement path="test/xml/http/" />
558 <pathelement path="." />
560 <include name="**/*.jar" />
561 <include name="**/*.properties"/>
563 <fileset dir="${java.home}/lib" >
564 <include name="**/*.jar"/>
573 <target name="run-docs" depends="compile-gen" >
575 <javadoc destdir="doc/api"
576 windowtitle="Bookkeeping API"
577 sourcepath="src/:gen/"
578 classpathref="bookkeeping.classpath" >
580 <package name="com.interrupt.bookkeeping" />
581 <package name="com.interrupt.bookkeeping.account" />
582 <package name="com.interrupt.bookkeeping.action" />
584 <package name="com.interrupt.bookkeeping.cc" />
585 <package name="com.interrupt.bookkeeping.cc.bkell" />
586 <package name="com.interrupt.bookkeeping.cc.bkell.command" />
587 <package name="com.interrupt.bookkeeping.cc.executor" />
588 <package name="com.interrupt.bookkeeping.cc.analysis" />
589 <package name="com.interrupt.bookkeeping.cc.lexer" />
590 <package name="com.interrupt.bookkeeping.cc.parser" />
591 <package name="com.interrupt.bookkeeping.cc.node" />
593 <!-- DELETE 'node' package
594 <package name="com.interrupt.bookkeeping.cc.node" />
597 <package name="com.interrupt.bookkeeping.exception" />
598 <package name="com.interrupt.bookkeeping.http" />
600 <!-- DELETE 'interpreter' package
601 <package name="com.interrupt.bookkeeping.interpreter" />
604 <package name="com.interrupt.bookkeeping.journal" />
605 <package name="com.interrupt.bookkeeping.system" />
606 <package name="com.interrupt.bookkeeping.users" />
607 <package name="com.interrupt.bookkeeping.util" />
608 <package name="com.interrupt.bookkeeping.workflow" />
609 <package name="com.interrupt.persistence" />
610 <package name="com.interrupt.persistence.or" />
611 <package name="com.interrupt.persistence.xml" />
616 <!-- =============================== -->
617 <!-- DEPLOY targets -->
618 <!-- =============================== -->
620 <target name="release" depends="compile-src" >
622 <!-- jar main classes. Jar dependencies and properties files should be zipped into a lib directory
624 <jar destfile="${dir.build}/bookkeeping.jar" >
626 <fileset dir="${dir.build}/gen" includes="**/*.class" />
627 <fileset dir="${dir.build}/gen" includes="**/*.dat" />
628 <fileset dir="${dir.build}/src" includes="**/*.class" />
630 <attribute name="Main-Class" value="com.interrupt.bookkeeping.cc.bkell.Bkell" />
631 <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 " />
638 <target name="release-war" depends="init, release" >
640 <echo message="Making webkell.war" />
642 <!-- copy libs to a tempporary flattened directory -->
644 <copy todir="temp" flatten="true" >
646 <include name="confAauth.xml"/>
647 <include name="confGroups.xml"/>
648 <include name="xml/bookkeeping.system.xml"/>
650 <fileset dir="${dir.lib}" >
651 <include name="**/*.jar"/>
652 <include name="**/*.properties"/>
653 <exclude name="**/spittoon.properties" />
654 <exclude name="**/servlet-api-2.5-6.0.0rc0.jar" />
657 <move file="temp/spittoon.web.properties" tofile="temp/spittoon.properties"/>
659 <war destfile="${dir.build}/webkell.war" webxml="${dir.lib}/web.xml" >
661 <fileset dir="webkell" includes="*.xhtml" />
663 <!-- <fileset dir="lib" includes="exist-data/**" /> -->
664 <zipfileset file="dataGroups/**"
665 prefix="WEB-INF/lib/dataGroups" />
666 <zipfileset file="dataAauth/**"
667 prefix="WEB-INF/lib/dataAauth" />
669 <zipfileset file="xml/*.xml"
670 prefix="WEB-INF/xml" />
672 <!-- <webinf ><includesfile name="lib/exist.conf.xml"/></webinf>
673 <zipfileset file="lib/exist-conf.xml"
676 <classes dir="${dir.build}/gen" includes="**/*.class" />
677 <classes dir="${dir.build}/gen" includes="**/*.dat" />
678 <classes dir="${dir.build}/src" includes="**/*.class" />
679 <classes dir="temp" includes="*.properties" />
681 <!-- ** TODO Find a better place to put this. an 'xml' directory that can be added to the classpath -->
682 <classes dir="test/xml/http" includes="**/*.xml" />
683 <classes dir="xml" file="xml/bookkeeping.system.xml" />
686 <!-- test classes to include in war
687 <classes dir="${dir.build}/test" includes="**/*.class" />
690 <!-- <lib dir="lib" fullpath="WEB-INF/lib" > -->
692 <include name="**/*.jar"/>
693 <include name="**/*.properties"/>
694 <include name="confAauth.xml" />
695 <include name="confGroups.xml" />
696 <include name="bookkeeping.system.xml"/>
697 <exclude name="**/servlet-api-2.5-6.0.0rc0.jar" />
700 <attribute name="Class-Path" value="lib/cactus lib/endorsed lib/htmlunit lib/ xml/" />
704 <!-- delete temporary directory after war creation
705 <delete dir="temp" />
710 <target name="deploy-war" depends="release-war" >
712 <echo message="Deploying webkell.war" />
713 <delete dir="${tomcat.home}/webapps/webkell" failonerror="false" />
714 <delete file="${tomcat.home}/webapps/webkell.war" failonerror="false" />
715 <copy file="${dir.build}/webkell.war" todir="${tomcat.home}/webapps" />
719 <target name="release-scratch" depends="init" >
721 <!-- jar main classes. Jar dependencies and properties files should be zipped into a lib directory
723 <jar destfile="${dir.build}/bookkeeping.jar" >
725 <fileset dir="${dir.build}/gen" includes="**/*.class" />
726 <fileset dir="${dir.build}/gen" includes="**/*.dat" />
727 <fileset dir="${dir.build}/src" includes="**/*.class" />
728 <fileset dir="." includes="xml/*.xml" />
730 <attribute name="Main-Class" value="com.interrupt.bookkeeping.cc.bkell.Bkell" />
731 <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/ " />