adding all of botlist, initial add
[botlist.git] / openbotlist / build.xml
bloba5a092fa332d819214ea1da494c6a7faedb0102d
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- ****************************************************** -->
3 <!-- Copyright (c) 2006 - Berlin Brown -->
4 <!-- Ant script that is located in the Tomcat webapp directory and -->
5 <!-- writes classes to this particular directory -->
6 <!-- Description: Testing ruby with with spring web application -->
7 <!-- Date: 11/1/2006 -->
8 <!-- Updates: -->
9 <!-- + 3/10/2008 - updated core libraries to most recent versions, spring, etc --> 
10 <!-- + 3/14/2008 - Moved classpath to property file -->
11 <!-- ****************************************************** -->
12 <project name="OpenBotlist Main Build File" default="package" basedir=".">
14         <property file="build.properties" />        
15     <property name="build.dir"            value="${basedir}/build"/>
16     <property name="build.classes.dir"    value="${basedir}/build/classes"/>
17     <property name="src.dir"              value="${basedir}/src"/>
18         <property name="scala.src.dir"        value="${basedir}/apps_src/scala"/>       
19     <property name="lib.dir"              value="${basedir}/WEB-INF/lib"/>
20         <property name="lib.runtime.dir"      value="${basedir}/runtime-lib"/>
21         <property name="lib.servlet.dir"      value="${basedir}/servlet-lib"/>  
22         <property file="${basedir}/build_classpath.properties" />       
23         
24     <!-- Web Apps Directory -->
25     <property name="default.tomcat.webapps" value="${tomcat.home}/webapps" />
26             
27         <!-- Import the classpath usage and variable names -->
28         <import file="${basedir}/build_classpath_paths.xml" />
29         
30         <target name="help" description="Initialization">
31                 <tstamp/>
32                 <echo message="Running with Tomcat Home=${tomcat.home}" />      
33                         <echo message="Classpth properties, lib.dir=${classpath.lib.dir}" />
34                         <echo>
35  Additional Targets and Usage:
36  -----------------
37  scala.compile - to compile the scala source, use this target.  
38                  To build the  complete release package, 
39                  you must compile this manually.
40  full.deploy -   Compile the source, including scala source.
41                  Deploy to the application server.
43 </echo>
44                 <fail unless="classpath.include">Error loading build_classpath.property file.  Make sure it exists.</fail>
45         </target>       
46         
47     <!-- Target: Prepare -->
48     <target name="prepare" depends="help">
49         <mkdir dir="${build.dir}"/>
50         <mkdir dir="${build.classes.dir}"/>
51     </target>
53     <!-- Target: Compile -->
54     <target name="compile" depends="prepare">
55         <javac deprecation="true"
56                 target="1.5"
57                 srcdir="${src.dir}"
58                 destdir="${build.classes.dir}"
59                 includes="**/*.java">
60             <classpath refid="classpath"/>
61             <compilerarg value="-Xlint" />
62         </javac>
63     </target>
65         
66     <!-- **************************************** -->
67     <!-- Add support for scala compiles, used with liftweb apps -->
68     <!-- Date Created: 12/29/2007 -->
69     <!-- **************************************** -->
70     <taskdef resource="scala/tools/ant/antlib.xml">
71       <classpath refid="classpath.scala" />
72     </taskdef>
73         
74         <!-- Target: Compile Scala Source -->
75         <target name="scala.compile" depends="compile">
76                 <scalac srcdir="${scala.src.dir}" 
77                                 destdir="${build.classes.dir}" 
78                                 classpathref="classpath.scala" force="never">
79                     <include name="**/*.scala"/>
80                 </scalac>
81         </target>
82         
83     <!-- Target: Build -->
84     <target name="package" depends="prepare">
85     </target>
86       
87     <!-- Target: Tomcat.deploy -->
88     <target name="tomcat.deploy" depends="package">
89         <!-- Copy WEB-INF Classes Directory -->
90         <!-- With this build configuration, this assumes that the build script
91                     is located with the webapp directory -->
92         <copy todir="${basedir}/WEB-INF/classes">
93             <fileset dir="${basedir}/build/classes">
94                 <include name="**"/>
95             </fileset>
96         </copy>
97         <!-- End of Target Tomcat Deploy -->
98     </target>
99         
100         <target name="full.deploy" depends="package, compile, scala.compile, tomcat.deploy">
101         </target>
103     <!-- Jar/War the Web Archive File -->
104     <!-- Note: using jar task because we are working out of a web-application -->
105     <!-- directory. -->
106     <target name="jar.webapp" depends="package">
107         <fail unless="appname.war">APPNAME.WAR must be set, see the build.properties file</fail>
108         <delete>        
109             <fileset dir="${build.dir}">
110                 <include name="**/*.zip"/>
111                 <include name="**/*.jar"/>
112                 <include name="**/*.war"/>
113             </fileset>
114         </delete>
115         <jar destfile="${basedir}/build/${appname.war}.war" basedir="${basedir}" />
116     </target>
117     
118     <!-- Build beans jar -->
119     <target name="jar.botlist.beans" depends="compile">
120         <jar jarfile="${build.dir}/botlistbeans.jar">
121             <fileset dir="${basedir}/WEB-INF/classes" >
122                 <include name="org/spirit/bean/impl/**/*.class"/>
123             </fileset>
124         </jar>
125     </target>
126     
127     <!-- Zip the development code base -->
128     <target name="zip.codebase" depends="clean,prepare">
129         <fail unless="appname.war">APPNAME.WAR must be set, see the build.properties file</fail>
130         <zip destfile="${basedir}/build/${appname.war}_src.zip" basedir="${basedir}" />
131     </target>
132     
133     <!-- Generate Version -->
134     <target name="generate.vers" depends="package">
135         <exec executable="${basedir}/getsvnversion.sh" spawn="false" failonerror="false"></exec>
136         <java classname="org.spirit.util.version.BotListVersionReader">
137             <classpath refid="classpath" />
138             <classpath>
139                 <pathelement location="${basedir}" />
140             </classpath>
141             <arg value="-f" />
142             <arg value="${basedir}/WEB-INF/classes/version.properties"/>            
143         </java>
144     </target>
146     <!-- Main Clean -->
147     <target name="clean">
148         <delete dir="${build.dir}" />
149         <delete>
150                 <fileset dir="${basedir}/WEB-INF/tools">
151                         <!-- Delete compiled python files, make sure not to remove your *.py files -->
152                         <include name="**/*.pyc" />
153                 </fileset>
154             <fileset dir="${basedir}/WEB-INF/classes">
155                 <include name="**/*.class" />
156                                 <include name="**/*.log" />
157                 <exclude name="**/*.properties" />
158                 <exclude name="**/*.xml" />
159             </fileset>
160                         <!-- Clean files against entire project.  NOTE: this can be a dangerous task -->
161                         <fileset dir="${basedir}">
162                                 <include name="**/*.log" />
163                 <include name="**/Thumbs.db" />
164             </fileset>
165         </delete>
166     </target>
167     <!-- End of Main Clean -->
169     <!-- Clean the logs -->
170     <target name="clean.logs">
171         <!-- Check if the ant property setting has been set -->
172         <fail unless="tomcat.home">TOMCAT_HOME must be set, see the build.properties file</fail>
173         <delete>
174             <!-- Remove all the log files including those without log extension -->
175             <fileset dir="${tomcat.home}/logs">
176                 <include name="**"/>
177             </fileset>
178         </delete>
179     </target>
181 </project>
182 <!-- End of the File -->