JAL-1400 default JalviewLite build is signed applet with sandbox permissions
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
4  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 -->
19 <project name="jalviewX" default="usage" basedir=".">
20         <!-- we use jalopy to format our sources -->
21         <taskdef name="jalopy" classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
22                 <classpath>
23                         <fileset dir="utils/jalopy/lib">
24                                 <include name="*.jar" />
25                         </fileset>
26                 </classpath>
27         </taskdef>
28
29         <target name="help" depends="usage" />
30         <target name="usage">
31                 <echo message="~~~Jalview Ant build.xml Usage~~~~" />
32                 <echo message="Targets include:" />
33                 <echo message="usage - default target, displays this message" />
34                 <echo message="buildindices - generates JavaHelpSearch from the help files" />
35                 <echo message="build - compiles all necessary files for Application" />
36                 <echo message="makedist - compiles and places all necessary jar files into directory dist" />
37                 <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution" />
38                 <echo message="              this needs a keystore and key. See docs/building.html for more information." />
39                 <echo message="compileApplet - compiles all necessary files for Applet" />
40                 <echo message="makeApplet - compiles, then packages and obfuscates the Applet" />
41                 <echo message="See docs/building.html and the comments in build file for other targets." />
42                 <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk." />
43                 <echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
44         </target>
45
46
47         <!-- utils is a class path to additional utilities needed for
48     building docs, jars and webstart stuff -->
49         <!--
50         Userdefined build property defaults
51
52         wsdl.server list (plus namespace mapping info ???)  - also want
53                 ... to make this a dynamically generatable property
54         WebStart Location
55         Build location - provide a temporary root for speed
56         jarsigner keystore and info
57         Jakarta and axis classpath ?
58         Default argument for starting Jalview (if it exists).
59
60 -->
61
62         <target name="init">
63                 <path id="axis.classpath">
64                         <!-->
65                         <fileset dir="/usr/local/axis/lib">
66                                 <include name="**/*.jar" />
67                         </fileset>
68                         <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
69                                 <include name="**/*.jar"/>
70                                 <include name="*.jar"/>
71                         </fileset> -->
72       </path>
73                 <!-- Jalview Version String displayed by application on startup and used to check for updates -->
74                 <property name="JALVIEW_VERSION" value="DEVELOPMENT" />
75                 <!-- 2.4 (VAMSAS)" -->
76                 <!-- Include debugging information in javac true or false -->
77                 <property name="javac.debug" value="true" />
78
79                 <!-- JarSigner Key Store for Webstart Distribution -->
80                 <property name="jalview.keystore" value="./keys/.keystore" />
81                 <!-- Keystore Password -->
82                 <property name="jalview.keystore.pass" value="alignmentisfun" />
83                 <!-- Key Name -->
84                 <property name="jalview.key" value="jalview" />
85                 <!-- Key Password -->
86                 <property name="jalview.key.pass" value="alignmentisfun" />
87
88                     
89                     
90                 <!-- Don't change anything below here unless you know what you are doing! -->
91                 <!-- Url path for WebStart in JNLP file -->
92                 <property name="WebStartLocation" value="http://www.jalview.org/webstart" />
93                 <!-- Webstart Image - looked for in resources/images -->
94                 <property name="WebStartImage" value="JalviewLogo_big.png"/>
95                 <!-- J2SE version needed for webstart launch -->
96                 <property name="j2sev" value="1.6+"/>
97
98     <!-- Permissions for running Java applets and applications. -->
99     <!-- Defaults are those suitable for deploying jalview webstart www.jalview.org -->
100     <property name="application.codebase" value="*.jalview.org"/>
101     <!-- and allowing the applet to be deployed from any URL -->
102     <property name="applet.codebase" value="*"/>
103     <property name="applet.caller-codebase" value="${applet.codebase}"/>
104
105                 <!-- build directory configuration -->
106                 <property name="libDir" value="lib" />
107                 <property name="resourceDir" value="resources" />
108                 <property name="helpDir" value="help" />
109                 <property name="docDir" value="doc" />
110                 <property name="sourceDir" value="src" />
111                 <property name="schemaDir" value="schemas" />
112                 <property name="outputDir" value="classes" />
113                 <property name="packageDir" value="dist" />
114                 <property name="outputJar" value="jalview.jar" />
115                 <!-- Jalview Applet JMol Jar Dependency -->
116                 <property name="jmolJar" value="JmolApplet-12.2.4.jar" />
117                 <property name="jalviewLiteJar" value="jalviewApplet.jar" />
118                 <!-- switch to indicate if we should obfuscate jalviewLite -->
119                 <!--<property name="donotobfuscate" value="true"/> -->
120
121                 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
122                 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
123                 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
124                 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
125                 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
126                 <property name="WSInterf" value="MsaWS" />
127                 <property name="wsdl.Namespace" value="vamsas" />
128                 <property name="wsdl.ClientNS" value="ext.vamsas" />
129                 <!-- the class path for building the application -->
130                 <path id="build.classpath">
131                         <fileset dir="utils">
132                                 <include name="*.jar" />
133                                 <include name="**/*.jar" />
134                         </fileset>
135                         <fileset dir="${libDir}">
136                                 <include name="*.jar" />
137                                 <include name="**/*.jar" />
138                         </fileset>
139                         <fileset dir="${java.home}/lib">
140                                 <include name="plugin.jar"/>
141                         </fileset>
142                         <fileset dir="appletlib">
143                                 <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
144                                 -->
145                                 <include name="${jmolJar}" />
146                         </fileset>
147
148                 </path>
149                 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
150                 <!-- The Location of the java 1.1.8 jdk -->
151                 <!--<property name="java118.home" value="C:\Sun\jdk1.1.8" />
152                 -->
153                 <property name="java118.home" value="${java.home}" />
154                     <!--<property name="applet.jre.tools" value="${java118.home}/lib/classes.zip" />
155                 --><!-- jre for 1.4 version -->
156                 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
157                 
158                 <!-- the classpath for building the 1.1 applet -->
159                 <path id="jalviewlite.deps">
160                         <fileset dir="${java118.home}">
161                                 <include name="lib/classes.zip" />
162                         </fileset>
163                         <fileset dir="${java.home}/lib">
164                                 <include name="plugin.jar"/>
165                         </fileset>
166                         <pathelement location="appletlib/${jmolJar}" />
167                 </path>
168     <!-- default location for outputting javadoc -->
169     <property name="javadocDir" value="${packageDir}/javadoc"/>
170         </target>
171
172
173         <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
174         <target name="buildPropertiesFile" depends="init">
175                 <tstamp prefix="build">
176                         <format property="date" pattern="dd MMMM yyyy" />
177                 </tstamp>
178                 <properties file="${outputDir}/.build_properties">
179                         <header>
180           ---Jalview Build Details---
181         </header>
182                         <property name="VERSION" value="${JALVIEW_VERSION}" />
183                         <property name="BUILD_DATE" value="${build.date}" />
184                 </properties>
185         </target>
186
187
188         <target name="clean" depends="init">
189                 <!-- not efficient yet. -->
190                 <delete dir="${outputDir}" includes="*,**/*"/>
191         </target>
192
193         <target name="distclean" depends="init, clean">
194
195                 <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
196                 <delete>
197                         <fileset dir=".">
198                                 <include name="${outputJar}" />
199                                 <include name="#*#" />
200                                 <include name="#*.*#" />
201                                 <include name="**/#*#" />
202                                 <include name="**/#*.*#" />
203                                 <include name="*~" />
204                                 <include name="*.*~" />
205                                 <include name="**/*~" />
206                                 <include name="**/*.*~" />
207                         </fileset>
208                 </delete>
209         </target>
210
211         <target name="prepare" depends="init">
212                 <mkdir dir="${outputDir}" />
213                 <copy todir="${outputDir}">
214                         <fileset dir=".">
215                                 <include name="${docDir}/**/*.*" />
216                                 <include name="${helpDir}/**/*.*" />
217                                 <include name="${libDir}/*.jar" />
218                         </fileset>
219                         <fileset dir="${resourceDir}">
220                                 <include name="**/*.*" />
221                         </fileset>
222                 </copy>
223         </target>
224
225         <target name="build" depends="prepare">
226                 <!-- not efficient yet. -->
227                 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
228                         <exclude name="jalview/*applet*" />
229                         <exclude name="jalview/appletgui/**" />
230                         <exclude name="com/stevesoft/**" />
231                 </javac>
232         </target>
233         <target name="buildindices" depends="init, prepare" unless="help.uptodate">
234                 <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
235                         <arg line="html" />
236                 </java>
237         </target>
238
239         <target name="makefulldist" depends="makedist">
240                 <!-- the default keystore details might need to be edited here -->
241                 <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
242
243                         <fileset dir="${packageDir}">
244                                 <include name="*.jar" />
245                         </fileset>
246                 </signjar>
247                 <copy todir="${packageDir}">
248                         <fileset dir="${resourceDir}/images">
249                                 <include name="${WebStartImage}"/>
250                         </fileset>
251                                         </copy>
252                 
253                 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
254
255                 <!--    codebase="http://www.jalview.org/jalview/webstart" -->
256                 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
257                 <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
258                         <information>
259                                 <title>Jalview</title>
260                                 <vendor>The Barton Group</vendor>
261                                 <homepage href="http://www.jalview.org" />
262                                 <description>Jalview Multiple Alignment Editor</description>
263                                 <description kind="short">Jalview</description>
264                                 <icon href="${WebStartImage}" />
265                                 <offline_allowed/>
266                         </information>
267                         <resources>
268                                 <j2se version="${j2sev}" initial_heap_size="10M"  />
269                                 <fileset dir="${packageDir}">
270                                         <include name="jalview.jar" />
271                                 </fileset>
272                                 <fileset dir="${packageDir}">
273                                         <include name="*.jar" />
274                                         <include name="*_*.jar" />
275                                         <exclude name="jalview.jar" />
276                                 </fileset>
277                                 <property name="jalview.version" value="${JALVIEW_VERSION}" />
278                         </resources>
279                         <application_desc main_class="jalview.bin.Jalview">
280                         </application_desc>
281                         <security>
282                                 <all_permissions />
283                         </security>
284                 </jnlp>         
285                 <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
286                         <information>
287                                 <title>Jalview</title>
288                                 <vendor>The Barton Group</vendor>
289                                 <homepage href="http://www.jalview.org" />
290                                 <description>Jalview Multiple Alignment Editor</description>
291                                 <description kind="short">Jalview</description>
292                                 <icon href="${WebStartImage}" />
293                                 <offline_allowed />
294                         </information>
295                         <resources>
296                                 <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
297                                 <fileset dir="${packageDir}">
298                                         <include name="jalview.jar" />
299                                 </fileset>
300                                 <fileset dir="${packageDir}">
301                                         <include name="*.jar" />
302                                         <include name="*_*.jar" />
303                                         <exclude name="jalview.jar" />
304                                 </fileset>
305                                 <property name="jalview.version" value="${JALVIEW_VERSION}" />
306                         </resources>
307                         <application_desc main_class="jalview.bin.Jalview">
308                         </application_desc>
309                         <security>
310                                 <all_permissions />
311                         </security>
312                 </jnlp>
313                 <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
314                         <information>
315                                 <title>Jalview</title>
316                                 <vendor>The Barton Group</vendor>
317                                 <homepage href="http://www.jalview.org" />
318                                 <description>Jalview Multiple Alignment Editor</description>
319                                 <description kind="short">Jalview</description>
320                                 <icon href="${WebStartImage}" />
321                                 <offline_allowed />
322                         </information>
323                         <resources>
324                                 <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
325                                 <fileset dir="${packageDir}">
326                                         <include name="jalview.jar" />
327                                 </fileset>
328                                 <fileset dir="${packageDir}">
329                                         <include name="*.jar" />
330                                         <include name="*_*.jar" />
331                                         <exclude name="jalview.jar" />
332                                 </fileset>
333                                 <property name="jalview.version" value="${JALVIEW_VERSION}" />
334                         </resources>
335                         <application_desc main_class="jalview.bin.Jalview">
336                         </application_desc>
337                         <security>
338                                 <all_permissions />
339                         </security>
340                 </jnlp>
341                         <!-- finally, need to postprocess to add in associations at end of 'information' element 
342                         
343                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
344                 
345                 </xslt>
346                         
347                         
348                         -->
349                                         <!--
350                                 <association mime-type="application-x/ext-file" extensions="fa"/>
351         <association mime-type="application-x/ext-file" extensions="fasta"/>
352         <association mime-type="application-x/ext-file" extensions="fastq"/>
353         <association mime-type="application-x/ext-file" extensions="blc"/>
354         <association mime-type="application-x/ext-file" extensions="msf"/>
355         <association mime-type="application-x/ext-file" extensions="pfam"/>
356         <association mime-type="application-x/ext-file" extensions="aln"/>
357         <association mime-type="application-x/ext-file" extensions="pir"/>
358         <association mime-type="application-x/ext-file" extensions="amsa"/>
359         <association mime-type="application-x/ext-file" extensions="stk"/>
360         <association mime-type="application-x/ext-file" extensions="jar"/>-->
361         
362         </target>
363
364         <target name="runenv" depends="init">
365                 <path id="run.classpath">
366                         <pathelement location="${outputDir}" />
367                         <fileset dir="${outputDir}">
368                                 <include name="${libDir}/*.jar" />
369                         </fileset>
370                 </path>
371                 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
372
373                 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
374       </echo>
375         </target>
376
377         <target name="buildextclients" depends="init">
378                 <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" />
379                 <condition property="dontextbuild">
380                         <equals arg1="n" arg2="${doextbuild.response}" />
381                 </condition>
382                 <condition property="dontextbuild">
383                         <equals arg1="N" arg2="${doextbuild.response}" />
384                 </condition>
385                 <fail if="dontextbuild">
386         Build External Client Code process aborted by user. Jalview source is unchanged.
387       </fail>
388                 <!-- Currently, this doesn't happen automatically.
389      1. Run WSDL2Java as below, which generates an ext.vamsas +
390      vamsas.<datapackages> fileset.
391      2. refactor ext.vamsas.SpecificserviceWS* to
392      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
393      3. Update the jalview.ws.*WServices classes to reflect the
394      interface type, and all locations of this wsdl type that Jalview
395      might be using.
396
397 -->
398                 <path id="axisbuild">
399                         <path refid="build.classpath" />
400                 </path>
401                 <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
402                 <move todir="./bak">
403                         <fileset dir="${sourceDir}" id="client">
404                                 <include name="${wsdl.ClientNS}/*.*" />
405                         </fileset>
406                 </move>
407
408                 <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
409                         <mappingSet>
410                                 <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
411                                 <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
412                         </mappingSet>
413                 </axis-wsdl2java>
414         </target>
415
416         <target name="makedist" depends="build, buildPropertiesFile, buildindices">
417                 <!-- make the package jar if not already existing -->
418                 <mkdir dir="${packageDir}" />
419                 <!-- clean dir if it already existed -->
420                 <delete>
421                         <fileset dir="${packageDir}">
422                                 <include name="*.jar"/>
423                         </fileset>
424                 </delete>
425                 <jar destfile="${packageDir}/${outputJar}" index="true">
426                         <manifest>
427                                 <attribute name="Main-Class" value="jalview.bin.Jalview" />
428         <attribute name="Permissions" value="all-permissions" />
429         <attribute name="Application-Name" value="Jalview Desktop"/>
430         <attribute name="Codebase" value="${application.codebase}"/>
431                         </manifest>
432                         <fileset dir="${outputDir}/">
433                                 <exclude name="cache*/**" />
434                                 <exclude name="*.jar" />
435                                 <exclude name="*.jar.*" />
436                                 <exclude name="**/*.jar" />
437                                 <exclude name="**/*.jar.*" />
438                         </fileset>
439                 </jar>
440
441                 <copy toDir="${packageDir}" flatten="true">
442                         <fileset dir="${outputDir}">
443                                 <include name="*.jar" />
444                                 <include name="**/*.jar" />
445                         </fileset>
446                 </copy>
447         </target>
448
449
450         <!-- jalopy code reformatter -->
451         <target name="sourcescrub" depends="init,build">
452                 <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
453                         <fileset dir="${sourceDir}">
454                                 <include name="*.java" />
455                                 <include name="**/*.java" />
456                                 <include name="**/**/*.java" />
457                         </fileset>
458                 </jalopy>
459         </target>
460
461
462
463         <!-- Compile, package and obfuscate Jalview Applet -->
464         <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation"/>
465
466         <target name="compileApplet" depends="init,clean">
467                 <mkdir dir="${outputDir}" />
468                 <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" 
469                         classpathref="jalviewlite.deps" includes="jalview/appletgui/**"
470                         excludes="ext/**,MCview/**,org/**,vamsas/**" />
471         </target>
472
473         <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
474                 <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
475                 <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
476                 <jar destfile="in.jar" index="true">
477                         <manifest>
478                                 <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
479                                 <attribute name="Application-Name" value="JalviewLite"/>
480                                 <attribute name="Codebase" value="${applet.codebase}"/>
481                         </manifest>
482                         <fileset dir="${outputDir}">
483                                 <include name="com/**" />
484                                 <include name="MCview/**" />
485                                 <include name="jalview/**" />
486                                 <include name=".build_properties" />
487                                 <include name="images/idwidth.gif" />
488                                 <include name="images/link.gif" />
489                         </fileset>
490                 </jar>
491         </target>
492         <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
493         </target>
494         <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
495                 <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
496                 <delete file="in.jar" />
497         </target>
498         <target name="-obfuscatereally" unless="donotobfuscate">
499
500                 <path id="obfuscateDeps.path">
501                         <pathelement location="${applet.jre.tools}" />
502                         <pathelement location="appletlib/${jmolJar}" />
503                 </path>
504                 <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
505
506                 <proguard>
507                         <injar file="in.jar" />
508                         <outjar file="${jalviewLiteJar}" />
509                         <libraryjar refid="obfuscateDeps.path" />
510                         <dontwarn/>
511                         <keep access="public" type="class" name="jalview.bin.JalviewLite">
512                                 <field access="public" />
513                                 <method access="public" />
514                                 <constructor access="public" />
515                         </keep>
516                         <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
517                                 <field access="public" />
518                                 <method access="public" />
519                                 <constructor access="public" />
520                         </keep>
521                         <!--      -libraryjars "${obfuscateDeps}"
522       -injars      in.jar
523       -outjars     jalviewApplet.jar
524       -keep public class jalview.bin.JalviewLite
525        { public * ; } -->
526                 </proguard>
527                 <delete file="in.jar" />
528         </target>
529
530         <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
531                 <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
532                 <delete>
533                         <fileset dir="${sourceDir}/jalview/schemabinding/version2">
534                                 <include name="*.java" />
535                                 <include name="descriptors/*.java" />
536                         </fileset>
537                 </delete>
538                 <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
539                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
540                 <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
541                 <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
542                 <!-- 
543                 now build the jalview.binding package with the old schema set
544                 -->
545                 <delete>
546                         <fileset dir="${sourceDir}/jalview/binding/">
547                                 <include name="**" />
548                         </fileset>
549                 </delete>
550                 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
551                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
552                 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
553         </target>
554         <target name="sourcedist" description="create jalview source distribution" depends="init">
555                 <delete file="${source.dist.name}" />
556                 <tar destfile="${source.dist.name}" compression="gzip">
557                         <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
558                                 <include name="LICENSE" />
559                                 <include name="README" />
560                                 <include name="build.xml" />
561                                 <include name="jalview-jalopy.xml" />
562                                 <include name="JalviewApplet.jpx" />
563                                 <include name="JalviewX.jpx" />
564                                 <include name="nbbuild.xml"/>
565                                 <include name="nbproject/genfiles.properties"/>
566         <include name="nbproject/project.properties"/>
567         <include name="nbproject/project.xml"/>
568                                 <include name="${sourceDir}/*.java" />
569                                 <include name="${sourceDir}/**/*.java" />
570                                 <include name="${sourceDir}/**/*.cdr" />
571                                 <include name="${libDir}/**/*" />
572                                 <include name="${resourceDir}/**/*" />
573                                 <include name="${helpDir}/**/*" />
574                                 <include name="appletlib/${jmolJar}" />
575                                 <exclude name="**/*locales" />
576                                 <exclude name="*locales/**" />
577                                 <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
578                                 <exclude name="utils/InstallAnywhere/**Build*/**" />
579                                 <exclude name="utils/InstallAnywhere/**Build*/**" />
580                                 <exclude name="utils/InstallAnywhere/**locale*" />
581                                 <exclude name="utils/InstallAnywhere/**locale*/**" />
582                                 <include name="${schemaDir}/**/*" />
583                                 <include name="utils/**/*" />
584                                 <include name="${docDir}/**/*" />
585                                 <include name="examples/**/*" />
586                         </tarfileset>
587                 </tar>
588         </target>
589         <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
590           <copy todir="${packageDir}/examples">
591           <fileset dir="examples">
592                 <include name="**/*"/>
593                 <include name="javascript/*"/>
594       <include name="jmol/*"/>
595           </fileset>
596                 <fileset dir=".">
597                 <include name="${jalviewLiteJar}"/>
598                         </fileset>
599                 <fileset dir="appletlib">
600                       <include name="**/*"/>
601                         </fileset>
602           </copy>
603           <presetdef name="applet.jar">
604       <!-- build a signed applet with 'all-permissions' - 
605                           Needs 'param name="permissions' value="all-permissions"' in applet tag
606                           JalviewLite+JmolApplet linked sequence/structure fails
607                           Mixed code warnings are raised
608                           -->
609             <jar update="true" index="true">
610                 <manifest>
611                 <attribute name="Application-Name" value="JalviewLite"/>
612                 <attribute name="Permissions" value="all-permissions"/>
613                 <attribute name="Codebase" value="${applet.codebase}"/>
614                 <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}"/>
615                 <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}"/>
616         </manifest>
617       </jar>
618     </presetdef>
619     <presetdef name="s_applet.jar">
620       <!-- build signed applet with sandbox permissions -
621                           Needs 'param name="permissions' value="sandbox"' in applet tag
622                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
623 -->
624
625       <jar update="true" index="true" jarfile="@{jarfile}">
626         <manifest>
627           <attribute name="Application-Name" value="JalviewLite" />
628           <attribute name="Permissions" value="sandbox" />
629           <attribute name="Codebase" value="${applet.codebase}" />
630           <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
631           <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
632                 </manifest>
633           </jar>
634           </presetdef>
635           <presetdef name="applet_tl.jar">
636       <!-- build signed applet with trusted library/trusted permissions -
637                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
638                                j1.7_45:
639                                No mixed code warnings raised 
640                                Jmol/JalviewLite sequence/structure example doesn't link structures
641                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
642                                
643                               -->
644
645             <jar update="true" index="true" jarfile="@{jarfile}">
646                 <manifest>
647                 <attribute name="Application-Name" value="JalviewLite"/>
648                 <attribute name="Permissions" value="all-permissions" />
649                 <attribute name="Codebase" value="${applet.codebase}"/>
650                 <attribute name="Trusted-Only" value="true"/>
651                 <attribute name="Trusted-Library" value="true"/>
652                 </manifest>
653           </jar>
654
655           </presetdef>
656     <presetdef name="applet_to.jar">
657       <!-- not fully test variant (yet) -->
658       <jar update="true" index="true" jarfile="@{jarfile}">
659         <manifest>
660           <attribute name="Application-Name" value="JalviewLite" />
661           <attribute name="Permissions" value="all-permissions" />
662           <attribute name="Codebase" value="${applet.codebase}" />
663           <attribute name="Trusted-Only" value="true" />
664         </manifest>
665       </jar>
666     </presetdef>
667     <!-- create differently privileged artefacts -->
668           <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}"/>
669           <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}"/>
670     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
671     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
672     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/s_${jalviewLiteJar}" />
673     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/s_${jmolJar}" />
674     <applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
675     <applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
676           <applet_tl.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}"/>
677           <applet_tl.jar jarfile="${packageDir}/examples/tl_${jmolJar}"/>
678     <s_applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
679     <s_applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
680     <applet_to.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
681     <applet_to.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
682     <!-- todo - write examples/downloads for alternate versions of the applet -->
683     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
684
685       <fileset dir="${packageDir}/examples">
686         <include name="*.jar" />
687       </fileset>
688     </signjar>
689         </target>
690         <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
691          <javadoc destdir="${javadocDir}">
692                 <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
693                 </packageset>
694                 </javadoc>
695         </target>
696         
697 </project>