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