regress fix on JAL-690 - insert association elements with replace task
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
4  * Copyright (C) 2014 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   <!-- we use jalopy to format our sources -->
22   <taskdef name="jalopy" 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" />
76     <!-- 2.4 (VAMSAS)" -->
77     <!-- Include debugging information in javac true or false -->
78     <property name="javac.debug" value="true" />
79
80     <!-- JarSigner Key Store for Webstart Distribution -->
81     <property name="jalview.keystore" value="./keys/.keystore" />
82     <!-- Keystore Password -->
83     <property name="jalview.keystore.pass" value="alignmentisfun" />
84     <!-- Key Name -->
85     <property name="jalview.key" value="jalview" />
86     <!-- Key Password -->
87     <property name="jalview.key.pass" value="alignmentisfun" />
88
89
90
91     <!-- Don't change anything below here unless you know what you are doing! -->
92     <!-- Url path for WebStart in JNLP file -->
93     <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
94     <!-- Webstart Image - looked for in resources/images -->
95     <property name="WebStartImage" value="JalviewLogo_big.png"/>
96     <!-- J2SE version needed for webstart launch -->
97     <property name="j2sev" value="1.6+"/>
98
99     <!-- Permissions for running Java applets and applications. -->
100     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
101     <property name="application.codebase" value="*.jalview.org" />
102     <!-- and allowing the applet to be deployed from any URL -->
103     <property name="applet.codebase" value="*" />
104     <property name="applet.caller-codebase" value="${applet.codebase}" />
105
106     <!-- build directory configuration -->
107     <property name="libDir" value="lib" />
108     <property name="resourceDir" value="resources" />
109     <property name="helpDir" value="help" />
110     <property name="docDir" value="doc" />
111     <property name="sourceDir" value="src" />
112     <property name="schemaDir" value="schemas" />
113     <property name="outputDir" value="classes" />
114     <property name="packageDir" value="dist" />
115     <property name="outputJar" value="jalview.jar" />
116     <!-- Jalview Applet JMol Jar Dependency -->
117     <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
118     <property name="jalviewLiteJar" value="jalviewApplet.jar" />
119     <!-- switch to indicate if we should obfuscate jalviewLite -->
120     <!--<property name="donotobfuscate" value="true"/> -->
121
122     <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
123     <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
124     <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
125     <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
126     <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
127     <property name="WSInterf" value="MsaWS" />
128     <property name="wsdl.Namespace" value="vamsas" />
129     <property name="wsdl.ClientNS" value="ext.vamsas" />
130     <!-- the class path for building the application -->
131     <path id="build.classpath">
132       <fileset dir="utils">
133         <include name="*.jar" />
134         <include name="**/*.jar" />
135       </fileset>
136       <fileset dir="${libDir}">
137         <include name="*.jar" />
138         <include name="**/*.jar" />
139       </fileset>
140       <fileset dir="${java.home}/lib">
141         <include name="plugin.jar"/>
142       </fileset>
143       <fileset dir="appletlib">
144         <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
145                                 -->
146         <include name="${jmolJar}" />
147       </fileset>
148
149     </path>
150     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
151     <!-- The Location of the java 1.1.8 jdk -->
152     <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
153                 -->
154     <property name="java118.home" value="${java.home}" />
155     <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
156                 -->
157     <!-- jre for 1.4 version -->
158     <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
159
160     <!-- the classpath for building the 1.1 applet -->
161     <path id="jalviewlite.deps">
162       <fileset dir="${java118.home}">
163         <include name="lib/classes.zip" />
164       </fileset>
165       <fileset dir="${java.home}/lib">
166         <include name="plugin.jar"/>
167       </fileset>
168       <pathelement location="appletlib/${jmolJar}" />
169     </path>
170     <!-- default location for outputting javadoc -->
171     <property name="javadocDir" value="${packageDir}/javadoc"/>
172   </target>
173
174
175   <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
176   <target name="buildPropertiesFile" depends="init">
177     <tstamp prefix="build">
178       <format property="date" pattern="dd MMMM yyyy" />
179     </tstamp>
180     <properties file="${outputDir}/.build_properties">
181       <header>
182           ---Jalview Build Details---
183         </header>
184       <property name="VERSION" value="${JALVIEW_VERSION}" />
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   <target name="writejnlpf">
331     <presetdef name="jnlpf">
332       <jnlp codebase="${WebStartLocation}">
333         <information>
334           <title>Jalview</title>
335           <vendor>The Barton Group</vendor>
336           <homepage href="http://www.jalview.org" />
337           <description>Jalview Multiple Alignment Editor</description>
338           <description kind="short">Jalview</description>
339           <icon href="${WebStartImage}" />
340           <offline_allowed />
341         </information>
342         <resources>
343           <j2se version="${j2sev}" initial_heap_size="${inih}" max_heap_size="${maxh}" />
344           <fileset dir="${packageDir}">
345             <include name="jalview.jar" />
346           </fileset>
347           <fileset dir="${packageDir}">
348             <include name="*.jar" />
349             <include name="*_*.jar" />
350             <exclude name="jalview.jar" />
351           </fileset>
352           <property name="jalview.version" value="${JALVIEW_VERSION}" />
353         </resources>
354         <application_desc main_class="jalview.bin.Jalview">
355         </application_desc>
356         <security>
357           <all_permissions />
358         </security>
359       </jnlp>
360     </presetdef>
361
362     <jnlpf toFile="${jnlpFile}"/>
363     <replace file="${jnlpFile}">
364       <replacetoken><![CDATA[</information>]]></replacetoken>
365       <replacevalue><![CDATA[
366         <association mime-type="application-x/ext-file" extensions="fa" />
367         <association mime-type="application-x/ext-file" extensions="fasta" />
368         <association mime-type="application-x/ext-file" extensions="mfa" />
369         <association mime-type="application-x/ext-file" extensions="fastq" />
370         <association mime-type="application-x/ext-file" extensions="blc" />
371         <association mime-type="application-x/ext-file" extensions="msf" />
372         <association mime-type="application-x/ext-file" extensions="pfam" />
373         <association mime-type="application-x/ext-file" extensions="aln"/>
374         <association mime-type="application-x/ext-file" extensions="pir"/>
375         <association mime-type="application-x/ext-file" extensions="amsa"/>
376         <association mime-type="application-x/ext-file" extensions="stk"/>
377         <association mime-type="application-x/ext-file" extensions="jvp"/>
378       </information>]]></replacevalue>
379     </replace>
380   </target>
381   <target name="buildextclients" depends="init">
382     <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" />
383     <condition property="dontextbuild">
384       <equals arg1="n" arg2="${doextbuild.response}" />
385     </condition>
386     <condition property="dontextbuild">
387       <equals arg1="N" arg2="${doextbuild.response}" />
388     </condition>
389     <fail if="dontextbuild">
390         Build External Client Code process aborted by user. Jalview source is unchanged.
391       </fail>
392     <!-- Currently, this doesn't happen automatically.
393      1. Run WSDL2Java as below, which generates an ext.vamsas +
394      vamsas.<datapackages> fileset.
395      2. refactor ext.vamsas.SpecificserviceWS* to
396      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
397      3. Update the jalview.ws.*WServices classes to reflect the
398      interface type, and all locations of this wsdl type that Jalview
399      might be using.
400
401 -->
402     <path id="axisbuild">
403       <path refid="build.classpath" />
404     </path>
405     <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
406     <move todir="./bak">
407       <fileset dir="${sourceDir}" id="client">
408         <include name="${wsdl.ClientNS}/*.*" />
409       </fileset>
410     </move>
411
412     <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
413       <mappingSet>
414         <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
415         <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
416       </mappingSet>
417     </axis-wsdl2java>
418   </target>
419
420   <target name="makedist" depends="build, buildPropertiesFile, buildindices">
421     <!-- make the package jar if not already existing -->
422     <mkdir dir="${packageDir}" />
423     <!-- clean dir if it already existed -->
424     <delete>
425       <fileset dir="${packageDir}">
426         <include name="*.jar"/>
427       </fileset>
428     </delete>
429     <jar destfile="${packageDir}/${outputJar}" index="true">
430       <manifest>
431         <attribute name="Main-Class" value="jalview.bin.Jalview" />
432         <attribute name="Permissions" value="all-permissions" />
433         <attribute name="Application-Name" value="Jalview Desktop" />
434         <attribute name="Codebase" value="${application.codebase}" />
435       </manifest>
436       <fileset dir="${outputDir}/">
437         <exclude name="cache*/**" />
438         <exclude name="*.jar" />
439         <exclude name="*.jar.*" />
440         <exclude name="**/*.jar" />
441         <exclude name="**/*.jar.*" />
442       </fileset>
443     </jar>
444
445     <copy toDir="${packageDir}" flatten="true">
446       <fileset dir="${outputDir}">
447         <include name="*.jar" />
448         <include name="**/*.jar" />
449       </fileset>
450     </copy>
451   </target>
452
453
454   <!-- jalopy code reformatter -->
455   <target name="sourcescrub" depends="init,build">
456     <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
457       <fileset dir="${sourceDir}">
458         <include name="*.java" />
459         <include name="**/*.java" />
460         <include name="**/**/*.java" />
461       </fileset>
462     </jalopy>
463   </target>
464
465
466
467   <!-- Compile, package and obfuscate Jalview Applet -->
468   <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
469
470   <target name="compileApplet" depends="init,clean">
471     <mkdir dir="${outputDir}" />
472     <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" 
473                         classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
474                         excludes="ext/**,MCview/**,org/**,vamsas/**" />
475   </target>
476
477   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
478     <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
479     <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
480     <copy todir="${outputDir}/lang">
481       <fileset dir="${resourceDir}/lang">
482         <include name="**.*"/>
483       </fileset>
484     </copy>
485     <jar destfile="in.jar" index="true">
486       <manifest>
487         <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
488         <attribute name="Application-Name" value="JalviewLite" />
489         <attribute name="Codebase" value="${applet.codebase}" />
490       </manifest>
491       <fileset dir="${outputDir}">
492         <include name="com/**" />
493         <include name="MCview/**" />
494         <include name="jalview/**" />
495         <include name=".build_properties" />
496         <include name="images/idwidth.gif" />
497         <include name="images/link.gif" />
498         <include name="lang/**" />
499       </fileset>
500     </jar>
501   </target>
502   <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
503   </target>
504   <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
505     <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
506     <delete file="in.jar" />
507   </target>
508   <target name="-obfuscatereally" unless="donotobfuscate">
509
510     <path id="obfuscateDeps.path">
511       <pathelement location="${applet.jre.tools}" />
512       <pathelement location="appletlib/${jmolJar}" />
513     </path>
514     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
515
516     <proguard>
517       <injar file="in.jar" />
518       <outjar file="${jalviewLiteJar}" />
519       <libraryjar refid="obfuscateDeps.path" />
520       <dontwarn/>
521       <keep access="public" type="class" name="jalview.bin.JalviewLite">
522         <field access="public" />
523         <method access="public" />
524         <constructor access="public" />
525       </keep>
526       <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
527         <field access="public" />
528         <method access="public" />
529         <constructor access="public" />
530       </keep>
531       <!--      -libraryjars "${obfuscateDeps}"
532       -injars      in.jar
533       -outjars     jalviewApplet.jar
534       -keep public class jalview.bin.JalviewLite
535        { public * ; } -->
536     </proguard>
537     <delete file="in.jar" />
538   </target>
539
540   <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
541     <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
542     <delete>
543       <fileset dir="${sourceDir}/jalview/schemabinding/version2">
544         <include name="*.java" />
545         <include name="descriptors/*.java" />
546       </fileset>
547     </delete>
548     <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
549     <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
550     <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
551     <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
552     <!-- 
553                 now build the jalview.binding package with the old schema set
554                 -->
555     <delete>
556       <fileset dir="${sourceDir}/jalview/binding/">
557         <include name="**" />
558       </fileset>
559     </delete>
560     <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
561     <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
562     <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
563   </target>
564   <target name="sourcedist" description="create jalview source distribution" depends="init">
565     <delete file="${source.dist.name}" />
566     <tar destfile="${source.dist.name}" compression="gzip">
567       <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
568         <include name="LICENSE" />
569         <include name="README" />
570         <include name="build.xml" />
571         <include name="jalview-jalopy.xml" />
572         <include name="JalviewApplet.jpx" />
573         <include name="JalviewX.jpx" />
574         <include name="nbbuild.xml"/>
575         <include name="nbproject/genfiles.properties"/>
576         <include name="nbproject/project.properties"/>
577         <include name="nbproject/project.xml"/>
578         <include name="${sourceDir}/*.java" />
579         <include name="${sourceDir}/**/*.java" />
580         <include name="${sourceDir}/**/*.cdr" />
581         <include name="${libDir}/**/*" />
582         <include name="${resourceDir}/**/*" />
583         <include name="${helpDir}/**/*" />
584         <include name="appletlib/${jmolJar}" />
585         <exclude name="**/*locales" />
586         <exclude name="*locales/**" />
587         <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
588         <exclude name="utils/InstallAnywhere/**Build*/**" />
589         <exclude name="utils/InstallAnywhere/**Build*/**" />
590         <exclude name="utils/InstallAnywhere/**locale*" />
591         <exclude name="utils/InstallAnywhere/**locale*/**" />
592         <include name="${schemaDir}/**/*" />
593         <include name="utils/**/*" />
594         <include name="${docDir}/**/*" />
595         <include name="examples/**/*" />
596       </tarfileset>
597     </tar>
598   </target>
599   <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
600     <copy todir="${packageDir}/examples">
601       <fileset dir="examples">
602         <include name="**/*"/>
603         <include name="javascript/*"/>
604         <include name="jmol/*"/>
605       </fileset>
606       <fileset dir=".">
607         <include name="${jalviewLiteJar}" />
608       </fileset>
609       <fileset dir="appletlib">
610         <include name="**/*"/>
611       </fileset>
612     </copy>
613     <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
614     <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
615       <manifest>
616         <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)"/>
617         <!--          <attribute name="Permissions" value="sandbox" /> -->
618         <!--<attribute name="Trusted-Lib" value="true" /> -->
619         <attribute name="Codebase" value="${applet.codebase}"/>
620         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
621       </manifest>
622     </jar>
623     <signjar sigalg="SHA1WithRSA" storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
624       <fileset dir="${packageDir}/examples">
625         <include name="*.jar" />
626       </fileset>
627     </signjar>
628     <presetdef name="ap_applet.jar">
629       <!-- build a signed applet with 'all-permissions' - 
630                           Needs 'param name="permissions' value="all-permissions"' in applet tag
631                           JalviewLite+JmolApplet linked sequence/structure fails
632                           Mixed code warnings are raised
633                           -->
634       <jar update="true" index="true">
635         <manifest>
636           <attribute name="Application-Name" value="JalviewLite" />
637           <attribute name="Permissions" value="all-permissions" />
638           <attribute name="Codebase" value="${applet.codebase}" />
639           <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
640           <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
641         </manifest>
642       </jar>
643     </presetdef>
644     <presetdef name="applet.jar">
645       <!-- build signed applet with sandbox permissions -
646                           Needs 'param name="permissions' value="sandbox"' in applet tag
647                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
648                         -->
649
650       <jar update="true" index="true">
651         <manifest>
652           <attribute name="Application-Name" value="JalviewLite" />
653           <attribute name="Permissions" value="sandbox" />
654           <attribute name="Codebase" value="${applet.codebase}" />
655           <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
656           <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
657         </manifest>
658       </jar>
659     </presetdef>
660     <presetdef name="tl_applet.jar">
661       <!-- build signed applet with trusted library/trusted permissions -
662                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
663                                j1.7_45:
664                                No mixed code warnings raised 
665                                Jmol/JalviewLite sequence/structure example doesn't link structures
666                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
667                                
668                               -->
669
670       <jar update="true" index="true">
671         <manifest>
672           <attribute name="Application-Name" value="JalviewLite" />
673           <attribute name="Permissions" value="all-permissions" />
674           <attribute name="Codebase" value="${applet.codebase}" />
675           <attribute name="Trusted-Only" value="true" />
676           <attribute name="Trusted-Library" value="true" />
677         </manifest>
678       </jar>
679     </presetdef>
680     <presetdef name="to_applet.jar">
681       <!-- not fully test variant (yet) -->
682       <jar update="true" index="true">
683         <manifest>
684           <attribute name="Application-Name" value="JalviewLite" />
685           <attribute name="Permissions" value="all-permissions" />
686           <attribute name="Codebase" value="${applet.codebase}" />
687           <attribute name="Trusted-Only" value="true" />
688         </manifest>
689       </jar>
690     </presetdef>
691     <!-- create differently privileged artefacts -->
692     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
693     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true"/>
694     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
695     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}"/>
696     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
697     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
698     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
699     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
700     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
701     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
702     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
703     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
704     <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
705     <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
706     <!-- finally, create manifest for original jars -->
707     <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
708     <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
709
710     <!-- todo - write examples/downloads for alternate versions of the applet -->
711     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
712
713       <fileset dir="${packageDir}/examples">
714         <exclude name="u_*.jar"/>
715         <include name="${jalviewLiteJar}" />
716         <include name="${jmolJar}" />
717         <include name="to_${jalviewLiteJar}" />
718         <include name="to_${jmolJar}" />
719         <include name="tl_${jalviewLiteJar}" />
720         <include name="tl_${jmolJar}" />
721         <include name="ap_${jalviewLiteJar}" />
722         <include name="ap_${jmolJar}" />
723       </fileset>
724     </signjar>
725     <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
726     <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
727   </target>
728   <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
729     <javadoc destdir="${javadocDir}">
730       <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
731       </packageset>
732     </javadoc>
733   </target>
734 </project>