working on public sxkeeper
[opensuse:sxkeeper.git] / build.xml
1 <!-- 
2     Ant build file for sxkeeper. Call
3     $ ant -p to see a list of available targets.
4     Klaas Freitag <freitag@suse.de>
5     Thomas Schmidt <tschmidt@suse.de>
6 -->
7
8 <project name="SX Keeper" default="compile" basedir=".">
9
10         <exec outputproperty="hostname" executable="hostname" />
11         
12         <property file="conf/sx.conf" />
13         <property file="build.properties.local" />
14         <property file="build.properties" />
15         <property name="install.tomcatdir" value="${catalina.base}/webapps" />
16
17         <tstamp>
18             <format property="buildtime" pattern="dd.MM.yyyy H:mm:ss" />
19         </tstamp>
20
21         <path id="classpath">
22                 <fileset dir="lib">
23                         <include name="*.jar"/>
24                 </fileset>
25                 <fileset dir="${dbxml_path}/lib">
26                         <include name="*.jar"/>
27                 </fileset>
28         </path>
29
30
31
32   <target name="init">
33   </target>
34
35
36         
37   <target name="compile" depends="" description="--> Compile sxkeeper">
38         <echo message="Compiling sxkeeper classes on ${hostname}" />
39     <mkdir dir="${build.home}" />
40     <javac debug="${compile.debug}" 
41            optimize="${compile.optimize}" 
42            deprecation="${compile.deprecation}" 
43            verbose="${compile.verbose}" 
44            destdir="${build.home}"
45            srcdir="${sxkeeper.src}"
46            source="${javac.version}">
47            <classpath refid="classpath"/>
48      </javac>
49   </target>
50
51         
52   <target name="install" depends="compile"
53               description="--> install to ${install.tomcatdir}" >
54             <echo message="installing to ${install.tomcatdir}" />
55
56             <!-- delete old contents -->
57             <delete includeemptydirs="true" quiet="true">
58               <fileset dir="${install.tomcatdir}/${webapp}" includes="**/*"/>
59             </delete>
60         
61                 <mkdir dir="${install.tomcatdir}/${webapp}/WEB-INF" />
62                 <mkdir dir="${install.tomcatdir}/${webapp}/WEB-INF/classes" />
63         <mkdir dir="${install.tomcatdir}/${webapp}/WEB-INF/lib" />
64         
65             <copy todir="${install.tomcatdir}/${webapp}/WEB-INF/classes" >
66             <fileset dir="${build.home}" />
67             </copy>
68         
69                 <copy todir="${install.tomcatdir}/${webapp}/WEB-INF/lib" >
70                         <fileset dir="lib" includes="*.jar" >
71                                 <exclude name="catalina-tomcat*"/>
72                                 <exclude name="jmx-tomcat*"/>
73                                 <exclude name="servlet-api*"/>
74                         </fileset>
75                         <fileset dir="${dbxml_path}/lib" >
76                                 <include name="db.jar"/>
77                                 <include name="dbxml.jar"/>
78                         </fileset>
79                 </copy>
80             
81            <!-- copy files to tomcat needed for authentication -->
82            <copy file="sxkeeper.xml" todir="${install.tomcatdir}/../conf/Catalina/localhost" />    
83
84            <!-- Make sure that ./server is recognized by tomcat, may be at /usr/share/tomcat... -->
85            <copy file="./build/de/suse/sx/auth/KeeperRealm.class" 
86                    todir="${install.tomcatdir}/../server/classes/de/suse/sx/auth" />
87            <copy file="./build/de/suse/sx/lifecycle/KeeperLifecycle.class" 
88                    todir="${install.tomcatdir}/../server/classes/de/suse/sx/lifecycle" />
89                 
90             <copy file="web.xml" todir="${install.tomcatdir}/${webapp}/WEB-INF" />
91             <copy file="conf/sx.conf" todir="${install.tomcatdir}/${webapp}/WEB-INF/classes" />
92         <copy file="conf/Log4j.properties" 
93                 todir="${install.tomcatdir}/${webapp}/WEB-INF/classes"/>
94         
95                 <!-- install static keeperinfo -->
96                 <mkdir dir="${install.tomcatdir}/${webapp}/static"/>
97             <copy todir="${install.tomcatdir}/${webapp}/static" >
98                         <fileset dir="./static"/>
99                 </copy>
100                 
101                 <copy todir="${install.tomcatdir}/${webapp}" file="./index.jsp"/>
102
103   </target>
104
105         
106
107   <target name="clean" description="--> Clean up object files">
108     <delete dir="${build.home}"/>
109   </target>
110         
111         
112
113   <taskdef name="findbugs" classpath="./testsuite/lib/findbugs-ant.jar" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
114         
115         
116   <!-- ==================== Code tests ================================== -->
117   <target name="tests" depends="compile" description="--> Drive code test">
118     
119         <echo message="Running JLint on code..." />
120         <chmod file="./testsuite/lib/jlint" perm="755" />
121         <exec failonerror="true"
122           failifexecutionfails="false"
123           executable="./testsuite/lib/jlint"
124           dir="./">
125           <arg line="build"/>
126     </exec>
127     
128         <echo message="Running Findbugs on code..." />
129     <findbugs home="./testsuite" output="text" debug="false" 
130         effort="default" jvmArgs="-Xmx256m">
131       <auxClasspath refid="classpath" />
132       <sourcePath path="./src" />
133       <class location="./build"/>
134     </findbugs>
135     
136     
137     <echo message="Running JUnit..." />
138         <path id="test-classpath">
139         <fileset dir="./testsuite/lib">
140           <include name="**/*.jar"/>
141         </fileset>
142     </path>
143         
144         <echo message="Compiling testcase sources" />
145         <javac debug="true" destdir="./build">
146                 <src path="./testsuite/junit" />
147                 <classpath refid="test-classpath" />
148         </javac>
149         
150         <echo message="starting test..." />
151     <java fork="yes" classname="junit.textui.TestRunner" 
152         taskname="junit" failonerror="true">
153         <arg value="de.suse.sx.test.MyTestSuite"/>
154         <classpath refid="test-classpath" />
155         <classpath>
156                 <pathelement location="./build"/>
157         </classpath>
158     </java>
159   </target> 
160         
161         
162         
163         
164
165 </project>