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