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