bugfix db ref retrieve routine so it removes dead query strings properly
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <project name="jalviewX" default="usage" basedir=".">
3         <!-- we use jalopy to format our sources -->
4         <taskdef name="jalopy"
5          classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
6                 <classpath>
7                         <fileset dir="utils/jalopy/lib">
8                                 <include name="*.jar" />
9                         </fileset>
10                 </classpath>
11         </taskdef>
12
13         <target name="help" depends="usage"/>
14         <target name="usage">
15                 <echo message="~~~Jalview Ant build.xml Usage~~~~"/>
16                 <echo message="Targets include:"/>
17                 <echo message="usage - default target, displays this message"/>
18                 <echo message="buildindices - generates JavaHelpSearch from the help files"/>
19                 <echo message="build - compiles all necessary files for Application"/>
20                 <echo message="makedist - compiles and places all necessary jar files into directory dist"/>
21                 <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution"/>
22                 <echo message="              this needs a keystore and key. See docs/building.html for more information."/>
23                 <echo message="compileApplet - compiles all necessary files for Applet"/>
24                 <echo message="makeApplet - compiles, then packages and obfuscates the Applet"/>
25                 <echo message="See docs/building.html and the comments in build file for other targets."/>
26             <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk."/>
27         </target>
28
29
30         <!-- utils is a class path to additional utilities needed for
31     building docs, jars and webstart stuff -->
32         <!--
33         Userdefined build property defaults
34
35         wsdl.server list (plus namespace mapping info ???)  - also want
36                 ... to make this a dynamically generatable property
37         WebStart Location
38         Build location - provide a temporary root for speed
39         jarsigner keystore and info
40         Jakarta and axis classpath ?
41         Default argument for starting Jalview (if it exists).
42
43 -->
44
45         <target name="init">
46                 <path id="axis.classpath">
47                         <!-->
48                         <fileset dir="/usr/local/axis/lib">
49                                 <include name="**/*.jar" />
50                         </fileset>
51                         <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
52                                 <include name="**/*.jar"/>
53                                 <include name="*.jar"/>
54                         </fileset> -->
55       </path>
56                 <!-- Jalview Version String displayed by application on startup and used to check for updates -->
57     <property name="JALVIEW_VERSION" value="DEVELOPMENT"/> <!-- 2.4 (VAMSAS)" -->
58                 <!-- Include debugging information in javac true or false -->
59                 <property name="javac.debug" value="true"/>
60                 
61                 <!-- JarSigner Key Store for Webstart Distribution -->
62                 <property name="jalview.keystore" value="./keys/.keystore"/>
63                 <!-- Keystore Password -->
64                 <property name="jalview.keystore.pass" value="alignmentisfun"/>
65                 <!-- Key Name -->
66                 <property name="jalview.key" value="jalview"/>
67                 <!-- Key Password -->
68                 <property name="jalview.key.pass" value="alignmentisfun"/>
69                                                 
70                 <!-- Don't change anything below here unless you know what you are doing! -->
71                 <!-- Url path for WebStart in JNLP file -->
72                 <property name="WebStartLocation" value="http://www.jalview.org/webstart"/>
73                 <!-- build directory configuration -->
74                 <property name="libDir" value="lib"/>
75                 <property name="resourceDir" value="resources"/>
76                 <property name="helpDir" value="help"/>
77                 <property name="docDir" value="doc"/>
78                 <property name="sourceDir" value="src" />
79                 <property name="schemaDir" value="schemas" />
80                 <property name="outputDir" value="classes" />
81                 <property name="packageDir" value="dist" />
82                 <property name="outputJar" value="jalview.jar" />
83           <!-- Jalview Applet JMol Jar Dependency -->
84     <property name="jmolJar" value="Jmol-11.0.2.jar" />
85                 <property name="jalviewLiteJar" value="jalviewApplet.jar"/>
86                 <!-- switch to indicate if we should obfuscate jalviewLite -->
87                 <!--<property name="donotobfuscate" value="true"/> -->
88                                 
89                 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
90                 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
91                 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
92                 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
93                 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
94                 <property name="WSInterf" value="MsaWS" />
95                 <property name="wsdl.Namespace" value="vamsas" />
96                 <property name="wsdl.ClientNS" value="ext.vamsas" />
97                 <!-- the class path for building the application -->
98                 <path id="build.classpath">
99                         <fileset dir="utils">
100                                 <include name="*.jar"/>
101                                 <include name="**/*.jar"/>
102                         </fileset>
103                         <fileset dir="${libDir}">
104                                 <include name="*.jar"/>
105                                 <include name="**/*.jar"/>
106                         </fileset>
107                         
108                 </path>
109                 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz"/>
110                 <!-- The Location of the java 1.1.8 jdk -->
111                 <property name="java118.home" value="C:\Sun\jdk1.1.8" />
112                 <property name="applet.jre.tools" value="${java118.home}/lib/classes.zip"/>
113                 <!-- jre for 1.4 version
114                 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
115                 -->
116                 <!-- the classpath for building the 1.1 applet -->
117                 <path id="jalviewlite.deps">
118                         <fileset dir="${java118.home}">
119                                 <include name="lib/classes.zip"/>
120                         </fileset>
121                 <pathelement location="lib/${jmolJar}"/>
122           </path>
123         </target>
124
125
126         <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties"/>
127         <target name="buildPropertiesFile" depends="init">
128                 <tstamp prefix="build">
129                         <format property="date" pattern="dd MMMM yyyy"/>
130                 </tstamp>
131                 <properties file="${outputDir}/.build_properties">
132                         <header>
133           ---Jalview Build Details---
134         </header>
135                         <property name="VERSION" value="${JALVIEW_VERSION}"/>
136                         <property name="BUILD_DATE" value="${build.date}"/>
137                 </properties>
138         </target>
139
140
141         <target name="clean" depends="init">
142                 <!-- not efficient yet. -->
143                 <delete dir="${outputDir}"/>
144         </target>
145
146         <target name="distclean" depends="init, clean">
147
148                 <echo message="REMOVING ALL BACKUP/AUTOSAVES!"/>
149                 <delete>
150                         <fileset dir=".">
151                                 <include name="${outputJar}"/>
152                                 <include name="#*#"/>
153                                 <include name="#*.*#"/>
154                                 <include name="**/#*#"/>
155                                 <include name="**/#*.*#"/>
156                                 <include name="*~"/>
157                                 <include name="*.*~"/>
158                                 <include name="**/*~"/>
159                                 <include name="**/*.*~"/>
160                         </fileset>
161                 </delete>
162         </target>
163
164         <target name="prepare" depends="init">
165                 <mkdir dir="${outputDir}"/>
166                 <copy todir="${outputDir}">
167                         <fileset dir=".">
168                                 <include name="${docDir}/**/*.*"/>
169                                 <include name="${helpDir}/**/*.*"/>
170                                 <include name="${libDir}/*.jar"/>
171                         </fileset>
172                         <fileset dir="${resourceDir}">
173                                 <include name="**/*.*"/>
174                         </fileset>
175                 </copy>
176         </target>
177
178         <target name="build" depends="prepare">
179                 <!-- not efficient yet. -->
180                 <javac source="1.4" target="1.4"
181         srcdir ="${sourceDir}"
182         destdir="${outputDir}"
183                                 debug="${javac.debug}"
184       classpathref="build.classpath">
185                         <exclude name="jalview/*applet*"/>
186                         <exclude name="com/stevesoft/**"/>
187                 </javac>
188         </target>
189         <target name="buildindices" depends="init, prepare"
190     unless="help.uptodate">
191                 <java
192       classname="com.sun.java.help.search.Indexer"
193       classpathref="build.classpath"
194       fork="true"
195       dir="${outputDir}/${helpDir}"
196       >
197                         <arg line="html"/>
198                 </java>
199         </target>
200
201         <target name="makefulldist" depends="makedist">
202                 <!-- the default keystore details might need to be edited here -->
203                 <signjar
204       storepass="${jalview.keystore.pass}"
205       keypass="${jalview.key.pass}"
206       keystore="${jalview.keystore}"
207       alias="${jalview.key}"
208       lazy="false"
209       verbose="false"
210       >
211
212                         <fileset dir="${packageDir}">
213                                 <include name="*.jar"/>
214                         </fileset>
215                 </signjar>
216                 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties"/>
217
218                 <!--    codebase="http://www.jalview.org/jalview/webstart" -->
219                 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
220                 <jnlp toFile="${packageDir}/jalview.jnlp" 
221       codebase="${WebStartLocation}">
222                         <information>
223                                 <title>Jalview</title>
224                                 <vendor>The Barton Group</vendor>
225                                 <homepage href="http://www.jalview.org"/>
226                                 <description>Jalview Multiple Alignment Editor</description>
227                                 <description kind="short">Jalview</description>
228                                 <icon href="logo_big.gif"/>
229                                 <offline_allowed/>
230                                 <!--
231         <association mime-type="application-x/ext-file" extensions="fa"/>
232         <association mime-type="application-x/ext-file" extensions="fasta"/>
233         <association mime-type="application-x/ext-file" extensions="fastq"/>
234         <association mime-type="application-x/ext-file" extensions="blc"/>
235         <association mime-type="application-x/ext-file" extensions="msf"/>
236         <association mime-type="application-x/ext-file" extensions="pfam"/>
237         <association mime-type="application-x/ext-file" extensions="aln"/>
238         <association mime-type="application-x/ext-file" extensions="pir"/>
239         <association mime-type="application-x/ext-file" extensions="amsa"/>
240         -->
241                         </information>
242                         <resources>
243                                 <j2se version="1.4+"/>
244                                 <fileset dir="${packageDir}">
245                                         <include name="jalview.jar"/>
246                                 </fileset>
247                                 <fileset dir="${packageDir}">
248                                         <include name="*.jar"/>
249                                         <exclude name="jalview.jar"/>
250                                 </fileset>
251                                 <property name="jalview.version" value="${JALVIEW_VERSION}"/>
252                         </resources>
253                         <application_desc main_class="jalview.bin.Jalview">
254                         </application_desc>
255                         <security>
256                                 <all_permissions/>
257                         </security>
258                 </jnlp>
259         </target>
260         <target name="runenv" depends="init">
261                 <path id="run.classpath">
262                         <pathelement location="${outputDir}"/>
263                         <fileset dir="${outputDir}">
264                                 <include name="${libDir}/*.jar"/>
265                         </fileset>
266                 </path>
267                 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
268
269                 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
270       </echo>
271         </target>
272
273         <target name="buildextclients" depends="init">
274                 <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)"
275       validargs="Y,y,n,N" defaultvalue="N"
276       addproperty="doextbuild.response"/>
277                 <condition property="dontextbuild">
278                         <equals arg1="n" arg2="${doextbuild.response}"/>
279                 </condition>
280                 <condition property="dontextbuild">
281                         <equals arg1="N" arg2="${doextbuild.response}"/>
282                 </condition>
283                 <fail if="dontextbuild">
284         Build External Client Code process aborted by user. Jalview source is unchanged.
285       </fail>
286                 <!-- Currently, this doesn't happen automatically.
287      1. Run WSDL2Java as below, which generates an ext.vamsas +
288      vamsas.<datapackages> fileset.
289      2. refactor ext.vamsas.SpecificserviceWS* to
290      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
291      3. Update the jalview.ws.*WServices classes to reflect the
292      interface type, and all locations of this wsdl type that Jalview
293      might be using.
294
295 -->
296                 <path id="axisbuild">
297                         <path refid="build.classpath"/>
298                 </path>
299                 <taskdef resource="axis-tasks.properties" classpathref="axisbuild"/>
300                 <move todir="./bak">
301                         <fileset dir="${sourceDir}" id="client">
302                                 <include name="${wsdl.ClientNS}/*.*"/>
303                         </fileset>
304                 </move>
305
306                 <axis-wsdl2java
307       output="${sourceDir}"
308       verbose="true"
309       url="${wsdl.MsaWS2}"
310       serverside="false"
311       deployscope="Request"
312       debug="false"
313       helpergen="true"
314       all="true"
315       >
316                         <mappingSet>
317                                 <mapping
318         namespace="${wsdl.Namespace}"
319         package="${wsdl.ClientNS}"
320         />
321                                 <mapping namespace="http://dataTypes.vamsas"
322         package="${wsdl.ClientNS}"/>
323                         </mappingSet>
324                 </axis-wsdl2java>
325         </target>
326
327         <target name="makedist" depends="build, buildPropertiesFile, buildindices">
328                 <!-- make the package jar -->
329                 <mkdir dir="${packageDir}"/>
330
331                 <jar destfile="${packageDir}/${outputJar}">
332                         <manifest>
333                                 <attribute name="Main-Class" value="jalview.bin.Jalview"/>
334                         </manifest>
335                         <fileset dir="${outputDir}/">
336                                 <exclude name="cache*/**"/>
337                                 <exclude name="*.jar" />
338                                 <exclude name="*.jar.*" />
339                                 <exclude name="**/*.jar" />
340                                 <exclude name="**/*.jar.*" />
341                         </fileset>
342                 </jar>
343
344                 <copy toDir="${packageDir}" flatten="true">
345                         <fileset dir="${outputDir}">
346                                 <include name="*.jar"/>
347                                 <include name="**/*.jar"/>
348                         </fileset>
349                 </copy>
350         </target>
351
352
353         <!-- jalopy code reformatter -->
354         <target name="sourcescrub" depends="init,build">
355                 <jalopy destdir="jsrc" classpathref="run.classpath"
356       convention="jalview-jalopy.xml">
357                         <fileset dir="${sourceDir}">
358                                 <include name="*.java"/>
359                                 <include name="**/*.java"/>
360                                 <include name="**/**/*.java"/>
361                         </fileset>
362                 </jalopy>
363         </target>
364
365
366
367   <!-- Compile, package and obfuscate Jalview Applet -->
368   <target name="makeApplet" depends="obfuscate"/>
369
370   <target name="compileApplet" depends="init,clean">
371     <mkdir dir="${outputDir}"/>
372     <javac source="1.2"
373     target="1.1"
374     srcdir="${sourceDir}" 
375     destdir="${outputDir}"
376         debug="${javac.debug}"
377     classpath="lib/${jmolJar}"
378        includes="jalview/appletgui/**"
379        excludes="ext/**,MCview/**,org/**,vamsas/**"
380        />
381   </target>
382
383   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
384   <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif"/>
385   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif"/>
386        <jar destfile="in.jar">
387         <manifest>
388             <attribute name="Main-Class" value="jalview.bin.JalviewLite"/>
389         </manifest>
390         <fileset dir="${outputDir}">
391           <include name="com/**"/>
392           <include name="MCview/**"/>
393           <include name="jalview/**"/>
394           <include name=".build_properties"/>
395           <include name="images/idwidth.gif"/>
396           <include name="images/link.gif"/>
397         </fileset>
398       </jar>
399   </target>
400   <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally" description="construct the final jalviewLite applet jar with or without obfuscation">
401   </target>
402         <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">    
403         <copy file="in.jar" tofile="${jalviewLiteJar}" />       
404     <delete file="in.jar"/>
405   </target>
406         <target name="-obfuscatereally" unless="donotobfuscate">
407     
408         <path id="obfuscateDeps.path">
409     <pathelement location="${applet.jre.tools}"/>
410     <pathelement location="lib/${jmolJar}"/>
411     </path>
412     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
413         
414     <proguard>
415       <injar file="in.jar"/>
416       <outjar file="${jalviewLiteJar}"/>
417       <libraryjar refid="obfuscateDeps.path"/>
418       <keep access="public" type="class"
419       name="jalview.bin.JalviewLite">
420         <field access="public"/>
421         <method access="public"/>
422         <constructor access="public"/>
423       </keep>
424 <!--      -libraryjars "${obfuscateDeps}"
425       -injars      in.jar
426       -outjars     jalviewApplet.jar
427       -keep public class jalview.bin.JalviewLite
428        { public * ; } -->
429       </proguard>
430     <delete file="in.jar"/>
431   </target>
432
433         <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
434                 <taskdef name="castor-srcgen"
435                           classname="org.castor.anttask.CastorCodeGenTask"
436                       classpathref="build.classpath" />
437                 <delete>
438                         <fileset dir="${sourceDir}/jalview/schemabinding/version2">
439                                 <include name="*.java"/>
440                                 <include name="descriptors/*.java"/>
441                         </fileset>
442                 </delete>
443                 <castor-srcgen file="${schemaDir}/vamsas.xsd"
444                               todir="${sourceDir}"
445                               package="jalview.schemabinding.version2"
446                               warnings="false" 
447                                         nodesc="false"
448                                                 verbose="true"
449                                                 properties="${schemaDir}/jalview.properties"
450                 />
451                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
452                               todir="${sourceDir}"
453                               package="jalview.schemabinding.version2"
454                               warnings="false" 
455                                         nodesc="false"
456                                                 verbose="true"
457                                                 properties="${schemaDir}/jalview.properties"
458                 />
459                 <castor-srcgen file="${schemaDir}/jalview.xsd"
460                               todir="${sourceDir}"
461                               package="jalview.schemabinding.version2"
462                               warnings="false" 
463                                           nodesc="false"
464                                                 verbose="true"
465                                                 properties="${schemaDir}/jalview.properties"
466                         
467                 />
468                 <!-- 
469                 now build the jalview.binding package with the old schema set
470                 -->
471                 <delete>
472                         <fileset dir="${sourceDir}/jalview/binding/">
473                                 <include name="**"/>
474                         </fileset>
475                 </delete>
476                 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd"
477                               todir="${sourceDir}"
478                               package="jalview.binding"
479                               warnings="false" 
480                                         nodesc="true"
481                                                 verbose="true"
482                                                 properties="${schemaDir}/jalview.nodesc.properties"
483                 /> 
484                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
485                               todir="${sourceDir}"
486                               package="jalview.binding"
487                               warnings="false" 
488                                         nodesc="true"
489                                                 verbose="true"
490                                                 properties="${schemaDir}/jalview.nodesc.properties"
491                 />
492                 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd"
493                               todir="${sourceDir}"
494                               package="jalview.binding"
495                               warnings="false" 
496                                           nodesc="true"
497                                                 verbose="true"
498                                                 properties="${schemaDir}/jalview.nodesc.properties"
499         />
500         </target>
501         <target name="sourcedist" description="create jalview source distribution" depends="init">
502                 <delete file="${source.dist.name}"/>
503                 <tar destfile="${source.dist.name}" compression="gzip">
504                         <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
505                                 <include name="LICENSE"/>
506                                 <include name="README"/>
507                                 <include name="build.xml"/>
508                                 <include name="jalview-jalopy.xml"/>
509                                 <include name="JalviewApplet.jpx"/>
510                                 <include name="JalviewX.jpx"/>
511                                 <include name="${sourceDir}/*.java"/>
512                                 <include name="${sourceDir}/**/*.java"/>
513                                 <include name="${sourceDir}/**/*.cdr"/>
514                                 <include name="${libDir}/**/*"/>                                                
515                                 <include name="${resourceDir}/**/*"/>                                           
516                                 <include name="${helpDir}/**/*"/>                                               
517                                 <exclude name="**/*locales"/>
518                                 <exclude name="*locales/**"/>
519                                 <exclude name="utils/InstallAnywhere/**Build.iap_xml"/>
520                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
521                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
522                                 <exclude name="utils/InstallAnywhere/**locale*"/>
523                                 <exclude name="utils/InstallAnywhere/**locale*/**"/>
524                                 <include name="${schemaDir}/**/*"/>                                             
525                                 <include name="utils/**/*"/>
526                                 <include name="${docDir}/**/*"/>                                                
527                         </tarfileset>
528                 </tar>
529         </target>
530 </project>