exclude any InstallAnywhere build artefacts
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2 <project name="jalviewX" default="usage" basedir=".">
3         <!-- we use jalopy to format our sources -->
4         <taskdef name="jalopy"
5          classname="de.hunsicker.jalopy.plugin.ant.AntPlugin">
6                 <classpath>
7                         <fileset dir="utils/jalopy/lib">
8                                 <include name="*.jar" />
9                         </fileset>
10                 </classpath>
11         </taskdef>
12
13         <target name="help" depends="usage"/>
14         <target name="usage">
15                 <echo message="~~~Jalview Ant build.xml Usage~~~~"/>
16                 <echo message="Targets include:"/>
17                 <echo message="usage - default target, displays this message"/>
18                 <echo message="buildindices - generates JavaHelpSearch from the help files"/>
19                 <echo message="build - compiles all necessary files for Application"/>
20                 <echo message="makedist - compiles and places all necessary jar files into directory dist"/>
21                 <echo message="makefulldist - signs all jar files and builds jnlp file for full distribution"/>
22                 <echo message="              this needs a keystore and key. See docs/building.html for more information."/>
23                 <echo message="compileApplet - compiles all necessary files for Applet"/>
24                 <echo message="makeApplet - compiles, then packages and obfuscates the Applet"/>
25                 <echo message="See docs/building.html and the comments in build file for other targets."/>
26             <echo message="note: compile and makeApplet require the property java118.home to be set to point to a java 1.1.8 jdk."/>
27         </target>
28
29
30         <!-- utils is a class path to additional utilities needed for
31     building docs, jars and webstart stuff -->
32         <!--
33         Userdefined build property defaults
34
35         wsdl.server list (plus namespace mapping info ???)  - also want
36                 ... to make this a dynamically generatable property
37         WebStart Location
38         Build location - provide a temporary root for speed
39         jarsigner keystore and info
40         Jakarta and axis classpath ?
41         Default argument for starting Jalview (if it exists).
42
43 -->
44
45         <target name="init">
46                 <path id="axis.classpath">
47                         <!-->
48                         <fileset dir="/usr/local/axis/lib">
49                                 <include name="**/*.jar" />
50                         </fileset>
51                         <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
52                                 <include name="**/*.jar"/>
53                                 <include name="*.jar"/>
54                         </fileset> -->
55       </path>
56                 <!-- Jalview Version String displayed by application on startup and used to check for updates -->
57     <property name="JALVIEW_VERSION" value="DEVELOPMENT"/> <!-- 2.4 (VAMSAS)" -->
58                 <!-- Include debugging information in javac true or false -->
59                 <property name="javac.debug" value="true"/>
60                 <!-- Don't change anything below here unless you know what you are doing! -->
61                 <!-- Url path for WebStart in JNLP file -->
62                 <property name="WebStartLocation" value="http://www.jalview.org/webstart"/>
63                 <!-- build directory configuration -->
64                 <property name="libDir" value="lib"/>
65                 <property name="resourceDir" value="resources"/>
66                 <property name="helpDir" value="help"/>
67                 <property name="docDir" value="doc"/>
68                 <property name="sourceDir" value="src" />
69                 <property name="schemaDir" value="schemas" />
70                 <property name="outputDir" value="classes" />
71                 <property name="packageDir" value="dist" />
72                 <property name="outputJar" value="jalview.jar" />
73           <!-- Jalview Applet JMol Jar Dependency -->
74     <property name="jmolJar" value="Jmol-11.0.2.jar" />
75                 <property name="jalviewLiteJar" value="jalviewApplet.jar"/>
76                 <!-- switch to indicate if we should obfuscate jalviewLite -->
77                 <!--<property name="donotobfuscate" value="true"/> -->
78                                 
79                 <!-- Jalview Web Service Clients - see the comments in 'buildextclients' for details -->
80                 <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
81                 <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
82                 <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
83                 <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
84                 <property name="WSInterf" value="MsaWS" />
85                 <property name="wsdl.Namespace" value="vamsas" />
86                 <property name="wsdl.ClientNS" value="ext.vamsas" />
87                 <!-- the class path for building the application -->
88                 <path id="build.classpath">
89                         <fileset dir="utils">
90                                 <include name="*.jar"/>
91                                 <include name="**/*.jar"/>
92                         </fileset>
93                         <fileset dir="${libDir}">
94                                 <include name="*.jar"/>
95                                 <include name="**/*.jar"/>
96                         </fileset>
97                         
98                 </path>
99                 <property name="source.dist.name" value="${basedir}/jalview-src.tar.gz"/>
100                 <!-- The Location of the java 1.1.8 jdk -->
101                 <property name="java118.home" value="C:\Sun\jdk1.1.8" />
102                 <property name="applet.jre.tools" value="${java118.home}/lib/classes.zip"/>
103                 <!-- jre for 1.4 version
104                 <property name="applet.jre.tools" value="${java.home}/lib/rt.jar"/>
105                 -->
106                 <!-- the classpath for building the 1.1 applet -->
107                 <path id="jalviewlite.deps">
108                         <fileset dir="${java118.home}">
109                                 <include name="lib/classes.zip"/>
110                         </fileset>
111                 <pathelement location="lib/${jmolJar}"/>
112           </path>
113         </target>
114
115
116         <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties"/>
117         <target name="buildPropertiesFile" depends="init">
118                 <tstamp prefix="build">
119                         <format property="date" pattern="dd MMMM yyyy"/>
120                 </tstamp>
121                 <properties file="${outputDir}/.build_properties">
122                         <header>
123           ---Jalview Build Details---
124         </header>
125                         <property name="VERSION" value="${JALVIEW_VERSION}"/>
126                         <property name="BUILD_DATE" value="${build.date}"/>
127                 </properties>
128         </target>
129
130
131         <target name="clean" depends="init">
132                 <!-- not efficient yet. -->
133                 <delete dir="${outputDir}"/>
134         </target>
135
136         <target name="distclean" depends="init, clean">
137
138                 <echo message="REMOVING ALL BACKUP/AUTOSAVES!"/>
139                 <delete>
140                         <fileset dir=".">
141                                 <include name="${outputJar}"/>
142                                 <include name="#*#"/>
143                                 <include name="#*.*#"/>
144                                 <include name="**/#*#"/>
145                                 <include name="**/#*.*#"/>
146                                 <include name="*~"/>
147                                 <include name="*.*~"/>
148                                 <include name="**/*~"/>
149                                 <include name="**/*.*~"/>
150                         </fileset>
151                 </delete>
152         </target>
153
154         <target name="prepare" depends="init">
155                 <mkdir dir="${outputDir}"/>
156                 <copy todir="${outputDir}">
157                         <fileset dir=".">
158                                 <include name="${docDir}/**/*.*"/>
159                                 <include name="${helpDir}/**/*.*"/>
160                                 <include name="${libDir}/*.jar"/>
161                         </fileset>
162                         <fileset dir="${resourceDir}">
163                                 <include name="**/*.*"/>
164                         </fileset>
165                 </copy>
166         </target>
167
168         <target name="build" depends="prepare">
169                 <!-- not efficient yet. -->
170                 <javac source="1.4" target="1.4"
171         srcdir ="${sourceDir}"
172         destdir="${outputDir}"
173                                 debug="${javac.debug}"
174       classpathref="build.classpath">
175                         <exclude name="jalview/*applet*"/>
176                         <exclude name="com/stevesoft/**"/>
177                 </javac>
178         </target>
179         <target name="buildindices" depends="init, prepare"
180     unless="help.uptodate">
181                 <java
182       classname="com.sun.java.help.search.Indexer"
183       classpathref="build.classpath"
184       fork="true"
185       dir="${outputDir}/${helpDir}"
186       >
187                         <arg line="html"/>
188                 </java>
189         </target>
190
191         <target name="makefulldist" depends="makedist">
192                 <!-- the default keystore details might need to be edited here -->
193                 <signjar
194       storepass="alignmentisfun"
195       keypass="alignmentisfun"
196       keystore="keys/.keystore"
197       alias="jalview"
198       lazy="false"
199       verbose="false"
200       >
201
202                         <fileset dir="${packageDir}">
203                                 <include name="*.jar"/>
204                         </fileset>
205                 </signjar>
206                 <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties"/>
207
208                 <!--    codebase="http://www.jalview.org/jalview/webstart" -->
209                 <!-- href="jalview.jnlp" prevent hard-wired pickup of jnlp in certain javaws versions -->
210                 <jnlp toFile="${packageDir}/jalview.jnlp" 
211       codebase="${WebStartLocation}">
212                         <information>
213                                 <title>Jalview</title>
214                                 <vendor>The Barton Group</vendor>
215                                 <homepage href="http://www.jalview.org"/>
216                                 <description>Jalview Multiple Alignment Editor</description>
217                                 <description kind="short">Jalview</description>
218                                 <icon href="logo_big.gif"/>
219                                 <offline_allowed/>
220                                 <!--
221         <association mime-type="application-x/ext-file" extensions="fa"/>
222         <association mime-type="application-x/ext-file" extensions="fasta"/>
223         <association mime-type="application-x/ext-file" extensions="fastq"/>
224         <association mime-type="application-x/ext-file" extensions="blc"/>
225         <association mime-type="application-x/ext-file" extensions="msf"/>
226         <association mime-type="application-x/ext-file" extensions="pfam"/>
227         <association mime-type="application-x/ext-file" extensions="aln"/>
228         <association mime-type="application-x/ext-file" extensions="pir"/>
229         <association mime-type="application-x/ext-file" extensions="amsa"/>
230         -->
231                         </information>
232                         <resources>
233                                 <j2se version="1.4+"/>
234                                 <fileset dir="${packageDir}">
235                                         <include name="jalview.jar"/>
236                                 </fileset>
237                                 <fileset dir="${packageDir}">
238                                         <include name="*.jar"/>
239                                         <exclude name="jalview.jar"/>
240                                 </fileset>
241                                 <property name="jalview.version" value="${JALVIEW_VERSION}"/>
242                         </resources>
243                         <application_desc main_class="jalview.bin.Jalview">
244                         </application_desc>
245                         <security>
246                                 <all_permissions/>
247                         </security>
248                 </jnlp>
249         </target>
250         <target name="runenv" depends="init">
251                 <path id="run.classpath">
252                         <pathelement location="${outputDir}"/>
253                         <fileset dir="${outputDir}">
254                                 <include name="${libDir}/*.jar"/>
255                         </fileset>
256                 </path>
257                 <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
258
259                 <echo>java -classpath ${run.classpath} jalview.bin.Jalview
260       </echo>
261         </target>
262
263         <target name="buildextclients" depends="init">
264                 <input message="Building external client source from WSDLs - Do you really want to do this ? (Yy/Nn)"
265       validargs="Y,y,n,N" defaultvalue="N"
266       addproperty="doextbuild.response"/>
267                 <condition property="dontextbuild">
268                         <equals arg1="n" arg2="${doextbuild.response}"/>
269                 </condition>
270                 <condition property="dontextbuild">
271                         <equals arg1="N" arg2="${doextbuild.response}"/>
272                 </condition>
273                 <fail if="dontextbuild">
274         Build External Client Code process aborted by user. Jalview source is unchanged.
275       </fail>
276                 <!-- Currently, this doesn't happen automatically.
277      1. Run WSDL2Java as below, which generates an ext.vamsas +
278      vamsas.<datapackages> fileset.
279      2. refactor ext.vamsas.SpecificserviceWS* to
280      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
281      3. Update the jalview.ws.*WServices classes to reflect the
282      interface type, and all locations of this wsdl type that Jalview
283      might be using.
284
285 -->
286                 <path id="axisbuild">
287                         <path refid="build.classpath"/>
288                 </path>
289                 <taskdef resource="axis-tasks.properties" classpathref="axisbuild"/>
290                 <move todir="./bak">
291                         <fileset dir="${sourceDir}" id="client">
292                                 <include name="${wsdl.ClientNS}/*.*"/>
293                         </fileset>
294                 </move>
295
296                 <axis-wsdl2java
297       output="${sourceDir}"
298       verbose="true"
299       url="${wsdl.MsaWS2}"
300       serverside="false"
301       deployscope="Request"
302       debug="false"
303       helpergen="true"
304       all="true"
305       >
306                         <mappingSet>
307                                 <mapping
308         namespace="${wsdl.Namespace}"
309         package="${wsdl.ClientNS}"
310         />
311                                 <mapping namespace="http://dataTypes.vamsas"
312         package="${wsdl.ClientNS}"/>
313                         </mappingSet>
314                 </axis-wsdl2java>
315         </target>
316
317         <target name="makedist" depends="build, buildPropertiesFile, buildindices">
318                 <!-- make the package jar -->
319                 <mkdir dir="${packageDir}"/>
320
321                 <jar destfile="${packageDir}/${outputJar}">
322                         <manifest>
323                                 <attribute name="Main-Class" value="jalview.bin.Jalview"/>
324                         </manifest>
325                         <fileset dir="${outputDir}/">
326                                 <exclude name="cache*/**"/>
327                                 <exclude name="*.jar" />
328                                 <exclude name="*.jar.*" />
329                                 <exclude name="**/*.jar" />
330                                 <exclude name="**/*.jar.*" />
331                         </fileset>
332                 </jar>
333
334                 <copy toDir="${packageDir}" flatten="true">
335                         <fileset dir="${outputDir}">
336                                 <include name="*.jar"/>
337                                 <include name="**/*.jar"/>
338                         </fileset>
339                 </copy>
340         </target>
341
342
343         <!-- jalopy code reformatter -->
344         <target name="sourcescrub" depends="init,build">
345                 <jalopy destdir="jsrc" classpathref="run.classpath"
346       convention="jalview-jalopy.xml">
347                         <fileset dir="${sourceDir}">
348                                 <include name="*.java"/>
349                                 <include name="**/*.java"/>
350                                 <include name="**/**/*.java"/>
351                         </fileset>
352                 </jalopy>
353         </target>
354
355
356
357   <!-- Compile, package and obfuscate Jalview Applet -->
358   <target name="makeApplet" depends="obfuscate"/>
359
360   <target name="compileApplet" depends="init,clean">
361     <mkdir dir="${outputDir}"/>
362     <javac source="1.2"
363     target="1.1"
364     srcdir="${sourceDir}" 
365     destdir="${outputDir}"
366         debug="${javac.debug}"
367     classpath="lib/${jmolJar}"
368        includes="jalview/appletgui/**"
369        excludes="ext/**,MCview/**,org/**,vamsas/**"
370        />
371   </target>
372
373   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
374   <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif"/>
375   <copy file="${resourceDir}/images/link.gif" toFile="${outputDir}/images/link.gif"/>
376        <jar destfile="in.jar">
377         <manifest>
378             <attribute name="Main-Class" value="jalview.bin.JalviewLite"/>
379         </manifest>
380         <fileset dir="${outputDir}">
381           <include name="com/**"/>
382           <include name="MCview/**"/>
383           <include name="jalview/**"/>
384           <include name=".build_properties"/>
385           <include name="images/idwidth.gif"/>
386           <include name="images/link.gif"/>
387         </fileset>
388       </jar>
389   </target>
390   <target name="obfuscate" depends="-obfuscatefake,-obfuscatereally" description="construct the final jalviewLite applet jar with or without obfuscation">
391   </target>
392         <target name="-obfuscatefake" depends="packageApplet" if="donotobfuscate">    
393         <copy file="in.jar" tofile="${jalviewLiteJar}" />       
394     <delete file="in.jar"/>
395   </target>
396         <target name="-obfuscatereally" unless="donotobfuscate">
397     
398         <path id="obfuscateDeps.path">
399     <pathelement location="${applet.jre.tools}"/>
400     <pathelement location="lib/${jmolJar}"/>
401     </path>
402     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
403         
404     <proguard>
405       <injar file="in.jar"/>
406       <outjar file="${jalviewLiteJar}"/>
407       <libraryjar refid="obfuscateDeps.path"/>
408       <keep access="public" type="class"
409       name="jalview.bin.JalviewLite">
410         <field access="public"/>
411         <method access="public"/>
412         <constructor access="public"/>
413       </keep>
414 <!--      -libraryjars "${obfuscateDeps}"
415       -injars      in.jar
416       -outjars     jalviewApplet.jar
417       -keep public class jalview.bin.JalviewLite
418        { public * ; } -->
419       </proguard>
420     <delete file="in.jar"/>
421   </target>
422
423         <target name="castorbinding" depends="init" description="Generate Java bindings to supported Jalview XML models.">
424                 <taskdef name="castor-srcgen"
425                           classname="org.castor.anttask.CastorCodeGenTask"
426                       classpathref="build.classpath" />
427                 <delete>
428                         <fileset dir="${sourceDir}/jalview/schemabinding/version2">
429                                 <include name="*.java"/>
430                                 <include name="descriptors/*.java"/>
431                         </fileset>
432                 </delete>
433                 <castor-srcgen file="${schemaDir}/vamsas.xsd"
434                               todir="${sourceDir}"
435                               package="jalview.schemabinding.version2"
436                               warnings="false" 
437                                         nodesc="false"
438                                                 verbose="true"
439                                                 properties="${schemaDir}/jalview.properties"
440                 />
441                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
442                               todir="${sourceDir}"
443                               package="jalview.schemabinding.version2"
444                               warnings="false" 
445                                         nodesc="false"
446                                                 verbose="true"
447                                                 properties="${schemaDir}/jalview.properties"
448                 />
449                 <castor-srcgen file="${schemaDir}/jalview.xsd"
450                               todir="${sourceDir}"
451                               package="jalview.schemabinding.version2"
452                               warnings="false" 
453                                           nodesc="false"
454                                                 verbose="true"
455                                                 properties="${schemaDir}/jalview.properties"
456                         
457                 />
458                 <!-- 
459                 now build the jalview.binding package with the old schema set
460                 -->
461                 <delete>
462                         <fileset dir="${sourceDir}/jalview/binding/">
463                                 <include name="**"/>
464                         </fileset>
465                 </delete>
466                 <castor-srcgen file="${schemaDir}/vamsasJvV1.xsd"
467                               todir="${sourceDir}"
468                               package="jalview.binding"
469                               warnings="false" 
470                                         nodesc="true"
471                                                 verbose="true"
472                                                 properties="${schemaDir}/jalview.nodesc.properties"
473                 /> 
474                 <castor-srcgen file="${schemaDir}/JalviewUserColours.xsd"
475                               todir="${sourceDir}"
476                               package="jalview.binding"
477                               warnings="false" 
478                                         nodesc="true"
479                                                 verbose="true"
480                                                 properties="${schemaDir}/jalview.nodesc.properties"
481                 />
482                 <castor-srcgen file="${schemaDir}/jalviewJvV1.xsd"
483                               todir="${sourceDir}"
484                               package="jalview.binding"
485                               warnings="false" 
486                                           nodesc="true"
487                                                 verbose="true"
488                                                 properties="${schemaDir}/jalview.nodesc.properties"
489         />
490         </target>
491         <target name="sourcedist" description="create jalview source distribution" depends="init">
492                 <delete file="${source.dist.name}"/>
493                 <tar destfile="${source.dist.name}" compression="gzip">
494                         <tarfileset dir="./" prefix="jalview" preserveLeadingSlashes="true">
495                                 <include name="LICENSE"/>
496                                 <include name="README"/>
497                                 <include name="build.xml"/>
498                                 <include name="jalview-jalopy.xml"/>
499                                 <include name="JalviewApplet.jpx"/>
500                                 <include name="JalviewX.jpx"/>
501                                 <include name="${sourceDir}/*.java"/>
502                                 <include name="${sourceDir}/**/*.java"/>
503                                 <include name="${sourceDir}/**/*.cdr"/>
504                                 <include name="${libDir}/**/*"/>                                                
505                                 <include name="${resourceDir}/**/*"/>                                           
506                                 <include name="${helpDir}/**/*"/>                                               
507                                 <exclude name="**/*locales"/>
508                                 <exclude name="*locales/**"/>
509                                 <exclude name="utils/InstallAnywhere/**Build.iap_xml"/>
510                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
511                                 <exclude name="utils/InstallAnywhere/**Build*/**"/>
512                                 <exclude name="utils/InstallAnywhere/**locale*"/>
513                                 <exclude name="utils/InstallAnywhere/**locale*/**"/>
514                                 <include name="${schemaDir}/**/*"/>                                             
515                                 <include name="utils/**/*"/>
516                                 <include name="${docDir}/**/*"/>                                                
517                         </tarfileset>
518                 </tar>
519         </target>
520 </project>