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