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