Initial commit
[Spittoon.git] / build.xml
blobcdb74f1b5d0596e6f2965053486f0ac395dd7e5a
2 <project name="Spittoon" default="" basedir="." > 
3         
4         
5         <property name="ant.build.javac.target" value="1.5" /> 
6         
7         <path id="spittoon.classpath" >
8                 
9                 <fileset dir="${java.home}/lib" >
10                         <include name="*.jar"/>
11                 </fileset>
12                 <pathelement path="build/" />
13                 <pathelement path="build/src" />
14                 <pathelement path="build/gen" />
15                 <pathelement path="build/test" />
16                 <pathelement path="xml/" />
17                 <pathelement path="lib/" />
18                 <pathelement path="." />
19                 <fileset dir="lib/">
20                         <include name="**/*.jar" />
21                         <include name="**/*.properties" />
22                 </fileset>
23         </path>
24         
25         
26         
27     <!-- =============================== -->
28     <!-- TASK DEFINITIONS               -->
29     <!-- =============================== -->
30     <taskdef name="if" classpathref="spittoon.classpath" classname="ise.antelope.tasks.IfTask"/>
31         
32         
33     <!-- =============================== -->
34     <!-- INITIALIZE the build process    -->
35     <!-- =============================== -->
36     <target name="init" >
37                 
38                 <loadproperties srcFile="build.properties" />
39         <mkdir dir="gen"/>
40     </target>
41         
42         
43     <!-- ===============================        -->
44     <!-- CLEAN build files                                      -->
45     <!-- ===============================        -->
46     <target name="clean">
48                 <delete dir="build" />
49                 <delete dir="gen" />
50                 <delete dir="bootstrap" />
51     </target>
52         
53         
54         <!-- =================================  -->
55         <!-- GENERATE source from xml                   --> 
56         <!-- =================================  -->
57         <target name="run-gen" depends="init" >
58                 
59                 <available file="gen/com/interrupt" property="genExists" />
60                 <if name="genExists">
61                         <else>
62                                 <java classname="com.interrupt.bob.Main" classpathref="spittoon.classpath" fork="yes" >
63                                         <arg line="-gen ${gen.dir} -base . -end .xml -def ${all.files} -sys ${all.files}" />
64                                 </java>
65                 </else>
66                 </if>
67     </target>
68         
69         
70         <!-- =================================  -->
71         <!-- COMPILE code                                               --> 
72         <!-- =================================  -->
73     <target name="compile-gen" depends="init, run-gen">
74                 
75                 <echo message="COMPILING GEN SOURCE"/>
76                 <mkdir dir="${dir.build}/gen"/>
77                 <javac srcdir="gen" destdir="${dir.build}/gen" 
78                     classpathref="spittoon.classpath" fork="yes" deprecation="on" nowarn="on" />
79         <copy todir="${dir.build}/gen">
80             <fileset dir="gen" includes="**/*.dat"/>
81         </copy>
82     </target>
83         
84         <target name="compile-src" depends="init, compile-gen">
85                 
86                 <echo message="COMPILING JAVA SOURCE"/>
87                 <mkdir dir="${dir.build}/src"/>
88                 <javac srcdir="${dir.src}/" destdir="${dir.build}/src" debug="true" 
89                     classpathref="spittoon.classpath" fork="yes" deprecation="on" nowarn="on" />
90     </target>
91         
92     <target name="compile-tests" depends="init,compile-src">
93                 
94                 <echo message="COMPILING JAVA TESTS"/>
95                 <mkdir dir="${dir.build}/test"/>
96                 <javac srcdir="${dir.test.src}" destdir="${dir.build}/test" 
97                     classpathref="spittoon.classpath" fork="yes" deprecation="on" nowarn="on" />
98     </target>
99         
101         <!-- =================================  -->
102         <!-- RELEASE a jar file                                 --> 
103         <!-- =================================  -->
104     <target name="release" depends="compile-gen, compile-src" >
105                 
106                 <jar destfile="${dir.build}/spittoon.jar" >
107                         
108                         <fileset dir="${dir.build}/gen">
109                                 <include name="**/*.class"/>
110                         </fileset>
111                     <fileset dir="${dir.build}/src">
112                                 <include name="**/*.class"/>
113                     </fileset>
114                 </jar>
115     </target>
116         
117         
118         <!-- =================================  -->
119         <!-- PACKAGE a zip file                                 --> 
120         <!-- =================================  -->
121         
122         
124         
125         <!-- =================================  -->
126         <!-- PACKAGE a zip file                                 --> 
127         <!-- =================================  -->
128         <target name="run-tests" depends="compile-tests" >
129                 
130                 <echo message="RUNNING UNIT TESTS in directory:  ${dir.test.src}"/>
131                 <java classname="junit.textui.TestRunner" classpathref="spittoon.classpath" fork="yes" >
132                         <arg line="-Dbob.base=. -Dbob.end=.xml -Dbob.def=${all.files}" />
133                     <arg value="com.interrupt.spittoon.AllTests" />
134                 </java>
135     </target>
136         
137     <target name="run-test" depends="compile-tests" >
138                 
139                 <echo message="RUNNING a single UNIT TEST in directory:  ${dir.test.src}"/>
140                 <java classname="junit.textui.TestRunner" classpathref="spittoon.classpath" fork="yes" >
141                         <arg line="-Dbob.base=. -Dbob.end=.xml -Dbob.def=${all.files} -Ddb.url=xmldb:exist:///db/bookkeeping/ -Dexist.initdb=true -Dexist.home=. -Dorg.xml.sax.features.validation=false -Djava.endorsed.dirs=lib/endorsed " />
142                     <arg value="com.interrupt.spittoon.TestSpittoon" />
143                 </java>
144     </target>
145         
146         
147 </project>