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