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