31419c8ad24a78cb7661b9923f8c4c523f6bf2c9
[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 <!-- Anne's version needs 1.7 - should rebuild VARNA to java 1.6 for release -->
98                 <property name="j2sev" value="1.7+"/>
99
100     <!-- Permissions for running Java applets and applications. -->
101     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
102     <property name="application.codebase" value="*.jalview.org" />
103     <!-- and allowing the applet to be deployed from any URL -->
104     <property name="applet.codebase" value="*" />
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="varnaJar" value="VARNAv3-9.jar" />
120                 <property name="jalviewLiteJar" value="jalviewApplet.jar" />
121                 <!-- switch to indicate if we should obfuscate jalviewLite -->
122                 <!--<property name="donotobfuscate" value="true"/> -->
123
124                 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
125                 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
126                 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
127                 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
128                 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
129                 <property name="WSInterf" value="MsaWS" />
130                 <property name="wsdl.Namespace" value="vamsas" />
131                 <property name="wsdl.ClientNS" value="ext.vamsas" />
132                 <!-- the class path for building the application -->
133                 <path id="build.classpath">
134                         <fileset dir="utils">
135                                 <include name="*.jar" />
136                                 <include name="**/*.jar" />
137                         </fileset>
138                         <fileset dir="${libDir}">
139                                 <include name="*.jar" />
140                                 <include name="**/*.jar" />
141                         </fileset>
142                         <fileset dir="${java.home}/lib">
143                                 <include name="plugin.jar"/>
144                         </fileset>
145                         <fileset dir="appletlib">
146                                 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
147                                 -->
148                                 <include name="${jmolJar}" />
149                                 <include name="${varnaJar}" />
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                 --><!-- jre for 1.4 version -->
160                 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
161                 
162                 <!-- the classpath for building the 1.1 applet -->
163                 <path id="jalviewlite.deps">
164                         <fileset dir="${java118.home}">
165                                 <include name="lib/classes.zip" />
166                         </fileset>
167                         <fileset dir="${java.home}/lib">
168                                 <include name="plugin.jar"/>
169                         </fileset>
170                         <pathelement location="appletlib/${jmolJar}" />
171       <pathelement location="lib/${varnaJar}" />
172
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   <target name="writejnlpf">
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   </target>
368         <target name="buildextclients" depends="init">
369                 <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" />
370                 <condition property="dontextbuild">
371                         <equals arg1="n" arg2="${doextbuild.response}" />
372                 </condition>
373                 <condition property="dontextbuild">
374                         <equals arg1="N" arg2="${doextbuild.response}" />
375                 </condition>
376                 <fail if="dontextbuild">
377         Build External Client Code process aborted by user. Jalview source is unchanged.
378       </fail>
379                 <!-- Currently, this doesn't happen automatically.
380      1. Run WSDL2Java as below, which generates an ext.vamsas +
381      vamsas.<datapackages> fileset.
382      2. refactor ext.vamsas.SpecificserviceWS* to
383      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
384      3. Update the jalview.ws.*WServices classes to reflect the
385      interface type, and all locations of this wsdl type that Jalview
386      might be using.
387
388 -->
389                 <path id="axisbuild">
390                         <path refid="build.classpath" />
391                 </path>
392                 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
393                 <move todir="./bak">
394                         <fileset dir="${sourceDir}" id="client">
395                                 <include name="${wsdl.ClientNS}/*.*" />
396                         </fileset>
397                 </move>
398
399                 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
400                         <mappingSet>
401                                 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
402                                 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
403                         </mappingSet>
404                 </axis-wsdl2java>
405         </target>
406
407         <target name="makedist" depends="build, buildPropertiesFile, buildindices">
408                 <!-- make the package jar if not already existing -->
409                 <mkdir dir="${packageDir}" />
410                 <!-- clean dir if it already existed -->
411                 <delete>
412                         <fileset dir="${packageDir}">
413                                 <include name="*.jar"/>
414                         </fileset>
415                 </delete>
416                 <jar destfile="${packageDir}/${outputJar}" index="true">
417                         <manifest>
418                                 <attribute name="Main-Class" value="jalview.bin.Jalview" />
419         <attribute name="Permissions" value="all-permissions" />
420         <attribute name="Application-Name" value="Jalview Desktop" />
421         <attribute name="Codebase" value="${application.codebase}" />
422                         </manifest>
423                         <fileset dir="${outputDir}/">
424                                 <exclude name="cache*/**" />
425                                 <exclude name="*.jar" />
426                                 <exclude name="*.jar.*" />
427                                 <exclude name="**/*.jar" />
428                                 <exclude name="**/*.jar.*" />
429                         </fileset>
430                 </jar>
431
432                 <copy toDir="${packageDir}" flatten="true">
433                         <fileset dir="${outputDir}">
434                                 <include name="*.jar" />
435                                 <include name="**/*.jar" />
436                         </fileset>
437                 </copy>
438         </target>
439
440
441         <!-- jalopy code reformatter -->
442         <target name="sourcescrub" depends="init,build">
443                 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
444                         <fileset dir="${sourceDir}">
445                                 <include name="*.java" />
446                                 <include name="**/*.java" />
447                                 <include name="**/**/*.java" />
448                         </fileset>
449                 </jalopy>
450         </target>
451
452
453
454         <!-- Compile, package and obfuscate Jalview Applet -->
455         <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
456
457         <target name="compileApplet" depends="init,clean">
458                 <mkdir dir="${outputDir}" />
459                 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" 
460                         classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
461                         excludes="ext/**,MCview/**,org/**,vamsas/**,jalview/ext/paradise/**" />
462         </target>
463
464         <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
465                 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
466                 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
467                 <copy todir="${outputDir}/lang">
468                         <fileset dir="${resourceDir}/lang"><include name="**.*"/></fileset></copy>
469                 <jar destfile="in.jar" index="true">
470                         <manifest>
471                                 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
472                 <attribute name="Application-Name" value="JalviewLite" />
473             <attribute name="Codebase" value="${applet.codebase}" />
474                         </manifest>
475                         <fileset dir="${outputDir}">
476                                 <include name="com/**" />
477                                 <include name="MCview/**" />
478                                 <include name="jalview/**" />
479                                 <include name=".build_properties" />
480                                 <include name="images/idwidth.gif" />
481                                 <include name="images/link.gif" />
482                                 <include name="lang/**" />
483                         </fileset>
484                 </jar>
485         </target>
486         <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
487         </target>
488         <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
489                 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
490                 <delete file="in.jar" />
491         </target>
492         <target name="-obfuscatereally" unless="donotobfuscate">
493
494                 <path id="obfuscateDeps.path">
495                         <pathelement location="${applet.jre.tools}" />
496                         <pathelement location="appletlib/${jmolJar}" />
497                 </path>
498                 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
499
500                 <proguard>
501                         <injar file="in.jar" />
502                         <outjar file="${jalviewLiteJar}" />
503                         <libraryjar refid="obfuscateDeps.path" />
504                         <dontwarn/>
505                         <keep access="public" type="class" name="jalview.bin.JalviewLite">
506                                 <field access="public" />
507                                 <method access="public" />
508                                 <constructor access="public" />
509                         </keep>
510                         <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
511                                 <field access="public" />
512                                 <method access="public" />
513                                 <constructor access="public" />
514                         </keep>
515                         <!--      -libraryjars "${obfuscateDeps}"
516       -injars      in.jar
517       -outjars     jalviewApplet.jar
518       -keep public class jalview.bin.JalviewLite
519        { public * ; } -->
520                 </proguard>
521                 <delete file="in.jar" />
522         </target>
523
524         <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
525                 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
526                 <delete>
527                         <fileset dir="${sourceDir}/jalview/schemabinding/version2">
528                                 <include name="*.java" />
529                                 <include name="descriptors/*.java" />
530                         </fileset>
531                 </delete>
532                 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
533                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
534                 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
535                 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
536                 <!-- 
537                 now build the jalview.binding package with the old schema set
538                 -->
539                 <delete>
540                         <fileset dir="${sourceDir}/jalview/binding/">
541                                 <include name="**" />
542                         </fileset>
543                 </delete>
544                 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
545                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
546                 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
547         </target>
548         <target name="sourcedist" description="create jalview source distribution" depends="init">
549                 <delete file="${source.dist.name}" />
550                 <tar destfile="${source.dist.name}" compression="gzip">
551                         <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
552                                 <include name="LICENSE" />
553                                 <include name="README" />
554                                 <include name="build.xml" />
555                                 <include name="jalview-jalopy.xml" />
556                                 <include name="JalviewApplet.jpx" />
557                                 <include name="JalviewX.jpx" />
558                                 <include name="nbbuild.xml"/>
559                                 <include name="nbproject/genfiles.properties"/>
560         <include name="nbproject/project.properties"/>
561         <include name="nbproject/project.xml"/>
562                                 <include name="${sourceDir}/*.java" />
563                                 <include name="${sourceDir}/**/*.java" />
564                                 <include name="${sourceDir}/**/*.cdr" />
565                                 <include name="${libDir}/**/*" />
566                                 <include name="${resourceDir}/**/*" />
567                                 <include name="${helpDir}/**/*" />
568                                 <include name="appletlib/${jmolJar}" />
569                                 <exclude name="**/*locales" />
570                                 <exclude name="*locales/**" />
571                                 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
572                                 <exclude name="utils/InstallAnywhere/**Build*/**" />
573                                 <exclude name="utils/InstallAnywhere/**Build*/**" />
574                                 <exclude name="utils/InstallAnywhere/**locale*" />
575                                 <exclude name="utils/InstallAnywhere/**locale*/**" />
576                                 <include name="${schemaDir}/**/*" />
577                                 <include name="utils/**/*" />
578                                 <include name="${docDir}/**/*" />
579                                 <include name="examples/**/*" />
580                         </tarfileset>
581                 </tar>
582         </target>
583         <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
584           <copy todir="${packageDir}/examples">
585           <fileset dir="examples">
586                 <include name="**/*"/>
587                 <include name="javascript/*"/>
588       <include name="jmol/*"/>
589           </fileset>
590                 <fileset dir=".">
591         <include name="${jalviewLiteJar}" />
592                         </fileset>
593                 <fileset dir="appletlib">
594                       <include name="**/*"/>
595                         </fileset>
596           </copy>
597             <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}"/>
598             <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
599                 <manifest>
600                 <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)"/>
601                 <!--          <attribute name="Permissions" value="sandbox" /> -->
602                 <!--<attribute name="Trusted-Lib" value="true" /> -->
603                 <attribute name="Codebase" value="${applet.codebase}"/>
604                 <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
605                   </manifest>
606                 </jar>
607     <signjar sigalg="SHA1WithRSA" storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
608       <fileset dir="${packageDir}/examples">
609         <include name="*.jar" />
610       </fileset>
611     </signjar>
612     <presetdef name="ap_applet.jar">
613       <!-- build a signed applet with 'all-permissions' - 
614                           Needs 'param name="permissions' value="all-permissions"' in applet tag
615                           JalviewLite+JmolApplet linked sequence/structure fails
616                           Mixed code warnings are raised
617                           -->
618       <jar update="true" index="true">
619         <manifest>
620           <attribute name="Application-Name" value="JalviewLite" />
621           <attribute name="Permissions" value="all-permissions" />
622           <attribute name="Codebase" value="${applet.codebase}" />
623           <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
624           <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
625         </manifest>
626       </jar>
627     </presetdef>
628     <presetdef name="applet.jar">
629       <!-- build signed applet with sandbox permissions -
630                           Needs 'param name="permissions' value="sandbox"' in applet tag
631                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
632                         -->
633
634       <jar update="true" index="true">
635         <manifest>
636           <attribute name="Application-Name" value="JalviewLite" />
637           <attribute name="Permissions" value="sandbox" />
638           <attribute name="Codebase" value="${applet.codebase}" />
639           <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
640           <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
641         </manifest>
642       </jar>
643     </presetdef>
644     <presetdef name="tl_applet.jar">
645       <!-- build signed applet with trusted library/trusted permissions -
646                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
647                                j1.7_45:
648                                No mixed code warnings raised 
649                                Jmol/JalviewLite sequence/structure example doesn't link structures
650                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
651                                
652                               -->
653
654       <jar update="true" index="true">
655         <manifest>
656           <attribute name="Application-Name" value="JalviewLite" />
657           <attribute name="Permissions" value="all-permissions" />
658           <attribute name="Codebase" value="${applet.codebase}" />
659           <attribute name="Trusted-Only" value="true" />
660           <attribute name="Trusted-Library" value="true" />
661         </manifest>
662       </jar>
663     </presetdef>
664     <presetdef name="to_applet.jar">
665       <!-- not fully test variant (yet) -->
666       <jar update="true" index="true">
667         <manifest>
668           <attribute name="Application-Name" value="JalviewLite" />
669           <attribute name="Permissions" value="all-permissions" />
670           <attribute name="Codebase" value="${applet.codebase}" />
671           <attribute name="Trusted-Only" value="true" />
672         </manifest>
673       </jar>
674     </presetdef>
675     <!-- create differently privileged artefacts -->
676     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
677     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true"/>
678     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
679     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}"/>
680     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
681     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
682     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
683     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
684     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
685     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
686     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
687     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
688     <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
689     <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
690     <!-- finally, create manifest for original jars -->
691     <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
692     <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
693
694     <!-- todo - write examples/downloads for alternate versions of the applet -->
695     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
696
697       <fileset dir="${packageDir}/examples">
698         <exclude name="u_*.jar"/>
699         <include name="${jalviewLiteJar}" />
700         <include name="${jmolJar}" />
701         <include name="to_${jalviewLiteJar}" />
702         <include name="to_${jmolJar}" />
703         <include name="tl_${jalviewLiteJar}" />
704         <include name="tl_${jmolJar}" />
705         <include name="ap_${jalviewLiteJar}" />
706         <include name="ap_${jmolJar}" />
707       </fileset>
708     </signjar>
709     <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
710     <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
711   </target>
712   <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
713     <javadoc destdir="${javadocDir}">
714       <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
715       </packageset>
716     </javadoc>
717   </target>
718 </project>