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