source: other-projects/trunk/gs3-webservices-democlient/build.xml@ 15236

Last change on this file since 15236 was 15236, checked in by ak19, 15 years ago

Updated to handle log4j properties file

File size: 10.4 KB
1<?xml version="1.0"?>
2<!-- ======================================================================
3 April 2008 - GS3 web services democlient compile script
4 With lots of help from kjdon's Greenstone3 build and install script
5 See
7 for info on build.xml ant files,
8 and
10====================================================================== -->
11<project name="gs3democlient" default="usage" basedir=".">
12<description>This buildfile is used to build the demo-client for Greenstone3's web services.</description>
14 <!-- ============ predefining properties for reuse =================== -->
15 <property name="src.dir" value="${basedir}/src" />
16 <property name="democlient.rootdir" value="${src.dir}/GS3DemoClient" />
17 <property name="fedorags3.rootdir" value="${src.dir}/GS3Fedora" />
18 <property name="democlient.src" value="${democlient.rootdir}/org" />
19 <property name="fedorags3.src" value="${fedorags3.rootdir}/org" />
20 <property name="build" value="${basedir}/build" />
21 <property name="bin" value="${basedir}/bin" />
22 <property name="QBRdata.rel.path" value="org/greenstone/gs3client/data" />
23 <property name="dlservices.rel.path" value="org/greenstone/gs3client/dlservices" />
24 <property name="gui.rel.path" value="org/greenstone/gs3client" />
25 <property name="gs3services.rel.path" value="org/greenstone/gs3services" />
26 <property name="" value="GS3democlient.jar" /> <!-- name of the executable-->
27 <property name="" value="gs3_webservices_democlient" />
28 <property name="zip.excludes" value="bin/**," />
29 <property name="log4j.propFile" value="" />
31 <!-- ============ project classpath: everything in the lib folder =================== -->
32 <path id="project.classpath">
33 <fileset dir="lib">
34 <include name="**/*.jar"/>
35 </fileset>
36 </path>
38<target name="usage" description="Prints out ant commands for the GS3 demo-client">
39 <echo>Type:</echo>
40 <echo>- ant build-demo-client</echo>
41 <echo> for (compiling) and creating the demo-client executable</echo>
42 <echo>- ant compile-demo-client</echo>
43 <echo> for compiling the democlient</echo>
44 <echo>- fedoraGS3jar</echo>
45 <echo> for generating the fedoraGS3.jar dependency file</echo>
46 <echo>- QBRdatajar</echo>
47 <echo> for generating the QBRdata.jar dependency file</echo>
48 <echo>- generate-download</echo>
49 <echo> for generating the zip/gzip/bzip file of the project</echo>
50 <echo>- ant clean-democlient</echo>
51 <echo> for deleting the *.class files from the GS3democlient's source</echo>
52 <echo>- ant clean</echo>
53 <echo> for deleting the *.class files from the GS3democlient and GS3Fedora sources</echo>
54 <echo>- ant dist-clean</echo>
55 <echo> for deleting the *.class files from the sources, the QBRdata.jar, fedoraGS3.jar, executable jar file, and any zips of the project folder</echo>
59<!-- Main targets: to build the GS3 web services demo-client and to create the tar.gz file for downloading -->
60<target name="build-demo-client" description="Creates the jar distribution file" depends="compile-demo-client">
61 <mkdir dir="${basedir}/logs" /> <!-- Need a logs dir for outputting log4j stuff-->
62 <delete file="${}" /> <!--For now: Let's delete it first and do a fresh rebuild-->
63 <jar destfile="${}"
64 basedir="${democlient.rootdir}/"
65 manifest="Manifest.MF"
66 excludes="${QBRdata.rel.path}/*.class"
67 />
68 <copy file="${src.dir}/${log4j.propFile}" tofile="${basedir}/${log4j.propFile}"/>
69<!-- LATER: only for tarring include source files, so that we can exclude the java files in this build?-->
72<target name="generate-download" description="Generates the zip file of the lib and src folders and the executable ${} file" depends="get-ziptype,ensure-exec-jar" if="zip.type">
73 <mkdir dir="${bin}" />
74 <antcall target="create-${zip.type}"/>
77<!-- Compilation first ensures the existence of QBRdata.jar AND fedoraGS3.jar by checking whether these jars exist and if not, generating them. Then actual compilation of the GS3democlient starts. By now the QBRdata classes of the GS3democlient src folder would have been compiled, but that does not matter as javac only compiles when class files that are outdated or when they have not been generated yet.-->
78<target name="compile-demo-client" description="Compiles the GS3 demo-client" depends="ensure-QBRdata-jar,ensure-fedoraGS3-jar">
79 <javac srcdir="${democlient.rootdir}">
80 <classpath refid="project.classpath"/>
81 <exclude name="${gs3services.rel.path}/**" /> <!--gs3services package needs official gsdl.jar to compile, so we skip it as it is not part of the client anyway-->
82 </javac>
85<!-- Cleaning targets -->
86<target name="clean-democlient" description="Removes all class files from the GS3demo-client">
87 <delete>
88 <fileset dir="${democlient.src}" includes="**/*.class"/>
89 </delete>
92<target name="clean" description="Removes all class files from the GS3DemoClient and GS3Fedora source folders" depends="clean-democlient">
93 <delete>
94 <fileset dir="${fedorags3.src}" includes="**/*.class"/>
95 </delete>
98<target name="dist-clean" description="Removes the project-specific jars fedoraGS3.jar, QBRdata.jar, ${} files AND all class files from the GS3DemoClient and GS3Fedora source folders" depends="clean">
99 <delete includeEmptyDirs="true" failonerror="false">
100 <fileset file="${basedir}/lib/fedoraGS3.jar"/>
101 <fileset file="${basedir}/lib/QBRdata.jar"/>
102 <fileset file="${basedir}/${}"/>
103 <fileset file="${basedir}/"/>
104 <fileset dir="logs"/>
105 <fileset file="${log4j.propFile}"/>
106 <fileset file="${bin}/${}.tar"/>
107 <fileset file="${bin}/${}.tar.gz"/>
108 <fileset file="${bin}/${}.zip"/>
109 <fileset file="${bin}/${}.tar.bz2"/>
110 </delete>
113<!-- Targets to generate the project-specific jar files QBRdata.jar and fedoraGS3.jar -->
114<target name="QBRdatajar" description="Compiles and creates the QBRdata.jar file needed by GS3demo-client">
115 <javac srcdir="${democlient.rootdir}/${QBRdata.rel.path}">
116 <classpath refid="project.classpath"/>
117 </javac>
118 <delete file="lib/QBRdata.jar" /> <!--For now: Let's delete it first and do a fresh rebuild-->
119 <jar destfile="lib/QBRdata.jar"
120 basedir="${democlient.rootdir}/"
121 excludes="${gui.rel.path}/*.*,${dlservices.rel.path}/**,${gs3services.rel.path}/**">
122 </jar>
125<target name="fedoraGS3jar" description="Compiles and creates the fedoraGS3.jar file needed by GS3demo-client">
126 <javac srcdir="${fedorags3.rootdir}">
127 <classpath refid="project.classpath"/>
128 </javac>
129 <delete file="lib/fedoraGS3.jar" /> <!--For now: Let's delete it first and do a fresh rebuild-->
130 <jar destfile="lib/fedoraGS3.jar"
131 basedir="${fedorags3.rootdir}/"/>
134<target name="update-gs3forclient.jar" description="Will update the class files in ${basedir}/lib/gs3_for_client.jar using svn to the latest versions of those files in Greenstone3's svn repository">
137<!-- Targets that check for and ensure the existence of project-specific jar files -->
138<target name="check-QBRdata-jar" description="Checks for existence of dependency file QBRdata.jar">
139 <condition property="QBRdata.exists">
140 <available file="${basedir}/lib/QBRdata.jar"/>
141 </condition>
144<target name="ensure-QBRdata-jar" description="Will generate QBRdata.jar if it did not exist" depends="check-QBRdata-jar" unless="QBRdata.exists">
145 <antcall target="QBRdatajar"/>
148<target name="check-fedoraGS3-jar" description="Checks for existence of dependency file fedoraGS3.jar">
149 <condition property="fedoraGS3.exists">
150 <available file="${basedir}/lib/fedoraGS3.jar"/>
151 </condition>
154<target name="ensure-fedoraGS3-jar" description="Will generate fedoraGS3.jar if it did not exist" depends="check-fedoraGS3-jar" unless="fedoraGS3.exists">
155 <antcall target="fedoraGS3jar"/>
158<!-- generates the project's executable -->
159<target name="check-exec-jar" description="Checks for existence of executable file ${}">
160 <condition property="executable.exists">
161 <available file="${basedir}/${}"/>
162 </condition>
165<target name="ensure-exec-jar" description="Will generate ${} if it did not exist" depends="check-exec-jar" unless="executable.exists">
166 <antcall target="build-demo-client"/>
169<!-- User input for generating compressed output file for one of the chosen file types (zip, gzip, or bzip)-->
170<target name="create-gzip" if="gzip" description="User chose to create a tar.gz file of the project">
171 <tar destfile="${bin}/${}.tar" basedir="${basedir}" excludes="${zip.excludes}" />
172 <gzip destfile="${bin}/${}.tar.gz" src="${bin}/${}.tar" />
173 <delete file="${bin}/${}.tar"/>
176<target name="create-bzip" if="bzip" description="User chose to create a tar.bz2 file of the project">
177 <tar destfile="${bin}/${}.tar" basedir="${basedir}" excludes="${zip.excludes}"/>
178 <bzip2 destfile="${bin}/${}.tar.bz2" src="${bin}/${}.tar"/>
179 <delete file="${bin}/${}.tar"/>
182<target name="create-zip" if="zip" description="User chose to create a zip file of the project">
183 <zip destfile="${bin}/${}.zip" basedir="${basedir}" excludes="${zip.excludes}"/>
186<target name="get-ziptype">
187<!--<input addproperty="zip.type" validargs="zip,gzip,bzip">--><!-- doesn't work with default value-->
188 <input addproperty="zip.type" defaultvalue="zip">What type of compressed output file do you want to generate.
189Choose from zip, gzip (for tar.gz), bzip (tar.bz2)?
190Press enter for default: zip /></input>
191 <echo>You chose output file type: ${zip.type}</echo>
192 <condition property="gzip">
193 <equals arg1="gzip" arg2="${zip.type}"/>
194 </condition>
195 <condition property="zip">
196 <equals arg1="zip" arg2="${zip.type}"/>
197 </condition>
198 <condition property="bzip">
199 <equals arg1="bzip" arg2="${zip.type}"/>
200 </condition>
201 </target>
Note: See TracBrowser for help on using the repository browser.