1 <?xml version="1.0" encoding="UTF-8"?>
3 <project default="proteocache" name="Build ProteoCache - Caching framework for the Dundee Resource" basedir=".">
5 <!-- projects details -->
6 <property name="proteocache_version" value="0.1.0"/>
7 <property name="project.url" value="http://www.compbio.dundee.ac.uk/proteocache"/>
8 <property name="product" value="ProteoCache"/>
9 <property name="author" value="Alexander Sherstnev"/>
10 <!-- Distributive file names-->
11 <property name="distdir" value="distribution"/>
12 <mkdir dir="${distdir}" />
14 <property name="proteocache-war" value="${distdir}/proteocache-${proteocache_version}.war"/>
15 <property name="proteocache-jar" value="${distdir}/proteocache-${proteocache_version}.jar"/>
16 <property name="proteocache-source-jar" value="${distdir}/proteocache-src-${proteocache_version}.jar"/>
17 <property name="proteocache-project" value="${distdir}/proteocache-project.zip"/>
19 <property name="classes" location="${basedir}/WEB-INF/classes" />
20 <property name="ext.lib.path" location="${basedir}/lib" />
21 <property name="web.lib.path" location="${basedir}/WEB-INF/lib" />
23 <!-- add external and internal libraries -->
24 <path id="project.classpath">
25 <fileset dir="${web.lib.path}">
26 <include name="*.jar" />
28 <fileset dir="${ext.lib.path}">
29 <include name="*.jar" />
33 <fileset dir="${basedir}/WEB-INF/classes/" id="allcodes">
34 <include name="compbio/datadb/**"/>
35 <include name="compbio/engine/**"/>
36 <include name="compbio/server/**"/>
39 <!-- ###################################################################################################################################### -->
42 <!-- Clean temp directories -->
44 <delete dir="${classes}" />
45 <mkdir dir="${classes}" />
46 <copy file="${basedir}/log/log4j.properties" tofile="${classes}/log4j.properties" />
49 <!-- Clean up temporary directories and dist directory (all jar, zip, and war files deleted) -->
50 <target name="full-clean" depends="clean">
52 <fileset dir="${distdir}">
53 <include name="*.jar"/>
54 <include name="*.zip"/>
55 <include name="*.war"/>
61 Compile with optimisation. testsrc is not compiled
62 Packages of the lower order should not have dependencies on the packages
63 on the next layer. So datadb (layer 3) depends on the engine classes but
64 engine does not depend on anything in datadb
66 <target name="compile" depends="clean" description="Multiple step compilation to ensure layered structure is preserved. Debug disabled, optimisation enabled.">
67 <!-- copy files to class path-->
68 <copy file="${basedir}/log/log4j.properties" tofile="${classes}/log4j.properties" />
69 <!-- Complile engine -->
70 <javac srcdir="${basedir}/engine" destdir="${classes}" target="1.7" source="1.7" debug="off" optimize="on" encoding="UTF-8" verbose="false" nowarn="true">
71 <compilerarg value="-Xlint:-unchecked" />
72 <classpath refid="project.classpath" />
74 <!-- Complile database code -->
75 <javac srcdir="${basedir}/datadb" destdir="${classes}" target="1.7" source="1.7" debug="off" optimize="on" encoding="UTF-8" verbose="false" nowarn="true">
76 <compilerarg value="-Xlint:all" />
77 <compilerarg value="-Xlint:-unchecked" />
78 <classpath refid="project.classpath" />
80 <!-- Complile the server -->
81 <javac srcdir="${basedir}/server" destdir="${classes}" target="1.7" source="1.7" debug="off" optimize="on" encoding="UTF-8" verbose="false" nowarn="true">
82 <compilerarg value="-Xlint:-unchecked" />
83 <classpath refid="project.classpath" />
87 <target name="source-jar" description="Pack java sources">
88 <delete file="${proteocache-source-jar}">
90 <jar jarfile="${proteocache-source-jar}">
91 <fileset dir="${basedir}/datadb">
94 <fileset dir="${basedir}/engine">
97 <fileset dir="${basedir}/server/">
101 <attribute name="Built-By" value="${author}" />
102 <attribute name="Class-Path" value="." />
103 <attribute name="Implementation-Title" value="${product} Source Code Archive" />
104 <attribute name="Implementation-Vendor" value="${author}" />
105 <attribute name="Implementation-URL" value="${project.url}" />
110 <target name="build-proteocache-jar" depends="compile" description="Pack all compiled codes, configuration, ...">
111 <echo>Build full jar</echo>
112 <delete file="${proteocache-jar}"></delete>
113 <jar jarfile="${proteocache-jar}">
114 <!-- <zipgroupfileset excludes="META-INF/*.SF" dir="${web.lib.path}" ></zipgroupfileset>-->
115 <fileset refid="allcodes"></fileset>
116 <fileset dir="${basedir}/WEB-INF/classes/"></fileset>
117 <!-- Set compbio.server.MainTester as main to help user to test their deployments -->
119 <attribute name="Built-By" value="${author}" />
120 <attribute name="Class-Path" value="." />
121 <attribute name="Main-Class" value="compbio.server.MainTester" />
122 <attribute name="Implementation-Title" value="${product}" />
123 <attribute name="Implementation-Vendor" value="${author}" />
124 <attribute name="Implementation-URL" value="${project.url}" />
129 <target name="proteocache-server" depends="build-proteocache-jar" description="Prepare ProteoCache war file">
130 <echo>Prepare ProteoCache war file</echo>
131 <delete file="${proteocache-war}"></delete>
132 <zip destfile="${proteocache-war}" whenempty="create">
133 <zipfileset dir="${basedir}/WEB-INF" prefix="WEB-INF">
134 <exclude name="classes"/>
135 <include name="web.xml"/>
136 <include name="lib/*"/>
138 <zipfileset dir="." includes="${proteocache-jar}" fullpath="WEB-INF/lib/proteocache.jar"/>
139 <zipfileset dir="conf" prefix="conf" />
140 <!-- Add ProteoCache static web site pages apart from the binary archive -->
141 <zipfileset dir="${basedir}/website" excludes="tests/**, template.html"/>
142 <!-- Put a copy of log4j configuration file where it can be used -->
143 <zipfileset dir="log" includes="log4j.properties" prefix="WEB-INF/classes"/>
147 <target name="all" depends="proteocache-server, source-jar" description="Build all files"/>
149 <!-- This task does not really depends on compile, but it is better to make sure that the code is sound -->
150 <target name="archive" description="Pack everything in the project for those who do not have access to SVN" depends="full-clean">
151 <delete file="${proteocache-project}">
153 <zip destfile="${proteocache-project}" whenempty="create" >
154 <fileset dir="." excludes="${distdir}/**, **.git, **/*.zip, **/*.war"/>
158 <!-- ###################################################################################################################################### -->
159 <!-- Test targets -->
161 <property name="LD_LIBRARY_PATH" value="/gridware/sge/lib/lx24-amd64"/>
163 <!-- add test library -->
164 <path id="test.classpath">
165 <fileset dir="${basedir}/testsrc/lib">
166 <include name="*.jar" />
168 <pathelement location="${classes}" />
171 Packages of the lower order should not have dependencies on the packages
172 on the next layer. So datadb (layer 3) depends on the engine classes but
173 engine does not depend on anything in datadb
175 <target name="compile_with_debug" depends="clean" description="Perform a multiple step compilation to ensure layered structure is preserved. Debug enabled.">
176 <!-- copy files to class path-->
177 <copy file="${basedir}/log/log4j.properties" tofile="${classes}/log4j.properties" />
178 <!-- Complile the engine classes -->
179 <javac srcdir="${basedir}/engine" destdir="${classes}" target="1.7" source="1.7" debug="on" encoding="UTF-8" verbose="false" nowarn="true" >
180 <compilerarg value="-Xlint:unchecked"/>
181 <classpath refid="project.classpath" />
183 <!-- Complile the database classes -->
184 <javac srcdir="${basedir}/datadb" destdir="${classes}" target="1.7" source="1.7" debug="on" encoding="UTF-8" verbose="false" nowarn="true" >
185 <compilerarg value="-Xlint:unchecked"/>
186 <classpath refid="project.classpath" />
188 <!-- Complile the server classes -->
189 <javac srcdir="${basedir}/server" destdir="${classes}" target="1.7" source="1.7" debug="on" encoding="UTF-8" verbose="false" nowarn="true" >
190 <compilerarg value="-Xlint:unchecked"/>
191 <classpath refid="project.classpath" />
193 <!-- Complile the tests -->
194 <javac srcdir="${basedir}/testsrc" destdir="${classes}" target="1.7" source="1.7" debug="on" encoding="UTF-8" verbose="false" nowarn="true" >
195 <compilerarg value="-Xlint:unchecked"/>
196 <classpath refid="project.classpath" />
197 <classpath refid="test.classpath" />
202 <taskdef name="testNG" classname="org.testng.TestNGAntTask">
203 <classpath refid="test.classpath">
207 <target name="CustomTest" depends="compile_with_debug">
208 <delete file="${activity.log}"/>
209 <testNG haltonfailure="true" enableassert="true" >
210 <jvmarg value="-server" />
211 <jvmarg value="-enableassertions" />
212 <jvmarg value="-Xms1024m" />
213 <jvmarg value="-Xmx1024m" />
214 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
215 <classpath refid="test.classpath" />
216 <classpath refid="project.classpath" />
217 <xmlfileset dir="." includes="temp-testng-customsuite.xml"/>
218 <sysproperty key="TestingDataPath" value="${data.src}"/>
222 <target name="Run_cluster_dependent_test" depends="compile_with_debug">
223 <delete file="${activity.log}"/>
224 <testNG groups="cluster" haltonfailure="true" enableassert="true" parallel="false" verbose="3">
225 <jvmarg value="-server" />
226 <jvmarg value="-enableassertions" />
227 <jvmarg value="-Xms1024m" />
228 <jvmarg value="-Xmx1024m" />
229 <classfileset dir="${classes}" includes="**/*.class" />
230 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
231 <classpath refid="test.classpath" />
232 <classpath refid="project.classpath" />
233 <sysproperty key="TestingDataPath" value="${data.src}"/>
237 <target name="Test" depends="compile_with_debug">
238 <delete file="${activity.log}"/>
239 <testNG haltonfailure="true" enableassert="true" verbose="3" excludedgroups="performance, webservices" >
240 <jvmarg value="-server" />
241 <jvmarg value="-enableassertions" />
242 <jvmarg value="-Xms1024m" />
243 <jvmarg value="-Xmx1024m" />
244 <classfileset dir="${classes}" includes="**/*.class" />
245 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
246 <classpath refid="test.classpath" />
247 <classpath refid="project.classpath" />
248 <sysproperty key="TestingDataPath" value="${data.src}"/>
252 <target name="Performance_tests" depends="compile_with_debug">
253 <delete file="${activity.log}"/>
254 <testNG haltonfailure="true" enableassert="true" verbose="3" groups="performance" >
255 <jvmarg value="-server" />
256 <jvmarg value="-enableassertions" />
257 <jvmarg value="-Xms1024m" />
258 <jvmarg value="-Xmx1024m" />
259 <classfileset dir="${classes}" includes="**/*.class" />
260 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
261 <classpath refid="test.classpath" />
262 <classpath refid="project.classpath" />
263 <sysproperty key="TestingDataPath" value="${data.src}"/>
267 <target name="Test_casscode" depends="compile_with_debug">
268 <delete file="${activity.log}"/>
269 <testNG groups="casscode" haltonfailure="true" verbose="3" enableassert="true" >
270 <jvmarg value="-server" />
271 <jvmarg value="-enableassertions" />
272 <jvmarg value="-Xms1024m" />
273 <jvmarg value="-Xmx1024m" />
274 <classfileset dir="${classes}" includes="**/*.class" />
275 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
276 <classpath refid="test.classpath" />
277 <classpath refid="project.classpath" />
278 <sysproperty key="TestingDataPath" value="${data.src}"/>
282 <target name="All_cluster_independent_windows_only_tests" depends="compile_with_debug">
283 <delete file="${activity.log}" failonerror="false"/>
284 <testNG excludedgroups="cluster, non_windows" haltonfailure="true" verbose="3" enableassert="true" >
285 <jvmarg value="-server" />
286 <jvmarg value="-enableassertions" />
287 <jvmarg value="-Xms1024m" />
288 <jvmarg value="-Xmx1024m" />
289 <classfileset dir="${classes}" includes="**/*.class" />
290 <classpath refid="test.classpath" />
291 <classpath refid="project.classpath" />
292 <sysproperty key="TestingDataPath" value="${data.src}"/>
296 <target name="All_cluster_independent_tests" depends="compile_with_debug">
297 <delete file="${activity.log}" failonerror="false"/>
298 <testNG excludedgroups="cluster, performance" haltonfailure="true" verbose="3" enableassert="true" >
299 <jvmarg value="-server" />
300 <jvmarg value="-enableassertions" />
301 <jvmarg value="-Xms1024m" />
302 <jvmarg value="-Xmx1024m" />
303 <classfileset dir="${classes}" includes="**/*.class" />
304 <classpath refid="test.classpath" />
305 <classpath refid="project.classpath" />
306 <sysproperty key="TestingDataPath" value="${data.src}"/>
310 <target name="Rerun_failed_tests" depends="compile_with_debug">
311 <delete file="${activity.log}" failonerror="false"/>
312 <testNG haltonfailure="true" enableassert="true" verbose="9" >
313 <jvmarg value="-server" />
314 <jvmarg value="-enableassertions" />
315 <jvmarg value="-Xms1024m" />
316 <jvmarg value="-Xmx1024m" />
317 <env key="LD_LIBRARY_PATH" value="${LD_LIBRARY_PATH}"/>
318 <classpath refid="test.classpath" />
319 <classpath refid="project.classpath" />
320 <xmlfileset dir="." includes="test-output/testng-failed.xml"/>
321 <sysproperty key="TestingDataPath" value="${data.src}"/>