upgrade to InstallAnywhere 2010 - and set minimum heap size to be 56M for OSX issue
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5.1)
4  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5  * 
6  * This file is part of Jalview.
7  * 
8  * Jalview is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License 
10  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11  * 
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
18 -->
19 <project name="jalviewX" default="usage" basedir=".">
20         <!-- we use jalopy to format our sources -->
21         <taskdef name="jalopy"
22          classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
23                 <classpath>
24                         <fileset dir="utils/jalopy/lib">
25                                 <include name="*.jar" />
26                         </fileset>
27                 </classpath>
28         </taskdef>
29
30         <target name="help" depends="usage"/>
31         <target name="usage">
32                 <echo message="~~~Jalview Ant build.xml Usage~~~~"/>
33                 <echo message="Targets include:"/>
34                 <echo message="usage - default target, displays this message"/>
35                 <echo message="buildindices - generates JavaHelpSearch from the help files"/>
36                 <echo message="build - compiles all necessary files for Application"/>
37                 <echo message="makedist - compiles and places all necessary jar files into directory dist"/>
38                 <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution"/>
39                 <echo message="              this needs a keystore and key. See docs/building.html for more information."/>
40                 <echo message="compileApplet - compiles all necessary files for Applet"/>
41                 <echo message="makeApplet - compiles, then packages and obfuscates the Applet"/>
42                 <echo message="See docs/building.html and the comments in build file for other targets."/>
43             <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk."/>
44             <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation"/>
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                                         <include name="*_*.jar"/>
268                                         <exclude name="jalview.jar"/>
269                                 </fileset>
270                                 <property name="jalview.version" value="${JALVIEW_VERSION}"/>
271                         </resources>
272                         <application_desc main_class="jalview.bin.Jalview">
273                         </application_desc>
274                         <security>
275                                 <all_permissions/>
276                         </security>
277                 </jnlp>
278         </target>
279         <target name="runenv" depends="init">
280                 <path id="run.classpath">
281                         <pathelement location="${outputDir}"/>
282                         <fileset dir="${outputDir}">
283                                 <include name="${libDir}/*.jar"/>
284                         </fileset>
285                 </path>
286                 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
287
288                 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
289       </echo>
290         </target>
291
292         <target name="buildextclients" depends="init">
293                 <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)"
294       validargs="Y,y,n,N" defaultvalue="N"
295       addproperty="doextbuild.response"/>
296                 <condition property="dontextbuild">
297                         <equals arg1="n" arg2="${doextbuild.response}"/>
298                 </condition>
299                 <condition property="dontextbuild">
300                         <equals arg1="N" arg2="${doextbuild.response}"/>
301                 </condition>
302                 <fail if="dontextbuild">
303         Build External Client Code process aborted by user. Jalview source is unchanged.
304       </fail>
305                 <!-- Currently, this doesn't happen automatically.
306      1. Run WSDL2Java as below, which generates an ext.vamsas +
307      vamsas.<datapackages> fileset.
308      2. refactor ext.vamsas.SpecificserviceWS* to
309      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
310      3. Update the jalview.ws.*WServices classes to reflect the
311      interface type, and all locations of this wsdl type that Jalview
312      might be using.
313
314 -->
315                 <path id="axisbuild">
316                         <path refid="build.classpath"/>
317                 </path>
318                 <taskdef resource="axis-tasks.properties" classpathref="axisbuild"/>
319                 <move todir="./bak">
320                         <fileset dir="${sourceDir}" id="client">
321                                 <include name="${wsdl.ClientNS}/*.*"/>
322                         </fileset>
323                 </move>
324
325                 <axis-wsdl2java
326       output="${sourceDir}"
327       verbose="true"
328       url="${wsdl.MsaWS2}"
329       serverside="false"
330       deployscope="Request"
331       debug="false"
332       helpergen="true"
333       all="true"
334       >
335                         <mappingSet>
336                                 <mapping
337         namespace="${wsdl.Namespace}"
338         package="${wsdl.ClientNS}"
339         />
340                                 <mapping namespace="http://dataTypes.vamsas"
341         package="${wsdl.ClientNS}"/>
342                         </mappingSet>
343                 </axis-wsdl2java>
344         </target>
345
346         <target name="makedist" depends="build, buildPropertiesFile, buildindices">
347                 <!-- make the package jar -->
348                 <mkdir dir="${packageDir}"/>
349
350                 <jar destfile="${packageDir}/${outputJar}">
351                         <manifest>
352                                 <attribute name="Main-Class" value="jalview.bin.Jalview"/>
353                         </manifest>
354                         <fileset dir="${outputDir}/">
355                                 <exclude name="cache*/**"/>
356                                 <exclude name="*.jar" />
357                                 <exclude name="*.jar.*" />
358                                 <exclude name="**/*.jar" />
359                                 <exclude name="**/*.jar.*" />
360                         </fileset>
361                 </jar>
362
363                 <copy toDir="${packageDir}" flatten="true">
364                         <fileset dir="${outputDir}">
365                                 <include name="*.jar"/>
366                                 <include name="**/*.jar"/>
367                         </fileset>
368                 </copy>
369         </target>
370
371
372         <!-- jalopy code reformatter -->
373         <target name="sourcescrub" depends="init,build">
374                 <jalopy destdir="jsrc" classpathref="run.classpath"
375       convention="jalview-jalopy.xml">
376                         <fileset dir="${sourceDir}">
377                                 <include name="*.java"/>
378                                 <include name="**/*.java"/>
379                                 <include name="**/**/*.java"/>
380                         </fileset>
381                 </jalopy>
382         </target>
383
384
385
386   <!-- Compile, package and obfuscate Jalview Applet -->
387   <target name="makeApplet" depends="obfuscate"/>
388
389   <target name="compileApplet" depends="init,clean">
390     <mkdir dir="${outputDir}"/>
391     <javac source="1.2"
392     target="1.1"
393     srcdir="${sourceDir}" 
394     destdir="${outputDir}"
395         debug="${javac.debug}"
396     classpath="lib/${jmolJar}"
397        includes="jalview/appletgui/**"
398        excludes="ext/**,MCview/**,org/**,vamsas/**"
399        />
400   </target>
401
402   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
403   <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif"/>
404   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif"/>
405        <jar destfile="in.jar">
406         <manifest>
407             <attribute name="Main-Class" value="jalview.bin.JalviewLite"/>
408         </manifest>
409         <fileset dir="${outputDir}">
410           <include name="com/**"/>
411           <include name="MCview/**"/>
412           <include name="jalview/**"/>
413           <include name=".build_properties"/>
414           <include name="images/idwidth.gif"/>
415           <include name="images/link.gif"/>
416         </fileset>
417       </jar>
418   </target>
419   <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally" description="construct the final jalviewLite applet jar with or without obfuscation">
420   </target>
421         <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">    
422         <copy file="in.jar" tofile="${jalviewLiteJar}" />       
423     <delete file="in.jar"/>
424   </target>
425         <target name="-obfuscatereally" unless="donotobfuscate">
426     
427         <path id="obfuscateDeps.path">
428     <pathelement location="${applet.jre.tools}"/>
429     <pathelement location="lib/${jmolJar}"/>
430     </path>
431     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
432         
433     <proguard>
434       <injar file="in.jar"/>
435       <outjar file="${jalviewLiteJar}"/>
436       <libraryjar refid="obfuscateDeps.path"/>
437       <keep access="public" type="class"
438       name="jalview.bin.JalviewLite">
439         <field access="public"/>
440         <method access="public"/>
441         <constructor access="public"/>
442       </keep>
443 <!--      -libraryjars "${obfuscateDeps}"
444       -injars      in.jar
445       -outjars     jalviewApplet.jar
446       -keep public class jalview.bin.JalviewLite
447        { public * ; } -->
448       </proguard>
449     <delete file="in.jar"/>
450   </target>
451
452         <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
453                 <taskdef name="castor-srcgen"
454                           classname="org.castor.anttask.CastorCodeGenTask"
455                       classpathref="build.classpath" />
456                 <delete>
457                         <fileset dir="${sourceDir}/jalview/schemabinding/version2">
458                                 <include name="*.java"/>
459                                 <include name="descriptors/*.java"/>
460                         </fileset>
461                 </delete>
462                 <castor-srcgen file="${schemaDir}/vamsas.xsd"
463                               todir="${sourceDir}"
464                               package="jalview.schemabinding.version2"
465                               warnings="false" 
466                                         nodesc="false"
467                                                 verbose="true"
468                                                 properties="${schemaDir}/jalview.properties"
469                 />
470                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
471                               todir="${sourceDir}"
472                               package="jalview.schemabinding.version2"
473                               warnings="false" 
474                                         nodesc="false"
475                                                 verbose="true"
476                                                 properties="${schemaDir}/jalview.properties"
477                 />
478                 <castor-srcgen file="${schemaDir}/jalview.xsd"
479                               todir="${sourceDir}"
480                               package="jalview.schemabinding.version2"
481                               warnings="false" 
482                                           nodesc="false"
483                                                 verbose="true"
484                                                 properties="${schemaDir}/jalview.properties"
485                         
486                 />
487                 <!-- 
488                 now build the jalview.binding package with the old schema set
489                 -->
490                 <delete>
491                         <fileset dir="${sourceDir}/jalview/binding/">
492                                 <include name="**"/>
493                         </fileset>
494                 </delete>
495                 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd"
496                               todir="${sourceDir}"
497                               package="jalview.binding"
498                               warnings="false" 
499                                         nodesc="true"
500                                                 verbose="true"
501                                                 properties="${schemaDir}/jalview.nodesc.properties"
502                 /> 
503                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
504                               todir="${sourceDir}"
505                               package="jalview.binding"
506                               warnings="false" 
507                                         nodesc="true"
508                                                 verbose="true"
509                                                 properties="${schemaDir}/jalview.nodesc.properties"
510                 />
511                 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd"
512                               todir="${sourceDir}"
513                               package="jalview.binding"
514                               warnings="false" 
515                                           nodesc="true"
516                                                 verbose="true"
517                                                 properties="${schemaDir}/jalview.nodesc.properties"
518         />
519         </target>
520         <target name="sourcedist" description="create jalview source distribution" depends="init">
521                 <delete file="${source.dist.name}"/>
522                 <tar destfile="${source.dist.name}" compression="gzip">
523                         <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
524                                 <include name="LICENSE"/>
525                                 <include name="README"/>
526                                 <include name="build.xml"/>
527                                 <include name="jalview-jalopy.xml"/>
528                                 <include name="JalviewApplet.jpx"/>
529                                 <include name="JalviewX.jpx"/>
530                                 <include name="${sourceDir}/*.java"/>
531                                 <include name="${sourceDir}/**/*.java"/>
532                                 <include name="${sourceDir}/**/*.cdr"/>
533                                 <include name="${libDir}/**/*"/>                                                
534                                 <include name="${resourceDir}/**/*"/>                                           
535                                 <include name="${helpDir}/**/*"/>                                               
536                                 <exclude name="**/*locales"/>
537                                 <exclude name="*locales/**"/>
538                                 <exclude name="utils/InstallAnywhere/**Build.iap_xml"/>
539                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
540                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
541                                 <exclude name="utils/InstallAnywhere/**locale*"/>
542                                 <exclude name="utils/InstallAnywhere/**locale*/**"/>
543                                 <include name="${schemaDir}/**/*"/>                                             
544                                 <include name="utils/**/*"/>
545                                 <include name="${docDir}/**/*"/>                                                
546                         </tarfileset>
547                 </tar>
548         </target>
549 </project>