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