JAL-3274 import build properties and authors resources from JalviewJS site or classes...
[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         <property name="cloverOutputDir" value="clover" if:set="clover.jar" />
152     <!-- switch to indicate if we should obfuscate jalviewLite -->
153     <!-- <property name="donotobfuscate" value="true"/> -->
154     <!-- switch to exclude associations from generated jnlp files -->
155     <!-- <property name="nojnlpfileassocs" value="true"/> -->
156
157     <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
158     <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
159     <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
160     <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
161     <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
162     <property name="WSInterf" value="MsaWS" />
163     <property name="wsdl.Namespace" value="vamsas" />
164     <property name="wsdl.ClientNS" value="ext.vamsas" />
165     <!-- the class path for building the application -->
166     <path id="build.classpath">
167       <fileset dir="utils">
168         <include name="*.jar" />
169         <include name="**/*.jar" />
170       </fileset>
171       <fileset dir="${libDir}">
172         <include name="*.jar" />
173         <include name="**/*.jar" />
174       </fileset>
175       <fileset dir="${java.home}/lib">
176         <include name="plugin.jar" />
177       </fileset>
178       <fileset dir="appletlib">
179         <!-- the JmolApplet includes the JmolApplet console and the application javac seems to always try and build all packages 
180                                 -->
181         <include name="${jmolJar}" />
182         <include name="${varnaJar}" />
183       </fileset>
184     </path>
185     <path id="test.classpath">
186       <pathelement path="${outputDir}" />
187       <path refid="build.classpath" />
188     </path>
189     <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz" />
190     <!-- The Location of the java 1.1.8 jdk -->
191     <property name="java118.home" value="${java.home}" />
192     <!-- jre for 1.4 version -->
193     <property name="applet.jre.tools" value="${java118.home}/lib/rt.jar" />
194
195     <!-- the classpath for building the 1.1 applet -->
196     <path id="jalviewlite.deps">
197       <fileset dir="${java118.home}">
198         <include name="lib/rt.jar" />
199       </fileset>
200       <fileset dir="${java.home}/lib">
201         <include name="plugin.jar" />
202       </fileset>
203       <pathelement location="appletlib/${jmolJar}" />
204       <pathelement location="lib/${varnaJar}" />
205       <pathelement location="appletlib/${jsoup}" />
206       <pathelement location="appletlib/${jsonSimple}" />
207       <pathelement location="appletlib/${javaJson}" />
208
209     </path>
210     <!-- default location for outputting javadoc -->
211     <property name="javadocDir" value="${packageDir}/javadoc" />
212   </target>
213
214
215   <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties" />
216   <target name="buildPropertiesFile" depends="init">
217     <tstamp prefix="build">
218       <format property="date" pattern="dd MMMM yyyy" />
219     </tstamp>
220     <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="false">
221       <arg value="rev-parse" />
222       <arg value="--short" />
223       <arg value="HEAD" />
224     </exec>
225     <exec executable="/usr/bin/git" outputproperty="git.branch" failifexecutionfails="false">
226       <arg value="rev-parse" />
227       <arg value="--abbrev-ref" />
228       <arg value="HEAD" />
229     </exec>
230     <properties file="${outputDir}/.build_properties">
231       <header>
232           ---Jalview Build Details---
233         </header>
234       <property name="VERSION" value="${JALVIEW_VERSION}" />
235       <property name="INSTALLATION" value="${INSTALLATION} git-commit:${git.commit} [${git.branch}]" />
236       <property name="BUILD_DATE" value="${build.date}" />
237     </properties>
238   </target>
239
240
241   <target name="clean" depends="init">
242     <!-- not efficient yet. -->
243     <delete dir="${outputDir}" includes="*,**/*" />
244   </target>
245
246   <target name="distclean" depends="init, clean">
247
248     <echo message="REMOVING ALL BACKUP/AUTOSAVES!" />
249     <delete>
250       <fileset dir=".">
251         <include name="${outputJar}" />
252         <include name="#*#" />
253         <include name="#*.*#" />
254         <include name="**/#*#" />
255         <include name="**/#*.*#" />
256         <include name="*~" />
257         <include name="*.*~" />
258         <include name="**/*~" />
259         <include name="**/*.*~" />
260       </fileset>
261     </delete>
262   </target>
263
264   <target name="prepare" depends="init">
265     <mkdir dir="${outputDir}" />
266     <copy todir="${outputDir}">
267       <fileset dir=".">
268         <include name="${docDir}/**/*.*" />
269         <include name="${helpDir}/**/*.*" />
270         <include name="${libDir}/*.jar" />
271       </fileset>
272       <fileset dir="${resourceDir}">
273         <include name="**/*.*" />
274       </fileset>
275     </copy>
276         <mkdir dir="${cloverOutputDir}" if:set="clover.jar"/>
277   </target>
278
279   <target name="build" depends="prepare">
280     <!-- not efficient yet. -->
281     <javac source="${javac.source}" target="${javac.target}" srcdir="${sourceDir}" destdir="${outputDir}" debug="${javac.debug}" classpathref="build.classpath">
282       <exclude name="jalview/*applet*" />
283       <exclude name="jalview/appletgui/**" />
284       <exclude name="com/stevesoft/**" />
285     </javac>
286   </target>
287
288
289   <target name="testclean" depends="init">
290     <delete dir="${testOutputDir}" includes="*,**/*" />
291   </target>
292
293   <target name="prepareTests" depends="init,testclean">
294     <mkdir dir="${testOutputDir}" />
295   </target>
296
297   <target name="buildTests" depends="build,buildindices,prepareTests">
298     <javac source="${javac.source}" target="${javac.target}" srcdir="${testDir}" destdir="${testOutputDir}" debug="${javac.debug}" classpathref="test.classpath" includeantruntime="false">
299     </javac>
300   </target>
301
302   <taskdef resource="testngtasks" classpath="utils/testnglibs/testng.jar" />
303
304   <target name="testng" depends="buildTests">
305     <testng outputDir="${reportDir}" haltOnFailure="false" groups="${testng-groups}" mode="testng"
306       verbose="2">
307       <classpath>
308         <pathelement location="${testOutputDir}" />
309         <pathelement location="${clover.jar}" if:set="clover.jar"/>
310         <path refid="test.classpath" />
311       </classpath>
312       <jvmarg value="--add-modules=java.se.ee" if:set="java9"/>
313       <jvmarg value="--illegal-access=warn" if:set="java9"/>
314       <classfileset dir="${testOutputDir}" includes="**/*.class" />
315     </testng>
316   </target>
317
318   <target name="buildindices" depends="init, prepare, buildPropertiesFile" unless="help.uptodate">
319     <replace value="${JALVIEW_VERSION}">
320       <replacetoken>
321         <![CDATA[$$Version-Rel$$]]>
322       </replacetoken>
323       <fileset dir="${outputDir}/${helpDir}">
324         <include name="help.jhm" />
325       </fileset>
326     </replace>
327
328     <java classname="com.sun.java.help.search.Indexer" classpathref="build.classpath" fork="true" dir="${outputDir}/${helpDir}">
329       <arg line="html" />
330     </java>
331   </target>
332
333   <target name="preparejnlp" depends="makedist">
334     <copy todir="${packageDir}">
335       <fileset dir="${resourceDir}/images">
336         <include name="${WebStartImage}" />
337       </fileset>
338     </copy>
339
340     <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties" />
341
342     <!-- create a dummy jar which will eventually contain the jnlp template -->
343     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
344       <fileset dir="${packageDir}">
345         <include name="jalview.jar" />
346       </fileset>
347     </jar>
348
349     <mkdir dir="${packageDir}/JNLP-INF" />
350     <antcall target="writejnlpf">
351       <param name="jnlpFile" value="${packageDir}/JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
352       <param name="inih" value="*" />
353       <param name="maxh" value="*" />
354     </antcall>
355
356     <jar destfile="${packageDir}/jalview_jnlp_vm.jar" index="true">
357       <fileset dir="${packageDir}">
358         <include name="JNLP-INF/APPLICATION-TEMPLATE.JNLP" />
359       </fileset>
360     </jar>
361
362     <antcall target="writejnlpf">
363       <param name="jnlpFile" value="${packageDir}/jalview_256M.jnlp" />
364       <param name="inih" value="10M" />
365       <param name="maxh" value="256M" />
366     </antcall>
367     <antcall target="writejnlpf">
368       <param name="jnlpFile" value="${packageDir}/jalview.jnlp" />
369       <param name="inih" value="800M" />
370       <param name="maxh" value="1024M" />
371     </antcall>
372
373     <antcall target="writejnlpf">
374       <param name="jnlpFile" value="${packageDir}/jalview_1G.jnlp" />
375       <param name="inih" value="128M" />
376       <param name="maxh" value="512M" />
377     </antcall>
378
379     <antcall target="writejnlpf">
380       <param name="jnlpFile" value="${packageDir}/jalview_2G.jnlp" />
381       <param name="inih" value="800M" />
382       <param name="maxh" value="1024M" />
383     </antcall>
384
385     <!-- finally, need to postprocess to add in associations at end of 'information' element 
386                         
387                         <xslt in="${packageDir}/jalview_noa_1G.jnlp" out="${packageDir}/jalview_1G.jnlp">
388                 
389                 </xslt>
390                         
391                         
392                         -->
393     <!--
394                                 <association mime-type="application-x/ext-file" extensions="fa"/>
395         <association mime-type="application-x/ext-file" extensions="fasta"/>
396         <association mime-type="application-x/ext-file" extensions="mfa"/>
397         <association mime-type="application-x/ext-file" extensions="fastq"/>
398         <association mime-type="application-x/ext-file" extensions="blc"/>
399         <association mime-type="application-x/ext-file" extensions="msf"/>
400         <association mime-type="application-x/ext-file" extensions="pfam"/>
401         <association mime-type="application-x/ext-file" extensions="aln"/>
402         <association mime-type="application-x/ext-file" extensions="pir"/>
403         <association mime-type="application-x/ext-file" extensions="amsa"/>
404         <association mime-type="application-x/ext-file" extensions="stk"/>
405         <association mime-type="application-x/ext-file" extensions="jar"/>-->
406   </target>
407
408   <target name="-jarsignwithtsa" depends="makedist,preparejnlp" if="timestamp" unless="nosign">
409     <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false" sigalg="${jalview.keyalg}" digestalg="${jalview.keydig}"
410       tsaproxyhost="${proxyHost}" tsaproxyport="${proxyPort}" tsaurl="${jalview.tsaurl}">
411       <fileset dir="${packageDir}">
412         <include name="*.jar" />
413       </fileset>
414     </signjar>
415   </target>
416   <target name="-jarsignnotsa" depends="makedist,preparejnlp" if:blank="timestamp" unless="nosign">
417     <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}">
418       <fileset dir="${packageDir}">
419         <include name="*.jar" />
420       </fileset>
421     </signjar>
422   </target>
423
424   <target name="makefulldist" depends="makedist,preparejnlp,-jarsignwithtsa,-jarsignnotsa">
425     <!-- and sign the jars -->
426     <!-- the default keystore details might need to be edited here -->
427   </target>
428
429   <target name="runenv" depends="init">
430     <path id="run.classpath">
431       <pathelement location="${outputDir}" />
432       <fileset dir="${outputDir}">
433         <include name="${libDir}/*.jar" />
434       </fileset>
435     </path>
436     <pathconvert targetos="unix" refid="run.classpath" property="run.classpath" />
437
438     <echo>java -classpath ${run.classpath} jalview.bin.Jalview
439       </echo>
440   </target>
441
442   <target name="-generatejnlpf">
443     <presetdef name="jnlpf">
444       <jnlp codebase="${WebStartLocation}">
445         <information>
446           <title>Jalview</title>
447           <vendor>The Barton Group</vendor>
448           <homepage href="http://www.jalview.org" />
449           <description>Jalview Multiple Alignment Editor</description>
450           <description kind="short">Jalview</description>
451           <icon href="${WebStartImage}" />
452           <offline_allowed />
453         </information>
454         <resources>
455           <j2se version="1.8+" />
456           <jar main="true" href="jalview.jar"/>
457           <fileset dir="${packageDir}">
458             <exclude name="jalview.jar" />
459             <include name="*.jar" />
460             <include name="*_*.jar" />
461             <exclude name="*quaqua*.jar" />
462           </fileset>
463           <property name="jalview.version" value="${JALVIEW_VERSION}" />
464         </resources>
465         <resources os="Mac OS X">
466           <fileset dir="${packageDir}">
467             <include name="quaqua-filechooser-only-8.0.jar"/>
468             <include name="*quaqua64*.jnilib.jar" />
469           </fileset>
470         </resources>
471
472         <application_desc main_class="jalview.bin.Jalview">
473         </application_desc>
474         <security>
475           <all_permissions />
476         </security>
477       </jnlp>
478     </presetdef>
479
480     <jnlpf toFile="${jnlpFile}" />
481     <!-- add the add-modules j2se attribute for java 9 -->
482     <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;">
483       <replacetoken>j2se version="1.8+"</replacetoken>
484     </replace>
485   </target>
486
487   <target name="-dofakejnlpfileassoc" depends="-generatejnlpf" if="nojnlpfileassocs">
488     <echo message="Not adding JNLP File Associations" />
489   </target>
490
491   <target name="-dojnlpfileassoc" depends="-generatejnlpf" unless="nojnlpfileassocs">
492     <replace file="${jnlpFile}">
493       <replacetoken>
494         <![CDATA[</information>]]></replacetoken>
495       <replacevalue>
496         <![CDATA[
497           <association mime-type="application-x/ext-file" extensions="fa" />
498         <association mime-type="application-x/ext-file" extensions="fasta" />
499         <association mime-type="application-x/ext-file" extensions="mfa" />
500         <association mime-type="application-x/ext-file" extensions="fastq" />
501         <association mime-type="application-x/ext-file" extensions="blc" />
502         <association mime-type="application-x/ext-file" extensions="msf" />
503         <association mime-type="application-x/ext-file" extensions="pfam" />
504         <association mime-type="application-x/ext-file" extensions="aln"/>
505         <association mime-type="application-x/ext-file" extensions="pir"/>
506         <association mime-type="application-x/ext-file" extensions="amsa"/>
507         <association mime-type="application-x/ext-file" extensions="stk"/>
508         <association mime-type="application-x/ext-file" extensions="jvp"/>
509       </information>]]></replacevalue>
510   </replace>
511   <echo message="Added file associations to JNLP file" />
512 </target>
513 <target name="writejnlpf" depends="-dojnlpfileassoc,-dofakejnlpfileassoc">
514 </target>
515
516 <target name="buildextclients" depends="init">
517   <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" />
518   <condition property="dontextbuild">
519     <equals arg1="n" arg2="${doextbuild.response}" />
520   </condition>
521   <condition property="dontextbuild">
522     <equals arg1="N" arg2="${doextbuild.response}" />
523   </condition>
524   <fail if="dontextbuild">
525         Build External Client Code process aborted by user. Jalview source is unchanged.
526       </fail>
527   <!-- Currently, this doesn't happen automatically.
528      1. Run WSDL2Java as below, which generates an ext.vamsas +
529      vamsas.<datapackages> fileset.
530      2. refactor ext.vamsas.SpecificserviceWS* to
531      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
532      3. Update the jalview.ws.*WServices classes to reflect the
533      interface type, and all locations of this wsdl type that Jalview
534      might be using.
535
536 -->
537   <path id="axisbuild">
538     <path refid="build.classpath" />
539   </path>
540   <taskdef resource="axis-tasks.properties" classpathref="axisbuild" />
541   <move todir="./bak">
542     <fileset dir="${sourceDir}" id="client">
543       <include name="${wsdl.ClientNS}/*.*" />
544     </fileset>
545   </move>
546
547   <axis-wsdl2java output="${sourceDir}" verbose="true" url="${wsdl.MsaWS2}" serverside="false" deployscope="Request" debug="false" helpergen="true" all="true">
548     <mappingSet>
549       <mapping namespace="${wsdl.Namespace}" package="${wsdl.ClientNS}" />
550       <mapping namespace="http://dataTypes.vamsas" package="${wsdl.ClientNS}" />
551     </mappingSet>
552   </axis-wsdl2java>
553 </target>
554
555 <target name="makedist" depends="build, buildPropertiesFile, linkcheck, buildindices">
556   <fail if="clover.jar">
557     Ignoring request to build jalview distribution with clover-instrumented classes
558   </fail>
559   <!-- make the package jar if not already existing -->
560   <mkdir dir="${packageDir}" />
561   <!-- clean dir if it already existed -->
562   <delete>
563     <fileset dir="${packageDir}">
564       <include name="*.jar" />
565     </fileset>
566   </delete>
567   <jar destfile="${packageDir}/${outputJar}" index="true">
568     <manifest>
569       <attribute name="Main-Class" value="jalview.bin.Jalview" />
570       <attribute name="Permissions" value="all-permissions" />
571       <attribute name="Application-Name" value="Jalview Desktop" />
572       <attribute name="Codebase" value="${application.codebase}" />
573     </manifest>
574     <fileset dir="${outputDir}/">
575       <exclude name="cache*/**" />
576       <exclude name="*.jar" />
577       <exclude name="*.jar.*" />
578       <exclude name="**/*.jar" />
579       <exclude name="**/*.jar.*" />
580     </fileset>
581   </jar>
582
583   <copy toDir="${packageDir}" flatten="true">
584     <fileset dir="${outputDir}">
585       <include name="*.jar" />
586       <include name="**/*.jar" />
587     </fileset>
588   </copy>
589 </target>
590
591
592 <!-- jalopy code reformatter -->
593 <target name="sourcescrub" depends="init,build">
594   <jalopy destdir="jsrc" classpathref="run.classpath" convention="jalview-jalopy.xml">
595     <fileset dir="${sourceDir}">
596       <include name="*.java" />
597       <include name="**/*.java" />
598       <include name="**/**/*.java" />
599     </fileset>
600   </jalopy>
601 </target>
602
603
604
605 <!-- Compile, package and obfuscate Jalview Applet -->
606 <target name="makeApplet" depends="obfuscate" description="assemble the final jalviewLite applet jar with or without obfuscation" />
607
608 <target name="compileApplet" depends="init,clean">
609   <mkdir dir="${outputDir}" />
610   <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/**" />
611 </target>
612
613 <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
614   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif" />
615   <copy todir="${outputDir}/lang">
616     <fileset dir="${resourceDir}/lang">
617       <include name="**.*" />
618     </fileset>
619   </copy>
620   <jar destfile="in.jar" index="true">
621     <manifest>
622       <attribute name="Main-Class" value="jalview.bin.JalviewLite" />
623       <attribute name="Application-Name" value="JalviewLite" />
624       <attribute name="Codebase" value="${applet.codebase}" />
625     </manifest>
626     <fileset dir="${outputDir}">
627       <include name="com/**" />
628       <include name="MCview/**" />
629       <include name="jalview/**" />
630       <include name=".build_properties" />
631       <include name="images/link.gif" />
632       <include name="lang/**" />
633     </fileset>
634   </jar>
635 </target>
636 <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally">
637 </target>
638 <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">
639   <copy file="in.jar" tofile="${jalviewLiteJar}" overwrite="true" />
640   <delete file="in.jar" />
641 </target>
642 <target name="-obfuscatereally" unless="donotobfuscate">
643
644   <path id="obfuscateDeps.path">
645     <pathelement location="${applet.jre.tools}" />
646     <pathelement location="appletlib/${jmolJar}" />
647     <pathelement location="lib/${varnaJar}" />
648     <pathelement location="appletlib/${jsoup}" />
649     <pathelement location="appletlib/${jsonSimple}" />
650     <pathelement location="appletlib/${javaJson}" />
651     <fileset dir="${java.home}/lib">
652       <include name="plugin.jar" />
653     </fileset>
654   </path>
655   <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard_5.3.3.jar" />
656
657   <proguard verbose="true" >
658     <injar file="in.jar" />
659     <outjar file="${jalviewLiteJar}" />
660     <libraryjar refid="obfuscateDeps.path" />
661     <dontwarn />
662     <keep access="public" type="class" name="jalview.bin.JalviewLite">
663       <field access="public" />
664       <method access="public" />
665       <constructor access="public" />
666     </keep>
667     <keep access="public" type="class" name="jalview.appletgui.AlignFrame">
668       <field access="public" />
669       <method access="public" />
670       <constructor access="public" />
671     </keep>
672
673     <keep name="jalview.json.binding**">
674       <constructor/>
675       <method name="*"/>
676     </keep>
677
678     <keep access="public" type="class" name="MCview.PDBfile">
679       <field access="public" />
680       <method access="public" />
681       <constructor access="public" />
682     </keep>
683
684     <keep access="public" type="class" name="jalview.ws.jws1.Annotate3D">
685       <field access="public" />
686       <method access="public" />
687       <constructor access="public" />
688     </keep>
689
690     <keep access="public" type="class" name="jalview.ext.jmol.JmolParser">
691       <field access="public" />
692       <method access="public" />
693       <constructor access="public" />
694     </keep>
695
696
697     <!--      -libraryjars "${obfuscateDeps}"
698       -injars      in.jar
699       -outjars     jalviewApplet.jar
700       -keep public class jalview.bin.JalviewLite
701        { public * ; } -->
702   </proguard>
703   <delete file="in.jar" />
704 </target>
705
706 <target name="jaxb-bindings" depends="init" description="Generates JAXB bindings for supported Jalview XML models (needs xjc on the path)">
707   <delete>
708     <fileset dir="${sourceDir}/jalview/xml/binding/jalview">
709       <include name="*.java" />
710     </fileset>
711   </delete>
712   <exec executable="xjc">
713     <arg value="${schemaDir}/jalview.xsd"/>
714     <arg value="-d"/>
715     <arg value="${sourceDir}"/>
716     <arg value="-p"/>
717     <arg value="jalview.xml.binding.jalview"/>
718   </exec>
719   <delete>
720     <fileset dir="${sourceDir}/jalview/xml/binding/embl">
721       <include name="*.java" />
722     </fileset>
723   </delete>
724
725   <exec executable="xjc">
726     <arg value="${schemaDir}/embl.xsd"/>
727     <arg value="-d"/>
728     <arg value="${sourceDir}"/>
729     <arg value="-b"/>
730     <arg value="${schemaDir}/embl_bindings.xml"/>
731     <arg value="-p"/>
732     <arg value="jalview.xml.binding.embl"/>
733   </exec>
734
735   <delete>
736     <fileset dir="${sourceDir}/jalview/xml/binding/uniprot">
737       <include name="*.java" />
738     </fileset>
739   </delete>
740
741   <exec executable="xjc">
742     <arg value="${schemaDir}/uniprot.xsd"/>
743     <arg value="-d"/>
744     <arg value="${sourceDir}"/>
745     <arg value="-p"/>
746     <arg value="jalview.xml.binding.uniprot"/>
747   </exec>
748 </target>
749
750 <target name="sourcedist" description="create jalview source distribution" depends="init">
751   <delete file="${source.dist.name}" />
752   <!-- temporary copy of source to update timestamps -->
753   <copy todir="_sourcedist">
754     <fileset dir=".">
755       <exclude name=".*" />
756       <exclude name="**/.*" />
757       <exclude name="*.class" />
758       <exclude name="**/*.class" />
759       <include name="LICENSE" />
760       <include name="README" />
761       <include name="build.xml" />
762       <include name="jalview-jalopy.xml" />
763       <include name="JalviewApplet.jpx" />
764       <include name="JalviewX.jpx" />
765       <include name="nbbuild.xml" />
766       <include name="nbproject/genfiles.properties" />
767       <include name="nbproject/project.properties" />
768       <include name="nbproject/project.xml" />
769       <include name="${sourceDir}/*.java" />
770       <include name="${sourceDir}/**/*.java" />
771       <include name="${sourceDir}/**/*.cdr" />
772       <include name="${libDir}/**/*" />
773       <include name="${resourceDir}/**/*" />
774       <include name="${helpDir}/**/*" />
775       <include name="appletlib/${jmolJar}" />
776       <include name="appletlib/${jsonSimple}" />
777       <include name="appletlib/${javaJson}" />
778       <exclude name="**/*locales" />
779       <exclude name="*locales/**" />
780       <exclude name="utils/InstallAnywhere/**Build.iap_xml" />
781       <exclude name="utils/InstallAnywhere/**Build*/**" />
782       <exclude name="utils/InstallAnywhere/**Build*/**" />
783       <exclude name="utils/InstallAnywhere/.build*.*/**" />
784       <exclude name="utils/InstallAnywhere/**locale*" />
785       <exclude name="utils/InstallAnywhere/**locale*/**" />
786       <exclude name="utils/InstallAnywhere/**locale*/**" />
787       <include name="${schemaDir}/**/*" />
788       <include name="utils/**/*" />
789       <include name="${docDir}/**/*" />
790       <include name="examples/**/*" />
791     </fileset>
792   </copy>
793
794   <tstamp prefix="build">
795     <format property="year" pattern="yyyy" />
796   </tstamp>
797   <!-- each replacetoken CDATA body must be on one line - 
798        otherwise the pattern doesn't match -->
799   <replace value="${JALVIEW_VERSION}">
800     <replacetoken>
801       <![CDATA[$$Version-Rel$$]]>
802     </replacetoken>
803     <fileset dir="_sourcedist">
804       <include name="**/*" />
805     </fileset>
806   </replace>
807   <replace dir="_sourcedist" value="${build.year}">
808     <replacetoken>
809       <![CDATA[$$Year-Rel$$]]>
810     </replacetoken>
811     <fileset dir="_sourcedist">
812       <include name="**/*" />
813     </fileset>
814   </replace>
815
816   <tar destfile="${source.dist.name}" compression="gzip">
817     <tarfileset dir="_sourcedist/" prefix="jalview" preserveLeadingSlashes="true">
818     </tarfileset>
819   </tar>
820
821   <delete dir="_sourcedist" />
822 </target>
823 <target name="prepubapplet_1" depends="makeApplet">
824   <copy todir="${packageDir}/examples">
825     <fileset dir="examples">
826       <include name="**/*" />
827       <include name="javascript/*" />
828       <include name="jmol/*" />
829     </fileset>
830     <fileset dir=".">
831       <include name="${jalviewLiteJar}" />
832     </fileset>
833     <fileset dir="appletlib">
834       <include name="**/*" />
835     </fileset>
836   </copy>
837   <jar update="true" index="true" jarfile="${packageDir}/examples/${jalviewLiteJar}" />
838   <jar update="true" index="true" jarfile="${packageDir}/examples/${javaJson}" />
839   <jar update="true" index="true" jarfile="${packageDir}/examples/${jsonSimple}" />
840   <jar update="true" index="true" jarfile="${packageDir}/examples/${jmolJar}">
841     <manifest>
842       <attribute name="Application-Name" value="Jmol (bundled with JalviewLite)" />
843       <!--          <attribute name="Permissions" value="sandbox" /> -->
844       <!--<attribute name="Trusted-Lib" value="true" /> -->
845       <attribute name="Codebase" value="${applet.codebase}" />
846       <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
847     </manifest>
848   </jar>
849
850   <presetdef name="ap_applet.jar">
851     <!-- build a signed applet with 'all-permissions' - 
852                           Needs 'param name="permissions' value="all-permissions"' in applet tag
853                           JalviewLite+JmolApplet linked sequence/structure fails
854                           Mixed code warnings are raised
855                           -->
856     <jar update="true" index="true">
857       <manifest>
858         <attribute name="Application-Name" value="JalviewLite" />
859         <attribute name="Permissions" value="all-permissions" />
860         <attribute name="Codebase" value="${applet.codebase}" />
861         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
862         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
863       </manifest>
864     </jar>
865   </presetdef>
866   <presetdef name="applet.jar">
867     <!-- build signed applet with sandbox permissions -
868                           Needs 'param name="permissions' value="sandbox"' in applet tag
869                          Preserves Pre-Java 1.7_u45 behavior once 'permissions' parameter added to applet tag 
870                         -->
871
872     <jar update="true" index="true">
873       <manifest>
874         <attribute name="Application-Name" value="JalviewLite" />
875         <attribute name="Permissions" value="sandbox" />
876         <attribute name="Codebase" value="${applet.codebase}" />
877         <attribute name="Caller-Allowable-Codebase" value="${applet.caller-codebase}" />
878         <attribute name="Application-Library-Allowable-Codebase" value="${applet.codebase}" />
879       </manifest>
880     </jar>
881   </presetdef>
882   <presetdef name="tl_applet.jar">
883     <!-- build signed applet with trusted library/trusted permissions -
884                                 Needs 'param name="permissions' value="all-permissions"' in applet tag
885                                j1.7_45:
886                                No mixed code warnings raised 
887                                Jmol/JalviewLite sequence/structure example doesn't link structures
888                                Raises dialog asking user to allow page to control applet via LiveConnect javascript
889                                
890                               -->
891
892     <jar update="true" index="true">
893       <manifest>
894         <attribute name="Application-Name" value="JalviewLite" />
895         <attribute name="Permissions" value="all-permissions" />
896         <attribute name="Codebase" value="${applet.codebase}" />
897         <attribute name="Trusted-Only" value="true" />
898         <attribute name="Trusted-Library" value="true" />
899       </manifest>
900     </jar>
901   </presetdef>
902   <presetdef name="to_applet.jar">
903     <!-- not fully test variant (yet) -->
904     <jar update="true" index="true">
905       <manifest>
906         <attribute name="Application-Name" value="JalviewLite" />
907         <attribute name="Permissions" value="all-permissions" />
908         <attribute name="Codebase" value="${applet.codebase}" />
909         <attribute name="Trusted-Only" value="true" />
910       </manifest>
911     </jar>
912   </presetdef>
913   <!-- create differently privileged artefacts -->
914   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/u_${jalviewLiteJar}" />
915   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
916   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
917   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
918   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/ap_${jalviewLiteJar}" />
919   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/ap_${jmolJar}" />
920   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/ap_${javaJson}" />
921   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/ap_${jsonSimple}" />
922   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jalviewLiteJar}" />
923   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jmolJar}" />
924   <ap_applet.jar jarfile="${packageDir}/examples/ap_${javaJson}" />
925   <ap_applet.jar jarfile="${packageDir}/examples/ap_${jsonSimple}" />
926   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/tl_${jalviewLiteJar}" />
927   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/tl_${jmolJar}" />
928   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/tl_${javaJson}" />
929   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/tl_${jsonSimple}" />
930   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jalviewLiteJar}" />
931   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jmolJar}" />
932   <tl_applet.jar jarfile="${packageDir}/examples/tl_${javaJson}" />
933   <tl_applet.jar jarfile="${packageDir}/examples/tl_${jsonSimple}" />
934   <copy file="${packageDir}/examples/${jalviewLiteJar}" tofile="${packageDir}/examples/to_${jalviewLiteJar}" />
935   <copy file="${packageDir}/examples/${jmolJar}" tofile="${packageDir}/examples/to_${jmolJar}" />
936   <copy file="${packageDir}/examples/${javaJson}" tofile="${packageDir}/examples/to_${javaJson}" />
937   <copy file="${packageDir}/examples/${jsonSimple}" tofile="${packageDir}/examples/to_${jsonSimple}" />
938   <to_applet.jar jarfile="${packageDir}/examples/to_${jalviewLiteJar}" />
939   <to_applet.jar jarfile="${packageDir}/examples/to_${jmolJar}" />
940   <to_applet.jar jarfile="${packageDir}/examples/to_${javaJson}" />
941   <to_applet.jar jarfile="${packageDir}/examples/to_${jsonSimple}" />
942   <!-- finally, create manifest for original jars -->
943   <applet.jar jarfile="${packageDir}/examples/${jalviewLiteJar}" />
944   <applet.jar jarfile="${packageDir}/examples/${jmolJar}" />
945   <applet.jar jarfile="${packageDir}/examples/${javaJson}" />
946   <applet.jar jarfile="${packageDir}/examples/${jsonSimple}" />
947
948   <!-- todo - write examples/downloads for alternate versions of the applet 
949     probably don't need to do this now since we don't have alternate versions anymore !-->
950 </target>
951 <target name="-signapplet" depends="prepubapplet_1">
952   <fileset id="signappletjarset" dir="${packageDir}/examples">
953     <exclude name="u_*.jar" />
954     <include name="${jalviewLiteJar}" />
955     <include name="${jmolJar}" />
956     <include name="${javaJson}" />
957     <include name="${jsonSimple}" />
958     <include name="to_${jalviewLiteJar}" />
959     <include name="to_${jmolJar}" />
960     <include name="to_${javaJson}" />
961     <include name="to_${jsonSimple}" />
962     <include name="tl_${jalviewLiteJar}" />
963     <include name="tl_${jmolJar}" />
964     <include name="tl_${javaJson}" />
965     <include name="tl_${jsonSimple}" />
966     <include name="ap_${jalviewLiteJar}" />
967     <include name="ap_${jmolJar}" />
968     <include name="ap_${javaJson}" />
969     <include name="ap_${jsonSimple}" />
970   </fileset>
971 </target>
972 <target name="-signappletnotsa" if:blank="timestamp" depends="-signapplet" unless="nosign">
973   <signjar storepass="${jalview.keystore.pass}" keypass="${jalview.key.pass}" keystore="${jalview.keystore}" alias="${jalview.key}" lazy="false" verbose="false">
974     <fileset refid="signappletjarset" />
975   </signjar>
976 </target>
977
978 <target name="-signapplettsa" if="timestamp" depends="-signapplet" unless="nosign">
979   <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}">
980     <fileset refid="signappletjarset" />
981   </signjar>
982 </target>
983
984 <target name="signApplet" description="internal target to sign applet" depends="-signappletnotsa,-signapplettsa" />
985 <target name="pubapplet" description="Dummy target to keep legacy Jalview build system happy. We don't actually publish the applet anymore."/>
986
987 <target name="_pubapplet" description="installs the jalviewLite applet and dependent jars into an applet examples directory built under ${outputDir}" depends="makeApplet, signApplet">
988
989   <!-- bizarre bug causes JmolApplet to always get signed, even if excluded from above. so copy explicitly -->
990   <copy file="appletlib/${jmolJar}" tofile="${packageDir}/examples/u_${jmolJar}" overwrite="true" />
991   <copy file="appletlib/${jsonSimple}" tofile="${packageDir}/examples/u_${jsonSimple}" overwrite="true" />
992   <copy file="appletlib/${javaJson}" tofile="${packageDir}/examples/u_${javaJson}" overwrite="true" />
993   <!-- finally, replace any launchApp servlet tags with a version specification -->
994   <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}&quot;">
995     <replacetoken>
996       <![CDATA[http://www.jalview.org/services/launchApp"]]>
997     </replacetoken>
998     <fileset dir="${packageDir}/examples">
999       <include name="**/*.html" />
1000     </fileset>
1001   </replace>
1002   <replace value="http://www.jalview.org/services/launchApp?version=${JALVIEW_VERSION}'">
1003     <replacetoken>
1004       <![CDATA[http://www.jalview.org/services/launchApp']]>
1005     </replacetoken>
1006     <fileset dir="${packageDir}/examples">
1007       <include name="**/*.html" />
1008     </fileset>
1009   </replace>
1010
1011 </target>
1012 <target name="sourcedoc" description="Create jalview source documentation pages" depends="init">
1013   <javadoc destdir="${javadocDir}">
1014     <packageset dir="${sourceDir}" includes="jalview/*,MCView/*">
1015     </packageset>
1016   </javadoc>
1017 </target>
1018 <target name="linkcheck" depends="init,prepare">
1019   <javac srcdir="utils" destdir="utils" includes="HelpLinksChecker.java"/>
1020   <java fork="true" dir="${helpDir}" classpath="utils" classname="HelpLinksChecker" failonerror="true">
1021     <arg file="${helpDir}"/>
1022     <arg value="-nointernet" />
1023   </java>
1024 </target>
1025
1026 <target name="eclipse-install" depends="init,prepare">
1027
1028   <property name="eclipseTempFile" value="eclipse-jee-oxygen-R-linux-gtk-x86_64.tar.gz"/>
1029   <property name="eclipseInstallURL" value="http://mirror.csclub.uwaterloo.ca/eclipse/technology/epp/downloads/release/oxygen/R/eclipse-jee-oxygen-R-linux-gtk-x86_64.tar.gz"/>
1030   <property name="java2scriptURL" value="https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/dropins/net.sf.j2s.core.jar?raw=true"/>
1031
1032   <get url="${eclipseInstallURL}" dest="${eclipseTempFile}"/>
1033   <untar compression="gzip" src="${eclipseTempFile}" dest="${eclipse-inst}"/>
1034
1035   <!-- not needed since we ship transpiler with source
1036     <get url="${java2scriptURL}" dest="eclipse-inst/dropins/net.sf.j2s.core.jar" /> -->
1037
1038 </target>
1039
1040 <target name="build-site" depends="init,prepare,compile-site,unzip-to-site,make-j2s-cores">
1041   <!-- tarball -->
1042   <tar compression="gzip" destfile="site.tar.gz">
1043     <tarfileset dir="site" />
1044   </tar>
1045 </target>
1046 <target name="prepare-site" depends="init,prepare,buildPropertiesFile">
1047   <property name="swingjsdir" value="swingjs"/>
1048   <property name="eclipse-inst" value="/home/bamboo/buildtools/eclipse/eclipse-js"/>
1049   <property name="eclipse-exec" value="${eclipse-inst}/eclipse"/>
1050   <property name="site" value="site"/>
1051   <!-- where the eclipse js workspace has been initialised -->
1052   <property name="eclipse-work" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace"/>
1053   <!-- git repository linked to project in workspace -->
1054   <property name="eclipse-workrepo" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace/jalview-js"/>
1055 </target>
1056   <target name="clean-site" depends="prepare-site">
1057     <delete dir="${eclipse-workrepo}/${site}"/>
1058     <mkdir dir="${eclipse-workrepo}/${site}"/>
1059   </target>
1060 <target name="compile-site" depends="prepare-site,clean-site">
1061   <!-- update transpiler -->
1062   <copy file="${swingjsdir}/net.sf.j2s.core.jar" todir="${eclipse-inst}/dropins" overwrite="true" failonerror="true"/>
1063   <!-- update the git repo linked to the eclipse workspace -->
1064   <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="true">
1065     <arg value="rev-parse" />
1066     <arg value="--short" />
1067     <arg value="HEAD" />
1068   </exec>
1069   <!-- update and checkout the same commit in the workspace project -->
1070   <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
1071     <arg value="reset" />
1072     <arg value="--hard" />
1073   </exec>
1074   <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
1075       <arg value="pull" />
1076   </exec>
1077   <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
1078     <arg value="checkout" />
1079     <arg value="${git.commit}" />
1080   </exec>
1081   <!-- custom classpath for .js builds -->
1082   <copy file=".classpath.js" tofile="${eclipse-workrepo}/.classpath" overwrite="true"/>
1083   <!-- clean eclipse log -->
1084   <delete file="${eclipse-work}/.metadata/.log"/>
1085     
1086   <!-- execute the eclipse build - the build may fail but valid javascript may still be produced, so we ignore return codes -->
1087   <exec executable="${eclipse-exec}" failonerror="no">
1088     <arg value="-nosplash"/>
1089     <arg value="--launcher.suppressErrors"/>
1090     <arg value="-application"/>
1091     <arg value="org.eclipse.jdt.apt.core.aptBuild"/>
1092     <arg value="-data"/>
1093     <arg value="${eclipse-work}"/>
1094   </exec>
1095   <!-- report log -->
1096   <exec executable="/bin/cat">
1097     <arg value="${eclipse-work}/.metadata/.log"/>
1098   </exec>
1099   <!-- TODO: run jslint and something else here to check we have a complete set of .js files for java -->
1100   <!-- possibly compare timestamps between .js files and their mate in source - any newer or not present triggers a new build -->
1101   <!-- <mkdir dir="${packageDir}/${site}" /> -->
1102   <!--   <property name="swingjs.zipurl" value="https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip?raw=true" /> -->
1103
1104   <!-- and reset the .classpath -->
1105   <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
1106     <arg value="checkout" />
1107     <arg value="${git.commit}"/>
1108     <arg value="--"/>
1109     <arg value=".classpath" />
1110   </exec>
1111
1112   <!-- finally copy artefacts from eclipse project checkout to the build site -->
1113   <copy todir="${site}">
1114     <fileset dir="${eclipse-workrepo}/site"/>
1115   </copy>  
1116 </target>
1117 <target name="unzip-to-site" depends="prepare-site">
1118   <ant antfile="build-site.xml"/>
1119 </target>
1120
1121   <target name="make-j2s-cores" depends="">
1122     <ant antfile="buildcore.xml" target="build-all-cores"/>
1123   </target>
1124 </project>