JAL-957 make a copy of the applet/Jmol applet jars for the unsigned example pages
[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                 -->
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     <!-- the default keystore details might need to be edited here -->
242     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="SHA1withRSA">
243
244       <fileset dir="${packageDir}">
245         <include name="*.jar" />
246       </fileset>
247     </signjar>
248     <copy todir="${packageDir}">
249       <fileset dir="${resourceDir}/images">
250         <include name="${WebStartImage}" />
251       </fileset>
252     </copy>
253
254     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
255
256     <!--    codebase="http://www.jalview.org/jalview/webstart" -->
257     <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
258     <jnlp toFile="${packageDir}/jalview.jnlp" codebase="${WebStartLocation}">
259       <information>
260         <title>Jalview</title>
261         <vendor>The Barton Group</vendor>
262         <homepage href="http://www.jalview.org" />
263         <description>Jalview Multiple Alignment Editor</description>
264         <description kind="short">Jalview</description>
265         <icon href="${WebStartImage}" />
266         <offline_allowed />
267       </information>
268       <resources>
269         <j2se version="${j2sev}" initial_heap_size="10M" />
270         <fileset dir="${packageDir}">
271           <include name="jalview.jar" />
272         </fileset>
273         <fileset dir="${packageDir}">
274           <include name="*.jar" />
275           <include name="*_*.jar" />
276           <exclude name="jalview.jar" />
277         </fileset>
278         <property name="jalview.version" value="${JALVIEW_VERSION}" />
279       </resources>
280       <application_desc main_class="jalview.bin.Jalview">
281       </application_desc>
282       <security>
283         <all_permissions />
284       </security>
285     </jnlp>
286     <jnlp toFile="${packageDir}/jalview_1G.jnlp" codebase="${WebStartLocation}">
287       <information>
288         <title>Jalview</title>
289         <vendor>The Barton Group</vendor>
290         <homepage href="http://www.jalview.org" />
291         <description>Jalview Multiple Alignment Editor</description>
292         <description kind="short">Jalview</description>
293         <icon href="${WebStartImage}" />
294         <offline_allowed />
295       </information>
296       <resources>
297         <j2se version="${j2sev}" initial_heap_size="128M" max_heap_size="512M" />
298         <fileset dir="${packageDir}">
299           <include name="jalview.jar" />
300         </fileset>
301         <fileset dir="${packageDir}">
302           <include name="*.jar" />
303           <include name="*_*.jar" />
304           <exclude name="jalview.jar" />
305         </fileset>
306         <property name="jalview.version" value="${JALVIEW_VERSION}" />
307       </resources>
308       <application_desc main_class="jalview.bin.Jalview">
309       </application_desc>
310       <security>
311         <all_permissions />
312       </security>
313     </jnlp>
314     <jnlp toFile="${packageDir}/jalview_2G.jnlp" codebase="${WebStartLocation}">
315       <information>
316         <title>Jalview</title>
317         <vendor>The Barton Group</vendor>
318         <homepage href="http://www.jalview.org" />
319         <description>Jalview Multiple Alignment Editor</description>
320         <description kind="short">Jalview</description>
321         <icon href="${WebStartImage}" />
322         <offline_allowed />
323       </information>
324       <resources>
325         <j2se version="${j2sev}" initial_heap_size="256M" max_heap_size="1024M" />
326         <fileset dir="${packageDir}">
327           <include name="jalview.jar" />
328         </fileset>
329         <fileset dir="${packageDir}">
330           <include name="*.jar" />
331           <include name="*_*.jar" />
332           <exclude name="jalview.jar" />
333         </fileset>
334         <property name="jalview.version" value="${JALVIEW_VERSION}" />
335       </resources>
336       <application_desc main_class="jalview.bin.Jalview">
337       </application_desc>
338       <security>
339         <all_permissions />
340       </security>
341     </jnlp>
342     <!-- finally, need to postprocess to add in associations at end of 'information' element 
343                         
344                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
345                 
346                 </xslt>
347                         
348                         
349                         -->
350     <!--
351                                 <association mime-type="application-x/ext-file" extensions="fa"/>
352         <association mime-type="application-x/ext-file" extensions="fasta"/>
353         <association mime-type="application-x/ext-file" extensions="fastq"/>
354         <association mime-type="application-x/ext-file" extensions="blc"/>
355         <association mime-type="application-x/ext-file" extensions="msf"/>
356         <association mime-type="application-x/ext-file" extensions="pfam"/>
357         <association mime-type="application-x/ext-file" extensions="aln"/>
358         <association mime-type="application-x/ext-file" extensions="pir"/>
359         <association mime-type="application-x/ext-file" extensions="amsa"/>
360         <association mime-type="application-x/ext-file" extensions="stk"/>
361         <association mime-type="application-x/ext-file" extensions="jar"/>-->
362
363   </target>
364
365   <target name="runenv" depends="init">
366     <path id="run.classpath">
367       <pathelement location="${outputDir}" />
368       <fileset dir="${outputDir}">
369         <include name="${libDir}/*.jar" />
370       </fileset>
371     </path>
372     <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
373
374     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
375       </echo>
376   </target>
377
378   <target name="buildextclients" depends="init">
379     <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" />
380     <condition property="dontextbuild">
381       <equals arg1="n" arg2="${doextbuild.response}" />
382     </condition>
383     <condition property="dontextbuild">
384       <equals arg1="N" arg2="${doextbuild.response}" />
385     </condition>
386     <fail if="dontextbuild">
387         Build External Client Code process aborted by user. Jalview source is unchanged.
388       </fail>
389     <!-- Currently, this doesn't happen automatically.
390      1. Run WSDL2Java as below, which generates an ext.vamsas +
391      vamsas.<datapackages> fileset.
392      2. refactor ext.vamsas.SpecificserviceWS* to
393      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
394      3. Update the jalview.ws.*WServices classes to reflect the
395      interface type, and all locations of this wsdl type that Jalview
396      might be using.
397
398 -->
399     <path id="axisbuild">
400       <path refid="build.classpath" />
401     </path>
402     <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
403     <move todir="./bak">
404       <fileset dir="${sourceDir}" id="client">
405         <include name="${wsdl.ClientNS}/*.*" />
406       </fileset>
407     </move>
408
409     <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
410       <mappingSet>
411         <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
412         <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
413       </mappingSet>
414     </axis-wsdl2java>
415   </target>
416
417   <target name="makedist" depends="build, buildPropertiesFile, buildindices">
418     <!-- make the package jar if not already existing -->
419     <mkdir dir="${packageDir}" />
420     <!-- clean dir if it already existed -->
421     <delete>
422       <fileset dir="${packageDir}">
423         <include name="*.jar" />
424       </fileset>
425     </delete>
426     <jar destfile="${packageDir}/${outputJar}" index="true">
427       <manifest>
428         <attribute name="Main-Class" value="jalview.bin.Jalview" />
429         <attribute name="Permissions" value="all-permissions" />
430         <attribute name="Application-Name" value="Jalview Desktop" />
431         <attribute name="Codebase" value="${application.codebase}" />
432       </manifest>
433       <fileset dir="${outputDir}/">
434         <exclude name="cache*/**" />
435         <exclude name="*.jar" />
436         <exclude name="*.jar.*" />
437         <exclude name="**/*.jar" />
438         <exclude name="**/*.jar.*" />
439       </fileset>
440     </jar>
441
442     <copy toDir="${packageDir}" flatten="true">
443       <fileset dir="${outputDir}">
444         <include name="*.jar" />
445         <include name="**/*.jar" />
446       </fileset>
447     </copy>
448   </target>
449
450
451   <!-- jalopy code reformatter -->
452   <target name="sourcescrub" depends="init,build">
453     <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
454       <fileset dir="${sourceDir}">
455         <include name="*.java" />
456         <include name="**/*.java" />
457         <include name="**/**/*.java" />
458       </fileset>
459     </jalopy>
460   </target>
461
462
463
464   <!-- Compile, package and obfuscate Jalview Applet -->
465   <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation" />
466
467   <target name="compileApplet" depends="init,clean">
468     <mkdir dir="${outputDir}" />
469     <javac source="1.5" target="1.5" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="jalviewlite.deps" includes="jalview/appletgui/**" excludes="ext/**,MCview/**,org/**,vamsas/**" />
470   </target>
471
472   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
473     <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif" />
474     <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
475     <jar destfile="in.jar" index="true">
476       <manifest>
477         <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
478         <attribute name="Application-Name" value="JalviewLite" />
479         <attribute name="Codebase" value="${applet.codebase}" />
480       </manifest>
481       <fileset dir="${outputDir}">
482         <include name="com/**" />
483         <include name="MCview/**" />
484         <include name="jalview/**" />
485         <include name=".build_properties" />
486         <include name="images/idwidth.gif" />
487         <include name="images/link.gif" />
488       </fileset>
489     </jar>
490   </target>
491   <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
492   </target>
493   <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
494     <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
495     <delete file="in.jar" />
496   </target>
497   <target name="-obfuscatereally" unless="donotobfuscate">
498
499     <path id="obfuscateDeps.path">
500       <pathelement location="${applet.jre.tools}" />
501       <pathelement location="appletlib/${jmolJar}" />
502     </path>
503     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
504
505     <proguard>
506       <injar file="in.jar" />
507       <outjar file="${jalviewLiteJar}" />
508       <libraryjar refid="obfuscateDeps.path" />
509       <dontwarn />
510       <keep access="public" type="class" name="jalview.bin.JalviewLite">
511         <field access="public" />
512         <method access="public" />
513         <constructor access="public" />
514       </keep>
515       <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
516         <field access="public" />
517         <method access="public" />
518         <constructor access="public" />
519       </keep>
520       <!--      -libraryjars "${obfuscateDeps}"
521       -injars      in.jar
522       -outjars     jalviewApplet.jar
523       -keep public class jalview.bin.JalviewLite
524        { public * ; } -->
525     </proguard>
526     <delete file="in.jar" />
527   </target>
528
529   <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
530     <taskdef name="castor-srcgen" classname="org.castor.anttask.CastorCodeGenTask" classpathref="build.classpath" />
531     <delete>
532       <fileset dir="${sourceDir}/jalview/schemabinding/version2">
533         <include name="*.java" />
534         <include name="descriptors/*.java" />
535       </fileset>
536     </delete>
537     <castor-srcgen file="${schemaDir}/vamsas.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
538     <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
539     <castor-srcgen file="${schemaDir}/JalviewWsParamSet.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
540     <castor-srcgen file="${schemaDir}/jalview.xsd" todir="${sourceDir}" package="jalview.schemabinding.version2" warnings="false" nodesc="false" verbose="true" properties="${schemaDir}/jalview.properties" />
541     <!-- 
542                 now build the jalview.binding package with the old schema set
543                 -->
544     <delete>
545       <fileset dir="${sourceDir}/jalview/binding/">
546         <include name="**" />
547       </fileset>
548     </delete>
549     <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
550     <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
551     <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd" todir="${sourceDir}" package="jalview.binding" warnings="false" nodesc="true" verbose="true" properties="${schemaDir}/jalview.nodesc.properties" />
552   </target>
553   <target name="sourcedist" description="create jalview source distribution" depends="init">
554     <delete file="${source.dist.name}" />
555     <tar destfile="${source.dist.name}" compression="gzip">
556       <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
557         <include name="LICENSE" />
558         <include name="README" />
559         <include name="build.xml" />
560         <include name="jalview-jalopy.xml" />
561         <include name="JalviewApplet.jpx" />
562         <include name="JalviewX.jpx" />
563         <include name="nbbuild.xml" />
564         <include name="nbproject/genfiles.properties" />
565         <include name="nbproject/project.properties" />
566         <include name="nbproject/project.xml" />
567         <include name="${sourceDir}/*.java" />
568         <include name="${sourceDir}/**/*.java" />
569         <include name="${sourceDir}/**/*.cdr" />
570         <include name="${libDir}/**/*" />
571         <include name="${resourceDir}/**/*" />
572         <include name="${helpDir}/**/*" />
573         <include name="appletlib/${jmolJar}" />
574         <exclude name="**/*locales" />
575         <exclude name="*locales/**" />
576         <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
577         <exclude name="utils/InstallAnywhere/**Build*/**" />
578         <exclude name="utils/InstallAnywhere/**Build*/**" />
579         <exclude name="utils/InstallAnywhere/**locale*" />
580         <exclude name="utils/InstallAnywhere/**locale*/**" />
581         <include name="${schemaDir}/**/*" />
582         <include name="utils/**/*" />
583         <include name="${docDir}/**/*" />
584         <include name="examples/**/*" />
585       </tarfileset>
586     </tar>
587   </target>
588   <target name="pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet">
589     <copy todir="${packageDir}/examples">
590       <fileset dir="examples">
591         <include name="**/*" />
592         <include name="javascript/*" />
593         <include name="jmol/*" />
594       </fileset>
595       <fileset dir=".">
596         <include name="${jalviewLiteJar}" />
597       </fileset>
598       <fileset dir="appletlib">
599         <include name="**/*" />
600       </fileset>
601     </copy>
602
603     <presetdef name="ap_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="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">
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="tl_applet.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">
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     </presetdef>
655     <presetdef name="to_applet.jar">
656       <!-- not fully test variant (yet) -->
657       <jar update="true" index="true">
658         <manifest>
659           <attribute name="Application-Name" value="JalviewLite" />
660           <attribute name="Permissions" value="all-permissions" />
661           <attribute name="Codebase" value="${applet.codebase}" />
662           <attribute name="Trusted-Only" value="true" />
663         </manifest>
664       </jar>
665     </presetdef>
666     <!-- create differently privileged artefacts -->
667     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
668     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}"/>
669     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
670     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}"/>
671     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
672     <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
673     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
674     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
675     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
676     <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
677     <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
678     <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
679     <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
680     <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
681     <!-- finally, create manifest for original jars -->
682     <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
683     <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
684
685     <!-- todo - write examples/downloads for alternate versions of the applet -->
686     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
687
688       <fileset dir="${packageDir}/examples">
689         <exclude name="u_*.jar"/>
690         <include name="*.jar" />
691       </fileset>
692     </signjar>
693   </target>
694   <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
695     <javadoc destdir="${javadocDir}">
696       <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
697       </packageset>
698     </javadoc>
699   </target>
700
701 </project>