JAL-1780 more support for export setting for flatfile output
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
4  * Copyright (C) $$Year-Rel$$ The Jalview Authors
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  * The Jalview Authors are detailed in the 'AUTHORS' file.
19 -->
20 <project name="jalviewX" default="usage" basedir=".">
21   <target name="help" depends="usage" />
22   <target name="usage">
23     <echo message="~~~Jalview Ant build.xml Usage~~~~" />
24     <echo message="Targets include:" />
25     <echo message="usage - default target, displays this message" />
26     <echo message="buildindices - generates JavaHelpSearch from the help files" />
27     <echo message="build - compiles all necessary files for Application" />
28     <echo message="makedist - compiles and places all necessary jar files into directory dist" />
29     <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
30     <echo message="              this needs a keystore and key. See docs/building.html for more information." />
31     <echo message="compileApplet - compiles all necessary files for Applet" />
32     <echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
33     <echo message="See docs/building.html and the comments in build file for other targets." />
34     <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk." />
35     <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
36   </target>
37
38
39   <!-- utils is a class path to additional utilities needed for
40     building docs, jars and webstart stuff -->
41   <!--
42         Userdefined build property defaults
43
44         wsdl.server list (plus namespace mapping info ???)  - also want
45                 ... to make this a dynamically generatable property
46         WebStart Location
47         Build location - provide a temporary root for speed
48         jarsigner keystore and info
49         Jakarta and axis classpath ?
50         Default argument for starting Jalview (if it exists).
51
52 -->
53
54   <target name="init">
55     <path id="axis.classpath">
56       <!-->
57       <fileset dir="/usr/local/axis/lib">
58         <include name="**/*.jar" />
59       </fileset>
60       <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
61         <include name="**/*.jar"/>
62         <include name="*.jar"/>
63       </fileset> -->
64       </path>
65         
66     <!-- Jalview Version String displayed by application on startup and used to check for updates -->
67     <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
68         
69     <property name="INSTALLATION" value="Source" />
70         
71     <!-- 2.4 (VAMSAS)" -->
72     <!-- Include debugging information in javac true or false -->
73     <property name="javac.debug" value="true" />
74
75     <!-- JarSigner Key Store for Webstart Distribution -->
76     <property name="jalview.keystore" value="./keys/.keystore" />
77     <!-- Keystore Password -->
78     <property name="jalview.keystore.pass" value="alignmentisfun" />
79     <!-- Key Name -->
80     <property name="jalview.key" value="jalview" />
81     <!-- Key Password -->
82     <property name="jalview.key.pass" value="alignmentisfun" />
83
84     <!-- Don't change anything below here unless you know what you are doing! -->
85     <!-- Url path for WebStart in JNLP file -->
86     <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
87     <!-- Webstart Image - looked for in resources/images -->
88     <property name="WebStartImage" value="JalviewLogo_big.png"/>
89     <!-- J2SE version needed for webstart launch -->
90     <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
91     <property name="j2sev" value="1.7+"/>
92
93     <!-- Permissions for running Java applets and applications. -->
94     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
95     <property name="application.codebase" value="*.jalview.org" />
96     <!-- and allowing the applet to be deployed from any URL -->
97     <!-- note - if you want to make sure LiveConnect works without any warnings, please rebuild and sign your applet jar with your own domain included in the codebase/allowable-codebase properties -->
98     <property name="applet.codebase" value="*.jalview.org *.dundee.ac.uk *" />
99     <property name="applet.caller-codebase" value="${applet.codebase}" />
100
101     <!-- build directory configuration -->
102     <property name="libDir" value="lib" />
103     <property name="resourceDir" value="resources" />
104     <property name="helpDir" value="help" />
105     <property name="docDir" value="doc" />
106     <property name="sourceDir" value="src" />
107     <property name="schemaDir" value="schemas" />
108     <property name="outputDir" value="classes" />
109     <property name="packageDir" value="dist" />
110     <property name="outputJar" value="jalview.jar" />
111     <!-- Jalview Applet JMol Jar Dependency -->
112     <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
113     <property name="varnaJar" value="VARNAv3-91.jar" />
114     <property name="jsoup" value="jsoup-1.8.1.jar" />
115     <property name="jsonSimple" value="json_simple-1.1.jar" />
116     <property name="javaJson" value="java-json.jar" />
117     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
118     <!-- switch to indicate if we should obfuscate jalviewLite -->
119     <!-- <property name="donotobfuscate" value="true"/> -->
120     <!-- switch to exclude associations from generated jnlp files -->
121     <!-- <property name="nojnlpfileassocs" value="true"/> -->
122
123     <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
124     <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
125     <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
126     <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
127     <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
128     <property name="WSInterf" value="MsaWS" />
129     <property name="wsdl.Namespace" value="vamsas" />
130     <property name="wsdl.ClientNS" value="ext.vamsas" />
131     <!-- the class path for building the application -->
132     <path id="build.classpath">
133       <fileset dir="utils">
134         <include name="*.jar" />
135         <include name="**/*.jar" />
136       </fileset>
137       <fileset dir="${libDir}">
138         <include name="*.jar" />
139         <include name="**/*.jar" />
140       </fileset>
141       <fileset dir="${java.home}/lib">
142         <include name="plugin.jar"/>
143       </fileset>
144       <fileset dir="appletlib">
145         <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
146                                 -->
147         <include name="${jmolJar}" />
148         <include name="${varnaJar}" />
149       </fileset>
150
151     </path>
152     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
153     <!-- The Location of the java 1.1.8 jdk -->
154     <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" /> -->
155     <property name="java118.home" value="${java.home}" />
156     <!-- <property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
157                 -->
158     <!-- jre for 1.4 version -->
159     <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
160
161     <!-- the classpath for building the 1.1 applet -->
162     <path id="jalviewlite.deps">
163       <fileset dir="${java118.home}">
164         <include name="lib/classes.zip" />
165       </fileset>
166       <fileset dir="${java.home}/lib">
167         <include name="plugin.jar"/>
168       </fileset>
169       <pathelement location="appletlib/${jmolJar}" />
170       <pathelement location="lib/${varnaJar}" />
171       <pathelement location="lib/${jsoup}" />
172       <pathelement location="lib/${jsonSimple}" />
173       <pathelement location="lib/${javaJson}" />
174       
175     </path>
176     <!-- default location for outputting javadoc -->
177     <property name="javadocDir" value="${packageDir}/javadoc"/>
178   </target>
179
180
181   <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
182   <target name="buildPropertiesFile" depends="init">
183     <tstamp prefix="build">
184       <format property="date" pattern="dd MMMM yyyy" />
185     </tstamp>
186     <properties file="${outputDir}/.build_properties">
187       <header>
188           ---Jalview Build Details---
189         </header>       
190       <property name="VERSION" value="${JALVIEW_VERSION}" />
191       <property name="INSTALLATION" value="${INSTALLATION}" />
192       <property name="BUILD_DATE" value="${build.date}" />
193     </properties>
194   </target>
195
196
197   <target name="clean" depends="init">
198     <!-- not efficient yet. -->
199     <delete dir="${outputDir}" includes="*,**/*"/>
200   </target>
201
202   <target name="distclean" depends="init, clean">
203
204     <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
205     <delete>
206       <fileset dir=".">
207         <include name="${outputJar}" />
208         <include name="#*#" />
209         <include name="#*.*#" />
210         <include name="**/#*#" />
211         <include name="**/#*.*#" />
212         <include name="*~" />
213         <include name="*.*~" />
214         <include name="**/*~" />
215         <include name="**/*.*~" />
216       </fileset>
217     </delete>
218   </target>
219
220   <target name="prepare" depends="init">
221     <mkdir dir="${outputDir}" />
222     <copy todir="${outputDir}">
223       <fileset dir=".">
224         <include name="${docDir}/**/*.*" />
225         <include name="${helpDir}/**/*.*" />
226         <include name="${libDir}/*.jar" />
227       </fileset>
228       <fileset dir="${resourceDir}">
229         <include name="**/*.*" />
230       </fileset>
231     </copy>
232   </target>
233
234   <target name="build" depends="prepare">
235     <!-- not efficient yet. -->
236     <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
237       <exclude name="jalview/*applet*" />
238       <exclude name="jalview/appletgui/**" />
239       <exclude name="com/stevesoft/**" />
240     </javac>
241   </target>
242   <target name="buildindices" depends="init, prepare" unless="help.uptodate">
243     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
244       <arg line="html" />
245     </java>
246   </target>
247
248   <target name="makefulldist" depends="makedist">
249     <copy todir="${packageDir}">
250       <fileset dir="${resourceDir}/images">
251         <include name="${WebStartImage}"/>
252       </fileset>
253     </copy>
254
255     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
256
257     <!-- create a dummy jar which will eventually contain the jnlp template -->
258     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
259       <fileset dir="${packageDir}">
260         <include name="jalview.jar" />
261       </fileset>
262     </jar>
263
264     <mkdir dir="${packageDir}/JNLP-INF"/>
265     <antcall target="writejnlpf">
266       <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP"/>
267       <param name="inih" value="*" />
268       <param name="maxh" value="*"/>
269     </antcall>
270
271     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
272       <fileset dir="${packageDir}">
273         <include name="JNLP-INF"/>
274       </fileset>
275     </jar>
276
277     <antcall target="writejnlpf">
278       <param name="jnlpFile" value="${packageDir}/jalview.jnlp"/>
279       <param name="inih" value="10M" />
280       <param name="maxh" value="256M"/>
281     </antcall>
282
283     <antcall target="writejnlpf">
284       <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp"/>
285       <param name="inih" value="128M" />
286       <param name="maxh" value="512M"/>
287     </antcall>
288
289     <antcall target="writejnlpf">
290       <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp"/>
291       <param name="inih" value="256M" />
292       <param name="maxh" value="1024M"/>
293     </antcall>
294
295     <!-- finally, need to postprocess to add in associations at end of 'information' element 
296                         
297                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
298                 
299                 </xslt>
300                         
301                         
302                         -->
303     <!--
304                                 <association mime-type="application-x/ext-file" extensions="fa"/>
305         <association mime-type="application-x/ext-file" extensions="fasta"/>
306         <association mime-type="application-x/ext-file" extensions="mfa"/>
307         <association mime-type="application-x/ext-file" extensions="fastq"/>
308         <association mime-type="application-x/ext-file" extensions="blc"/>
309         <association mime-type="application-x/ext-file" extensions="msf"/>
310         <association mime-type="application-x/ext-file" extensions="pfam"/>
311         <association mime-type="application-x/ext-file" extensions="aln"/>
312         <association mime-type="application-x/ext-file" extensions="pir"/>
313         <association mime-type="application-x/ext-file" extensions="amsa"/>
314         <association mime-type="application-x/ext-file" extensions="stk"/>
315         <association mime-type="application-x/ext-file" extensions="jar"/>-->
316     <!-- and sign the jars -->
317     <!-- the default keystore details might need to be edited here -->
318     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
319       <fileset dir="${packageDir}">
320         <include name="*.jar" />
321       </fileset>
322     </signjar>
323   </target>
324
325   <target name="runenv" depends="init">
326     <path id="run.classpath">
327       <pathelement location="${outputDir}" />
328       <fileset dir="${outputDir}">
329         <include name="${libDir}/*.jar" />
330       </fileset>
331     </path>
332     <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
333
334     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
335       </echo>
336   </target>
337
338   <target name="-generatejnlpf">
339     <presetdef name="jnlpf">
340       <jnlp codebase="${WebStartLocation}">
341         <information>
342           <title>Jalview</title>
343           <vendor>The Barton Group</vendor>
344           <homepage href="http://www.jalview.org" />
345           <description>Jalview Multiple Alignment Editor</description>
346           <description kind="short">Jalview</description>
347           <icon href="${WebStartImage}" />
348           <offline_allowed />
349         </information>
350         <resources>
351           <j2se version="${j2sev}" initial_heap_size="${inih}" max_heap_size="${maxh}" />
352           <fileset dir="${packageDir}">
353             <include name="jalview.jar" />
354           </fileset>
355           <fileset dir="${packageDir}">
356             <include name="*.jar" />
357             <include name="*_*.jar" />
358             <exclude name="jalview.jar" />
359                 <exclude name="*jnilib.jar"/>
360           </fileset>
361         </resources>
362         <resources os="Mac OS X">
363           <property name="jalview.version" value="${JALVIEW_VERSION}" />
364                 <fileset dir="${packageDir}">
365                         <include name="*quaqua*.jnilib.jar"/>
366                 </fileset>
367         </resources>
368         
369         <application_desc main_class="jalview.bin.Jalview">
370         </application_desc>
371         <security>
372           <all_permissions />
373         </security>
374       </jnlp>
375     </presetdef>
376
377     <jnlpf toFile="${jnlpFile}"/>
378
379   </target>
380
381   <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
382     <echo message="Not adding JNLP File Associations"/>
383   </target>
384
385   <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
386     <replace file="${jnlpFile}">
387       <replacetoken>
388         <![CDATA[</information>]]></replacetoken>
389       <replacevalue>
390         <![CDATA[
391           <association mime-type="application-x/ext-file" extensions="fa" />
392         <association mime-type="application-x/ext-file" extensions="fasta" />
393         <association mime-type="application-x/ext-file" extensions="mfa" />
394         <association mime-type="application-x/ext-file" extensions="fastq" />
395         <association mime-type="application-x/ext-file" extensions="blc" />
396         <association mime-type="application-x/ext-file" extensions="msf" />
397         <association mime-type="application-x/ext-file" extensions="pfam" />
398         <association mime-type="application-x/ext-file" extensions="aln"/>
399         <association mime-type="application-x/ext-file" extensions="pir"/>
400         <association mime-type="application-x/ext-file" extensions="amsa"/>
401         <association mime-type="application-x/ext-file" extensions="stk"/>
402         <association mime-type="application-x/ext-file" extensions="jvp"/>
403       </information>]]></replacevalue>
404   </replace>
405   <echo message="Added file associations to JNLP file"/>
406 </target>
407 <target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
408 </target>
409
410 <target name="buildextclients" depends="init">
411   <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)" validargs="Y,y,n,N" defaultvalue="N" addproperty="doextbuild.response" />
412   <condition property="dontextbuild">
413     <equals arg1="n" arg2="${doextbuild.response}" />
414   </condition>
415   <condition property="dontextbuild">
416     <equals arg1="N" arg2="${doextbuild.response}" />
417   </condition>
418   <fail if="dontextbuild">
419         Build External Client Code process aborted by user. Jalview source is unchanged.
420       </fail>
421   <!-- Currently, this doesn't happen automatically.
422      1. Run WSDL2Java as below, which generates an ext.vamsas +
423      vamsas.<datapackages> fileset.
424      2. refactor ext.vamsas.SpecificserviceWS* to
425      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
426      3. Update the jalview.ws.*WServices classes to reflect the
427      interface type, and all locations of this wsdl type that Jalview
428      might be using.
429
430 -->
431   <path id="axisbuild">
432     <path refid="build.classpath" />
433   </path>
434   <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
435   <move todir="./bak">
436     <fileset dir="${sourceDir}" id="client">
437       <include name="${wsdl.ClientNS}/*.*" />
438     </fileset>
439   </move>
440
441   <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
442     <mappingSet>
443       <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
444       <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
445     </mappingSet>
446   </axis-wsdl2java>
447 </target>
448
449 <target name="makedist" depends="build, buildPropertiesFile, buildindices">
450   <!-- make the package jar if not already existing -->
451   <mkdir dir="${packageDir}" />
452   <!-- clean dir if it already existed -->
453   <delete>
454     <fileset dir="${packageDir}">
455       <include name="*.jar"/>
456     </fileset>
457   </delete>
458   <jar destfile="${packageDir}/${outputJar}" index="true">
459     <manifest>
460       <attribute name="Main-Class" value="jalview.bin.Jalview" />
461       <attribute name="Permissions" value="all-permissions" />
462       <attribute name="Application-Name" value="Jalview Desktop" />
463       <attribute name="Codebase" value="${application.codebase}" />
464     </manifest>
465     <fileset dir="${outputDir}/">
466       <exclude name="cache*/**" />
467       <exclude name="*.jar" />
468       <exclude name="*.jar.*" />
469       <exclude name="**/*.jar" />
470       <exclude name="**/*.jar.*" />
471     </fileset>
472   </jar>
473
474   <copy toDir="${packageDir}" flatten="true">
475     <fileset dir="${outputDir}">
476       <include name="*.jar" />
477       <include name="**/*.jar" />
478     </fileset>
479   </copy>
480 </target>
481
482
483 <!-- jalopy code reformatter -->
484 <target name="sourcescrub" depends="init,build">
485   <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
486     <fileset dir="${sourceDir}">
487       <include name="*.java" />
488       <include name="**/*.java" />
489       <include name="**/**/*.java" />
490     </fileset>
491   </jalopy>
492 </target>
493
494
495
496 <!-- Compile, package and obfuscate Jalview Applet -->
497 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
498
499 <target name="compileApplet" depends="init,clean">
500   <mkdir dir="${outputDir}" />
501   <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" 
502                         classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
503                         excludes="ext/**,MCview/**,org/**,vamsas/**,jalview/ext/paradise/**" />
504 </target>
505
506 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
507   <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
508   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
509   <copy todir="${outputDir}/lang">
510     <fileset dir="${resourceDir}/lang">
511       <include name="**.*"/>
512     </fileset>
513   </copy>
514   <jar destfile="in.jar" index="true">
515     <manifest>
516       <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
517       <attribute name="Application-Name" value="JalviewLite" />
518       <attribute name="Codebase" value="${applet.codebase}" />
519     </manifest>
520     <fileset dir="${outputDir}">
521       <include name="com/**" />
522       <include name="MCview/**" />
523       <include name="jalview/**" />
524       <include name=".build_properties" />
525       <include name="images/idwidth.gif" />
526       <include name="images/link.gif" />
527       <include name="lang/**" />
528     </fileset>
529   </jar>
530 </target>
531 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
532 </target>
533 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
534   <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
535   <delete file="in.jar" />
536 </target>
537 <target name="-obfuscatereally" unless="donotobfuscate">
538
539   <path id="obfuscateDeps.path">
540     <pathelement location="${applet.jre.tools}" />
541     <pathelement location="appletlib/${jmolJar}" />
542     <pathelement location="appletlib/${jsonSimple}" />
543     <pathelement location="appletlib/${javaJson}" />
544   </path>
545   <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
546
547   <proguard>
548     <injar file="in.jar" />
549     <outjar file="${jalviewLiteJar}" />
550     <libraryjar refid="obfuscateDeps.path" />
551     <dontwarn/>
552     <keep access="public" type="class" name="jalview.bin.JalviewLite">
553       <field access="public" />
554       <method access="public" />
555       <constructor access="public" />
556     </keep>
557     <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
558       <field access="public" />
559       <method access="public" />
560       <constructor access="public" />
561     </keep>
562     <!--      -libraryjars "${obfuscateDeps}"
563       -injars      in.jar
564       -outjars     jalviewApplet.jar
565       -keep public class jalview.bin.JalviewLite
566        { public * ; } -->
567   </proguard>
568   <delete file="in.jar" />
569 </target>
570
571 <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
572   <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
573   <delete>
574     <fileset dir="${sourceDir}/jalview/schemabinding/version2">
575       <include name="*.java" />
576       <include name="descriptors/*.java" />
577     </fileset>
578   </delete>
579   <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
580   <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
581   <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
582   <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
583   <!-- 
584                 now build the jalview.binding package with the old schema set
585                 -->
586   <delete>
587     <fileset dir="${sourceDir}/jalview/binding/">
588       <include name="**" />
589     </fileset>
590   </delete>
591   <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
592   <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
593   <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
594 </target>
595 <target name="sourcedist" description="create jalview source distribution" depends="init">
596   <delete file="${source.dist.name}" />
597   <tar destfile="${source.dist.name}" compression="gzip">
598     <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
599       <include name="LICENSE" />
600       <include name="README" />
601       <include name="build.xml" />
602       <include name="jalview-jalopy.xml" />
603       <include name="JalviewApplet.jpx" />
604       <include name="JalviewX.jpx" />
605       <include name="nbbuild.xml"/>
606       <include name="nbproject/genfiles.properties"/>
607       <include name="nbproject/project.properties"/>
608       <include name="nbproject/project.xml"/>
609       <include name="${sourceDir}/*.java" />
610       <include name="${sourceDir}/**/*.java" />
611       <include name="${sourceDir}/**/*.cdr" />
612       <include name="${libDir}/**/*" />
613       <include name="${resourceDir}/**/*" />
614       <include name="${helpDir}/**/*" />
615       <include name="appletlib/${jmolJar}" />
616       <exclude name="**/*locales" />
617       <exclude name="*locales/**" />
618       <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
619       <exclude name="utils/InstallAnywhere/**Build*/**" />
620       <exclude name="utils/InstallAnywhere/**Build*/**" />
621       <exclude name="utils/InstallAnywhere/**locale*" />
622       <exclude name="utils/InstallAnywhere/**locale*/**" />
623       <include name="${schemaDir}/**/*" />
624       <include name="utils/**/*" />
625       <include name="${docDir}/**/*" />
626       <include name="examples/**/*" />
627     </tarfileset>
628   </tar>
629 </target>
630 <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
631   <copy todir="${packageDir}/examples">
632     <fileset dir="examples">
633       <include name="**/*"/>
634       <include name="javascript/*"/>
635       <include name="jmol/*"/>
636     </fileset>
637     <fileset dir=".">
638       <include name="${jalviewLiteJar}" />
639     </fileset>
640     <fileset dir="appletlib">
641       <include name="**/*"/>
642     </fileset>
643   </copy>
644   <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
645   <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}"/>
646   <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}"/>
647   <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
648     <manifest>
649       <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)"/>
650       <!--          <attribute name="Permissions" value="sandbox" /> -->
651       <!--<attribute name="Trusted-Lib" value="true" /> -->
652       <attribute name="Codebase" value="${applet.codebase}"/>
653       <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
654     </manifest>
655   </jar>
656   <signjar sigalg="SHA1WithRSA" storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
657     <fileset dir="${packageDir}/examples">
658       <include name="*.jar" />
659     </fileset>
660   </signjar>
661   <presetdef name="ap_applet.jar">
662     <!-- build a signed applet with 'all-permissions' - 
663                           Needs 'param name="permissions' value="all-permissions"' in applet tag
664                           JalviewLite+JmolApplet linked sequence/structure fails
665                           Mixed code warnings are raised
666                           -->
667     <jar update="true" index="true">
668       <manifest>
669         <attribute name="Application-Name" value="JalviewLite" />
670         <attribute name="Permissions" value="all-permissions" />
671         <attribute name="Codebase" value="${applet.codebase}" />
672         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
673         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
674       </manifest>
675     </jar>
676   </presetdef>
677   <presetdef name="applet.jar">
678     <!-- build signed applet with sandbox permissions -
679                           Needs 'param name="permissions' value="sandbox"' in applet tag
680                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
681                         -->
682
683     <jar update="true" index="true">
684       <manifest>
685         <attribute name="Application-Name" value="JalviewLite" />
686         <attribute name="Permissions" value="sandbox" />
687         <attribute name="Codebase" value="${applet.codebase}" />
688         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
689         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
690       </manifest>
691     </jar>
692   </presetdef>
693   <presetdef name="tl_applet.jar">
694     <!-- build signed applet with trusted library/trusted permissions -
695                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
696                                j1.7_45:
697                                No mixed code warnings raised 
698                                Jmol/JalviewLite sequence/structure example doesn't link structures
699                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
700                                
701                               -->
702
703     <jar update="true" index="true">
704       <manifest>
705         <attribute name="Application-Name" value="JalviewLite" />
706         <attribute name="Permissions" value="all-permissions" />
707         <attribute name="Codebase" value="${applet.codebase}" />
708         <attribute name="Trusted-Only" value="true" />
709         <attribute name="Trusted-Library" value="true" />
710       </manifest>
711     </jar>
712   </presetdef>
713   <presetdef name="to_applet.jar">
714     <!-- not fully test variant (yet) -->
715     <jar update="true" index="true">
716       <manifest>
717         <attribute name="Application-Name" value="JalviewLite" />
718         <attribute name="Permissions" value="all-permissions" />
719         <attribute name="Codebase" value="${applet.codebase}" />
720         <attribute name="Trusted-Only" value="true" />
721       </manifest>
722     </jar>
723   </presetdef>
724   <!-- create differently privileged artefacts -->
725   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
726   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true"/>
727   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true"/>
728   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true"/>
729   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
730   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}"/>
731   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/ap_${javaJson}"/>
732   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/ap_${jsonSimple}"/>
733   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
734   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
735   <ap_applet.jar jarfile="${packageDir}/examples/ap_${javaJson}" />
736   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jsonSimple}" />
737   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
738   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
739   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/tl_${javaJson}" />
740   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/tl_${jsonSimple}" />
741   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
742   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
743   <tl_applet.jar jarfile="${packageDir}/examples/tl_${javaJson}" />
744   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jsonSimple}" />
745   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
746   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
747   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/to_${javaJson}" />
748   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/to_${jsonSimple}" />
749   <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
750   <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
751   <to_applet.jar jarfile="${packageDir}/examples/to_${javaJson}" />
752   <to_applet.jar jarfile="${packageDir}/examples/to_${jsonSimple}" />
753   <!-- finally, create manifest for original jars -->
754   <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
755   <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
756   <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
757   <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
758
759   <!-- todo - write examples/downloads for alternate versions of the applet -->
760   <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
761
762     <fileset dir="${packageDir}/examples">
763       <exclude name="u_*.jar"/>
764       <include name="${jalviewLiteJar}" />
765       <include name="${jmolJar}" />
766       <include name="${javaJson}" />
767       <include name="${jsonSimple}" />
768       <include name="to_${jalviewLiteJar}" />
769       <include name="to_${jmolJar}" />
770       <include name="to_${javaJson}" />
771       <include name="to_${jsonSimple}" />
772       <include name="tl_${jalviewLiteJar}" />
773       <include name="tl_${jmolJar}" />
774       <include name="tl_${javaJson}" />
775       <include name="tl_${jsonSimple}" />
776       <include name="ap_${jalviewLiteJar}" />
777       <include name="ap_${jmolJar}" />
778       <include name="ap_${javaJson}" />
779       <include name="ap_${jsonSimple}" />
780     </fileset>
781   </signjar>
782   <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
783   <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
784         <!-- finally, replace any launchApp servlet tags with a version specification -->
785         <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}&quot;">
786                 <replacetoken><![CDATA[http://www.jalview.org/services/launchApp"]]></replacetoken>
787                 <fileset dir="${packageDir}/examples">
788                         <include name="**/*.html"/>
789                 </fileset>
790         </replace>
791         <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}'">
792                 <replacetoken><![CDATA[http://www.jalview.org/services/launchApp']]></replacetoken>
793                 <fileset dir="${packageDir}/examples">
794                         <include name="**/*.html"/>
795                 </fileset>
796         </replace>
797
798 </target>
799 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
800   <javadoc destdir="${javadocDir}">
801     <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
802     </packageset>
803   </javadoc>
804 </target>
805 </project>