context dependent title for when called from desktop or alignment window menu
[jalview.git] / build.xml
1 <?xml version="1.0"?>
2   <project name="jalviewX" default="build" 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
14     <!-- utils is a class path to additional utilities needed for
15     building docs, jars and webstart stuff -->
16
17 <!--
18         Userdefined build property defaults
19
20         wsdl.server list (plus namespace mapping info ???)  - also want
21                 ... to make this a dynamically generatable property
22         WebStart Location
23         Build location - provide a temporary root for speed
24         jarsigner keystore and info
25         Jakarta and axis classpath ?
26         Default argument for starting Jalview (if it exists).
27
28 -->
29
30     <target name="init">
31       <path id="axis.classpath">
32 <!-->        <fileset dir="/usr/local/axis/lib">
33           <include name="**/*.jar" />
34         </fileset>
35         <fileset dir="/usr/local/jakarta-tomcat-5/webapps/axis/WEB-INF/lib">
36           <include name="**/*.jar"/>
37           <include name="*.jar"/>
38         </fileset> -->
39       </path>
40
41       <property name="JALVIEW_VERSION" value="2.07"/>
42       <property name="" value=""/>
43       <property name="libDir" value="lib"/>
44       <property name="resourceDir" value="resources"/>
45       <property name="helpDir" value="help"/>
46       <property name="docDir" value="doc"/>
47       <property name="sourceDir" value="src" />
48       <property name="outputDir" value="classes" />
49       <property name="packageDir" value="dist" />
50       <property name="outputJar" value="jalview.jar" />
51       <property name="wsdl.File" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred?wsdl" />
52       <property name="wsdl.Files" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/vamsas?wsdlFiles" />
53       <property name="wsdl.MsaWS" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS?wsdl" />
54       <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
55       <property name="wsdl.MsaWS2" value="http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS?wsdl" />
56         <property name="WSInterf" value="MsaWS" />
57       <property name="WebStartLocation" value="http://www.jalview.org/webstart"/>
58       <property name="wsdl.Namespace" value="vamsas" />
59       <property name="wsdl.ClientNS" value="ext.vamsas" />
60
61       <path id="build.classpath">
62         <fileset dir="utils">
63           <include name="*.jar"/>
64           <include name="**/*.jar"/>
65         </fileset>
66         <fileset dir="${libDir}">
67           <include name="*.jar"/>
68           <include name="**/*.jar"/>
69         </fileset>
70 <!--        <fileset dir="old_lib_signed">
71 <include name="lib_axis.jar"/>
72
73         </fileset>-->
74       </path>
75       <!-->    <uptodate property="help.uptodate"
76       targetfile="${helpDir}/helpIndex.xml">
77       <srcfiles
78                  dir="${helpDir}"
79                  includes="**/*.html" />
80                </uptodate>
81       -->
82     </target>
83
84
85     <taskdef classpath="utils/roxes-ant-tasks-1.2-2004-01-30.jar" resource="com/roxes/tools/ant/taskdefs.properties"/>
86     <target name="buildPropertiesFile" depends="init">
87       <tstamp prefix="build">
88         <format property="date" pattern="dd MMMM yyyy"/>
89       </tstamp>
90       <properties file="${outputDir}/.build_properties">
91         <header>
92           ---Jalview Build Details---
93         </header>
94         <property name="VERSION" value="${JALVIEW_VERSION}"/>
95         <property name="BUILD_DATE" value="${build.date}"/>
96       </properties>
97     </target>
98
99
100     <target name="clean" depends="init">
101       <!-- not efficient yet. -->
102       <delete dir="${outputDir}"/>
103     </target>
104
105     <target name="distclean" depends="init, clean">
106
107       <echo message="REMOVING ALL BACKUP/AUTOSAVES!"/>
108       <delete>
109         <fileset dir=".">
110           <include name="${outputJar}"/>
111           <include name="#*#"/>
112           <include name="#*.*#"/>
113           <include name="**/#*#"/>
114           <include name="**/#*.*#"/>
115           <include name="*~"/>
116           <include name="*.*~"/>
117           <include name="**/*~"/>
118           <include name="**/*.*~"/>
119         </fileset>
120       </delete>
121     </target>
122
123     <target name="prepare" depends="init">
124       <mkdir dir="${outputDir}"/>
125       <copy todir="${outputDir}">
126         <fileset dir=".">
127           <include name="${docDir}/**/*.*"/>
128           <include name="${helpDir}/**/*.*"/>
129           <include name="${libDir}/*.jar"/>
130         </fileset>
131         <fileset dir="${resourceDir}">
132           <include name="**/*.*"/>
133         </fileset>
134       </copy>
135     </target>
136
137     <target name="build" depends="prepare">
138       <!-- not efficient yet. -->
139       <javac source="1.4" target="1.4"
140         srcdir ="${sourceDir}"
141         destdir="${outputDir}"
142       classpathref="build.classpath">
143       <exclude name="jalview/*applet*"/>
144        <exclude name="com/stevesoft/**"/>
145       </javac>
146     </target>
147     <target name="buildindices" depends="init, prepare"
148     unless="help.uptodate">
149     <java
150       classname="com.sun.java.help.search.Indexer"
151       classpathref="build.classpath"
152       fork="true"
153       dir="${outputDir}/${helpDir}"
154       >
155       <arg line="html"/>
156     </java>
157     </target>
158
159     <target name="makejars" depends="build, buildPropertiesFile, buildindices">
160       <!-- make the package jar -->
161       <mkdir dir="${packageDir}"/>
162
163       <jar destfile="${packageDir}/${outputJar}">
164         <manifest>
165              <attribute name="Main-Class" value="jalview.bin.Jalview"/>
166         </manifest>
167         <fileset dir="${outputDir}/">
168           <exclude name="cache*/**"/>
169           <exclude name="*.jar" />
170           <exclude name="*.jar.*" />
171           <exclude name="**/*.jar" />
172           <exclude name="**/*.jar.*" />
173         </fileset>
174       </jar>
175
176       <copy toDir="${packageDir}" flatten="true">
177         <fileset dir="${outputDir}">
178           <include name="*.jar"/>
179           <include name="**/*.jar"/>
180         </fileset>
181       </copy>
182 <!-- the default keystore details might need to be edited here -->
183       <signjar
184       storepass="alignmentisfun"
185       keypass="alignmentisfun"
186       keystore="keys/.keystore"
187       alias="jalview"
188       lazy="false"
189       verbose="false"
190       >
191
192       <fileset dir="${packageDir}">
193         <include name="*.jar"/>
194       </fileset>
195       </signjar>
196       <taskdef classpathref="build.classpath" resource="com/roxes/tools/ant/taskdefs.properties"/>
197
198       <!--    codebase="http://www.jalview.org/jalview/webstart" -->
199       <jnlp toFile="${packageDir}/jalview.jnlp" href="jalview.jnlp"
200       codebase="${WebStartLocation}">
201       <information>
202         <title>Jalview</title>
203         <vendor>The Barton Group</vendor>
204         <homepage href="http://www.jalview.org"/>
205         <description>Jalview Multiple Alignment Editor</description>
206         <description kind="short">Jalview</description>
207         <icon href="logo_big.gif"/>
208         <offline_allowed/>
209         <!--
210         <association mime-type="application-x/ext-file" extensions="fa"/>
211         <association mime-type="application-x/ext-file" extensions="fasta"/>
212         <association mime-type="application-x/ext-file" extensions="fastq"/>
213         <association mime-type="application-x/ext-file" extensions="blc"/>
214         <association mime-type="application-x/ext-file" extensions="msf"/>
215         <association mime-type="application-x/ext-file" extensions="pfam"/>
216         <association mime-type="application-x/ext-file" extensions="aln"/>
217         <association mime-type="application-x/ext-file" extensions="pir"/>
218         -->
219        </information>
220         <resources>
221           <j2se version="1.4+"/>
222           <fileset dir="${packageDir}">
223             <include name="jalview.jar"/>
224           </fileset>
225           <fileset dir="${packageDir}">
226             <include name="*.jar"/>
227             <exclude name="jalview.jar"/>
228           </fileset>
229           <property name="jalview.version" value="${JALVIEW_VERSION}"/>
230         </resources>
231         <application_desc main_class="jalview.bin.Jalview">
232           </application_desc>
233         <security>
234           <all_permissions/>
235         </security>
236       </jnlp>
237     </target>
238     <target name="runenv" depends="init">
239       <path id="run.classpath">
240         <pathelement location="${outputDir}"/>
241         <fileset dir="${outputDir}">
242           <include name="${libDir}/*.jar"/>
243         </fileset>
244       </path>
245       <pathconvert targetos="unix" refid="run.classpath" property="run.classpath"/>
246
247       <echo>java -classpath ${run.classpath} jalview.bin.Jalview
248       </echo>
249     </target>
250
251     <target name="buildextclients" depends="init">
252 <!-- Currently, this doesn't happen automatically.
253      1. Run WSDL2Java as below, which generates an ext.vamsas +
254      vamsas.<datapackages> fileset.
255      2. refactor ext.vamsas.SpecificserviceWS* to
256      ext.vamsas.ServiceclassWS* that implements the ServiceclassWSI interface.
257      3. Update the jalview.ws.*WServices classes to reflect the
258      interface type, and all locations of this wsdl type that Jalview
259      might be using.
260
261 -->
262       <path id="axisbuild">
263         <!--        <path refid="axis.classpath"/> -->
264         <path refid="build.classpath"/>
265       </path>
266       <taskdef resource="axis-tasks.properties" classpathref="axisbuild"/>
267       <move todir="./bak">
268         <fileset dir="${sourceDir}" id="client">
269           <include name="${wsdl.ClientNS}/*.*"/>
270         </fileset>
271       </move>
272
273       <axis-wsdl2java
274       output="${sourceDir}"
275       verbose="true"
276       url="${wsdl.MsaWS2}"
277       serverside="false"
278       deployscope="Request"
279       debug="false"
280       helpergen="true"
281       all="true"
282       >
283       <mappingSet>
284         <mapping
285         namespace="${wsdl.Namespace}"
286         package="${wsdl.ClientNS}"
287         />
288         <mapping namespace="http://dataTypes.vamsas"
289         package="${wsdl.ClientNS}"/>
290         </mappingSet>
291     </axis-wsdl2java>
292
293   </target>
294   <target name="package" depends="init, build">
295
296   </target>
297   <!-- jalopy code reformatter -->
298   <target name="sourcescrub" depends="init,build">
299     <jalopy destdir="jsrc" classpathref="run.classpath"
300       convention="jalview-jalopy.xml">
301       <fileset dir="${sourceDir}">
302         <include name="*.java"/>
303         <include name="**/*.java"/>
304         <include name="**/**/*.java"/>
305       </fileset>
306       </jalopy>
307   </target>
308
309
310
311   <!-- Compile, package and obfuscate Jalview Applet -->
312   <target name="makeApplet" depends="obfuscate"/>
313
314   <target name="compileApplet" depends="init,clean">
315     <mkdir dir="${outputDir}"/>
316     <javac source="1.2" target="1.1" srcdir="${sourceDir}" destdir="${outputDir}"
317        includes="jalview/analysis/**,jalview/appletgui/**,jalview/datamodel/**jalview/jbappletgui/**,jalview/math/**,jalview/schemes/**"
318        excludes="ext/**,MCview/**,org/**,vamsas/**"/>
319   </target>
320
321   <target name="packageApplet" depends="compileApplet, buildPropertiesFile">
322   <copy file="${resourceDir}/images/idwidth.gif" toFile="${outputDir}/images/idwidth.gif"/>
323        <jar destfile="in.jar">
324         <manifest>
325             <attribute name="Main-Class" value="jalview.bin.JalviewLite"/>
326         </manifest>
327         <fileset dir="${outputDir}">
328           <include name="com/**"/>
329           <include name="jalview/**"/>
330           <include name=".build_properties"/>
331           <include name="images/idwidth.gif"/>
332         </fileset>
333       </jar>
334   </target>
335
336   <target name="obfuscate" depends="packageApplet">
337     <taskdef resource="proguard/ant/task.properties" classpath="utils/proguard.jar" />
338     <proguard>
339       -libraryjars "${java.home}/lib/rt.jar"
340       -injars      in.jar
341       -outjars     jalviewApplet.jar
342       -keep public class jalview.bin.JalviewLite
343                 { public static void main(java.lang.String[]);}
344     </proguard>
345     <delete file="in.jar"/>
346   </target>
347
348
349 </project>