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