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