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