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