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