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