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