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