source: trunk/build.xml @ 1292

Revision 1292, 19.0 KB checked in by curtis, 14 years ago (diff)

More hacks to avoid problems with disappearing file permissions.

Line 
1<!--
2build.xml
3
4Master ant build file for all Java software projects at LOCI.
5Download Apache Ant from http://ant.apache.org/.
6Type "ant -p" for a list of targets.
7
8===============================================================================
9This build file handles the following projects:
10
11Bio-Formats
12    JAR file:      bio-formats.jar
13    Folders:       loci/formats
14                   loci/formats/*
15    Main class:    loci.formats.ImageViewer
16    Dependencies:  None
17    Targets:       jar-formats
18
19VisBio
20    JAR file:      visbio.jar
21    Folders:       loci/visbio
22                   loci/visbio/*
23    Main class:    loci.visbio.VisBio
24    Dependencies:  bio-formats.jar
25                   commons-httpclient-2.0-rc2.jar (ome-java.jar)
26                   commons-logging.jar (ome-java.jar)
27                   forms-1.0.4.jar
28                   ij.jar
29                   looks-1.2.2.jar
30                   ome-java.jar
31                   visad.jar
32                   xmlrpc-1.2-b1.jar (ome-java.jar)
33    Targets:       jar-visbio
34                   dist-visbio
35
36LOCI Plugins for ImageJ
37    JAR file:      loci_plugins.jar
38    Folders:       loci/plugins
39                   loci/plugins/*
40                   loci/ome/viewer (temporary)
41    Main class:    loci.plugins.About
42    IJ plugins:    loci.plugins.browser.LociDataBrowser
43                   loci.plugins.LociImporter
44                   loci.plugins.LociExporter
45                   loci.plugins.ome.OMEPlugin
46    Dependencies:  bio-formats.jar
47                   commons-httpclient-2.0-rc2.jar (ome-java.jar)
48                   commons-logging.jar (ome-java.jar)
49                   ome-java.jar
50                   xmlrpc-1.2-b1.jar (ome-java.jar)
51    Targets:       jar-plugins
52
53OME Metadata Notebook
54    JAR file:      ome-notebook.jar
55    Folders:       loci/ome/notebook
56                   loci/ome/viewer (temporary)
57    Main class:    loci.ome.notebook.MetadataNotebook
58    Dependencies:  bio-formats.jar
59                   commons-httpclient-2.0-rc2.jar (ome-java.jar)
60                   commons-logging.jar (ome-java.jar)
61                   forms-1.0.4.jar
62                   ome-java.jar
63                   xmlrpc-1.2-b1.jar (ome-java.jar)
64    Targets:       jar-notebook
65
66Leica Converter
67    JAR file:      LeicaConverter.jar
68    Folders:       loci/apps/leica
69    Main class:    loci.apps.leica.LeicaConverter
70    Dependencies:  bio-formats.jar
71                   ome-java.jar
72    Targets:       jar-leica
73
74QT TIFF Converter
75    JAR file:      QTConverter.jar
76    Folders:       loci/apps/qt
77                   some loci/formats
78    Main class:    loci.apps.qt.QTConverter
79    Dependencies:  None (custom built)
80    Targets:       jar-qt
81
82Slim Plotter
83    JAR file:      SlimPlotter.jar
84    Folders:       loci/apps/slim
85                   some loci/formats and loci/visbio
86    Main class:    loci.apps.slim.SlimPlotter
87    Dependencies:  visad.jar
88    Targets:       jar-slim
89
90===============================================================================
91The following external dependencies (in the jar folder) may be required:
92
93Apple eAWT stubs
94    JAR file:  AppleJavaExtensions.jar
95    URL:       http://developer.apple.com/samplecode/AppleJavaExtensions/
96    Notes:     Required to compile VisBio on non-Mac OS X machines
97
98Apache Jakarta Commons HttpClient
99    JAR file:  commons-httpclient-2.0-rc2.jar
100    URL:       http://jakarta.apache.org/commons/httpclient/
101    Notes:     Required for OME Java to communicate with OME servers
102
103Apache Jakarta Commons Logging
104    JAR file:  commons-logging.jar
105    URL:       http://jakarta.apache.org/commons/logging/
106    Notes:     Used by OME Java
107
108JGoodies Forms
109    JAR file:  forms-1.0.4.jar
110    URL:       http://www.jgoodies.com/freeware/forms/index.html
111    Notes:     Used for layout by VisBio and OME Metadata Notebook
112
113ImageJ
114    JAR file:  ij.jar
115    URL:       http://rsb.info.nih.gov/ij/
116    Notes:     Bundled with VisBio to achieve ImageJ interconnectivity
117
118JGoodies Looks
119    JAR file:  looks-1.2.2.jar
120    URL:       http://www.jgoodies.com/freeware/looks/index.html
121    Notes:     Used for a nicer Look & Feel by VisBio
122
123OME Java
124    JAR file:  ome-java.jar
125    URL:       http://openmicroscopy.org/api/java/
126    Notes:     Used by VisBio and the OME Plugin for ImageJ to connect to OME;
127               used by Bio-Formats and the OME Notebook to work with OME-XML
128
129Apache Jakarta POI
130    JAR file:  poi-2.5.1-final-20040804.jar
131    URL:       http://jakarta.apache.org/poi/
132    Notes:     Not used (previously used by Bio-Formats)
133
134Skin Look and Feel
135    JAR file:  skinlf.jar
136    URL:       http://skinlf.l2fprod.com/
137    Notes:     Not used (may be used in the future for flexible skinning)
138
139VisAD
140    JAR file:  visad.jar
141    URL:       http://www.ssec.wisc.edu/~billh/visad.html
142    Notes:     Stripped down VisAD library used by VisBio and Slim Plotter
143
144Apache XML-RPC
145    JAR file:  xmlrpc-1.2-b1.jar
146    URL:       http://ws.apache.org/xmlrpc/
147    Notes:     Required for OME Java to communicate with OME servers
148-->
149
150<project name="LOCI Software" default="compile" basedir=".">
151  <description>
152    Master build file for all Java software projects at LOCI
153  </description>
154
155  <!-- Directories -->
156
157  <property name="src.dir" value="."/>
158  <property name="build.dir" value="build"/>
159  <property name="dest.dir" value="${build.dir}/src"/>
160  <property name="classes.dir" value="${build.dir}/classes"/>
161  <property name="jar.dir" value="${build.dir}/jar"/>
162  <property name="docs.dir" value="${build.dir}/docs"/>
163  <property name="dist.dir" value="${build.dir}/dist"/>
164
165  <!-- Global build targets -->
166
167  <property name="ext.jars" value="jar/AppleJavaExtensions.jar:jar/commons-httpclient-2.0-rc2.jar:jar/commons-logging.jar:jar/forms-1.0.4.jar:jar/ij.jar:jar/looks-1.2.2.jar:jar/ome-java.jar:jar/visad.jar:jar/xmlrpc-1.2-b1.jar"/>
168
169  <target name="init">
170    <tstamp>
171      <format property="DATE" pattern="d MMMMM yyyy"/>
172      <format property="YEAR" pattern="yyyy"/>
173    </tstamp>
174  </target>
175
176  <target name="compile" depends="copy-source"
177    description="compile LOCI software packages from source">
178    <mkdir dir="${classes.dir}"/>
179    <javac srcdir="${dest.dir}" destdir="${classes.dir}"
180      classpath="${ext.jars}" deprecation="true"/>
181  </target>
182
183  <target name="jars"
184    depends="jar-formats, jar-visbio, jar-plugins, jar-notebook, jar-leica, jar-qt, jar-slim"
185    description="generate JAR files for LOCI software packages"/>
186
187  <target name="docs" depends="init"
188    description="generate Javadocs for LOCI software packages">
189    <javadoc sourcepath="${dest.dir}" destdir="${docs.dir}/api"
190      author="true" version="true" use="true" windowtitle="LOCI Software API">
191      <packageset dir="${dest.dir}"/>
192      <doctitle><![CDATA[<h1>LOCI Software</h1>]]></doctitle>
193      <bottom><![CDATA[<i>Copyright &#169; ${YEAR} Laboratory for Optical and Computational Instrumentation</i>]]></bottom>
194      <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
195    </javadoc>
196  </target>
197
198  <target name="clean"
199    description="remove all build files">
200    <delete dir="${build.dir}"/>
201  </target>
202
203  <!-- Internal build targets -->
204
205  <property name="ignore.source"
206    value="loci/plugins/HandleExtraFileTypes.java *.tar.gz"/>
207
208  <target name="copy-source" depends="init">
209    <!-- copy binary files without filtering -->
210    <copy todir="${dest.dir}" preservelastmodified="true">
211      <fileset dir="${src.dir}" includes="loci/**" excludes="**/*.class **/*.java **/*.config **/*.txt ${ignore.source}"/>
212    </copy>
213    <!-- copy source files with filtering -->
214    <filter token="date" value="${DATE}"/>
215    <copy todir="${dest.dir}" filtering="true" preservelastmodified="true">
216      <fileset dir="${src.dir}" includes="loci/**" excludes="**/*.class ${ignore.source}"/>
217    </copy>
218  </target>
219
220  <target name="copy-jars">
221    <!-- copy needed external JARs into build jars folder -->
222    <copy todir="${jar.dir}" preservelastmodified="true">
223      <fileset dir="jar"/>
224    </copy>
225  </target>
226
227  <!-- Bio-Formats -->
228
229  <property name="formats.files" value="loci/browser/** loci/formats/**"/>
230  <property name="formats.resources" value="loci/formats/*.txt"/>
231
232  <target name="jar-formats" depends="compile"
233    description="generate Bio-Formats JAR file">
234    <copy todir="${classes.dir}" preservelastmodified="true">
235      <fileset dir="${src.dir}" includes="${formats.resources}"/>
236    </copy>
237    <mkdir dir="${jar.dir}"/>
238    <jar jarfile="${jar.dir}/bio-formats.jar" basedir="${classes.dir}"
239      includes="${formats.files}">
240      <manifest>
241        <attribute name="Main-Class" value="loci.formats.ImageViewer"/>
242      </manifest>
243    </jar>
244  </target>
245
246  <!-- VisBio -->
247
248  <property name="visbio.classpath" value="bio-formats.jar commons-httpclient-2.0-rc2.jar commons-logging.jar forms-1.0.4.jar ij.jar looks-1.2.2.jar ome-java.jar visad.jar xmlrpc-1.2-b1.jar"/>
249  <property name="visbio.files" value="loci/visbio/**"/>
250  <property name="visbio.resources" value="loci/visbio/classes.txt loci/visbio/*.png loci/visbio/*.gif loci/visbio/help/*.html loci/visbio/help/*.png loci/visbio/overlays/*.png loci/visbio/view/*.png"/>
251
252  <target name="jar-visbio"
253    depends="compile, copy-jars, jar-formats"
254    description="generate VisBio JAR file">
255    <copy todir="${classes.dir}" preservelastmodified="true">
256      <fileset dir="${src.dir}" includes="${visbio.resources}"/>
257    </copy>
258    <jar jarfile="${jar.dir}/visbio.jar" basedir="${classes.dir}"
259      includes="${visbio.files}">
260      <manifest>
261        <attribute name="Main-Class" value="loci.visbio.VisBio"/>
262        <attribute name="Class-Path" value="${visbio.classpath}"/>
263      </manifest>
264    </jar>
265  </target>
266
267  <property name="visbio.dist-files" value="bsd-forms.txt bsd-looks.txt gpl-visbio.txt omeul.txt whatsnew.txt *.cpp *.m"/>
268
269  <target name="dist-visbio" depends="dist-visbio-win32, dist-visbio-win32-nojre, dist-visbio-macosx, dist-visbio-linux, dist-visbio-nojre"/>
270
271  <property name="visbio.win32-dir" value="${dist.dir}/visbio/win32/VisBio"/>
272
273  <target name="dist-visbio-win32" depends="jar-visbio, jar-formats">
274    <copy todir="${visbio.win32-dir}" preservelastmodified="true">
275      <fileset dir="dist/visbio/win32"/>
276      <fileset dir="loci/visbio" includes="${visbio.dist-files}"/>
277      <fileset dir="${jar.dir}" includes="visbio.jar ${visbio.classpath}"/>
278    </copy>
279    <fixcrlf srcdir="${visbio.win32-dir}" eol="dos"
280      includes="*.txt *.cpp *.m plugins/*.txt"/>
281    <untar src="dist/jre-win32.tar.gz" dest="${visbio.win32-dir}"
282      overwrite="false" compression="gzip"/>
283    <zip destfile="${dist.dir}/visbio${visbio.version}_win32.zip"
284      basedir="${dist.dir}/visbio/win32"/>
285  </target>
286
287  <property name="visbio.win32-nojre-dir"
288    value="${dist.dir}/visbio/win32-nojre/VisBio"/>
289
290  <target name="dist-visbio-win32-nojre" depends="jar-visbio, jar-formats">
291    <copy todir="${visbio.win32-nojre-dir}"
292      preservelastmodified="true">
293      <fileset dir="dist/visbio/win32" excludes="launcher.cfg"/>
294      <fileset dir="dist/visbio/win32-nojre"/>
295      <fileset dir="loci/visbio" includes="${visbio.dist-files}"/>
296      <fileset dir="${jar.dir}" includes="visbio.jar ${visbio.classpath}"/>
297    </copy>
298    <fixcrlf srcdir="${visbio.win32-nojre-dir}" eol="dos"
299      includes="*.txt *.cpp *.m plugins/*.txt"/>
300    <zip destfile="${dist.dir}/visbio${visbio.version}_win32_nojre.zip"
301      basedir="${dist.dir}/visbio/win32-nojre"/>
302  </target>
303
304  <property name="visbio.macosx-dir" value="${dist.dir}/visbio/macosx/VisBio"/>
305
306  <target name="dist-visbio-macosx" depends="jar-visbio, jar-formats">
307    <copy todir="${visbio.macosx-dir}"
308      preservelastmodified="true">
309      <fileset dir="dist/visbio/macosx"/>
310      <fileset dir="loci/visbio" includes="${visbio.dist-files}"/>
311    </copy>
312    <fixcrlf srcdir="${visbio.macosx-dir}" eol="mac"
313      includes="*.txt *.cpp *.m plugins/*.txt"/>
314    <!-- HACK - copy does not preserve permissions; chmod them back -->
315    <chmod perm="+x">
316      <fileset dir="${visbio.macosx-dir}"
317        includes="visbio omeul VisBio.app/Contents/MacOS/JavaApplicationStub"/>
318    </chmod>
319    <copy todir="${visbio.macosx-dir}/VisBio.app/Contents/Resources/Java">
320      <fileset dir="${jar.dir}" includes="visbio.jar ${visbio.classpath}"/>
321    </copy>
322<!--
323    <tar destfile="${dist.dir}/visbio${visbio.version}_macosx.tar.gz"
324      basedir="${dist.dir}/visbio/macosx" compression="gzip"/>
325-->
326    <!-- HACK - tar does not preserve permissions; use exec instead -->
327    <exec executable="tar">
328      <arg line="czf ${dist.dir}/visbio${visbio.version}_macosx.tar.gz -C ${dist.dir}/visbio/macosx VisBio"/>
329    </exec>
330  </target>
331
332  <property name="visbio.linux-dir"
333    value="${dist.dir}/visbio/linux/visbio${visbio.version}"/>
334
335  <target name="dist-visbio-linux" depends="jar-visbio, jar-formats">
336    <copy todir="${visbio.linux-dir}" preservelastmodified="true">
337      <fileset dir="dist/visbio/linux"/>
338      <fileset dir="loci/visbio" includes="${visbio.dist-files}"/>
339      <fileset dir="${jar.dir}" includes="visbio.jar ${visbio.classpath}"/>
340    </copy>
341    <fixcrlf srcdir="${visbio.linux-dir}" eol="unix"
342      includes="*.txt *.cpp *.m plugins/*.txt"/>
343    <!-- HACK - copy does not preserve permissions; chmod them back -->
344    <chmod perm="+x">
345      <fileset dir="${visbio.linux-dir}" includes="visbio omeul"/>
346    </chmod>
347<!--
348    <untar src="dist/jre-linux.tar.gz" dest="${visbio.linux-dir}"
349      overwrite="false" compression="gzip"/>
350-->
351    <!-- HACK - untar does not restore permissions; use exec instead -->
352    <exec executable="tar">
353      <arg line="xzf dist/jre-linux.tar.gz -C ${visbio.linux-dir}"/>
354    </exec>
355<!--
356    <tar destfile="${dist.dir}/visbio${visbio.version}_linux.tar.gz"
357      basedir="${dist.dir}/visbio/linux" compression="gzip"/>
358-->
359    <!-- HACK - tar does not preserve permissions; use exec instead -->
360    <exec executable="tar">
361      <arg line="czf ${dist.dir}/visbio${visbio.version}_linux.tar.gz -C ${dist.dir}/visbio/linux visbio${visbio.version}"/>
362    </exec>
363  </target>
364
365  <property name="visbio.nojre-dir"
366    value="${dist.dir}/visbio/nojre/visbio${visbio.version}"/>
367
368  <target name="dist-visbio-nojre" depends="jar-visbio, jar-formats">
369    <copy todir="${visbio.nojre-dir}" preservelastmodified="true">
370      <fileset dir="dist/visbio/linux"/>
371      <fileset dir="loci/visbio" includes="${visbio.dist-files}"/>
372      <fileset dir="${jar.dir}" includes="visbio.jar ${visbio.classpath}"/>
373    </copy>
374    <fixcrlf srcdir="${visbio.nojre-dir}" eol="unix"
375      includes="*.txt *.cpp *.m plugins/*.txt"/>
376    <!-- HACK - copy does not preserve permissions; chmod them back -->
377    <chmod perm="+x">
378      <fileset dir="${visbio.nojre-dir}" includes="visbio omeul"/>
379    </chmod>
380<!--
381    <tar destfile="${dist.dir}/visbio${visbio.version}.tar.gz"
382      basedir="${dist.dir}/visbio/nojre" compression="gzip"/>
383-->
384    <!-- HACK - tar does not preserve permissions; use exec instead -->
385    <exec executable="tar">
386      <arg line="czf ${dist.dir}/visbio${visbio.version}.tar.gz -C ${dist.dir}/visbio/nojre visbio${visbio.version}"/>
387    </exec>
388  </target>
389
390  <!-- LOCI Plugins for ImageJ -->
391
392  <property name="plugins.files" value="loci/plugins/** loci/ome/viewer/**"/>
393
394  <target name="jar-plugins"
395    depends="compile, copy-jars, jar-formats"
396    description="generate LOCI Plugins for ImageJ JAR file">
397    <jar jarfile="${jar.dir}/loci_plugins.jar" basedir="${classes.dir}"
398      includes="${plugins.files}">
399      <manifest>
400        <attribute name="Main-Class" value="loci.plugins.About"/>
401      </manifest>
402    </jar>
403  </target>
404
405  <!-- OME Metadata Notebook -->
406
407  <property name="notebook.classpath" value="bio-formats.jar commons-httpclient-2.0-rc2.jar commons-logging.jar forms-1.0.4.jar ome-java.jar xmlrpc-1.2-b1.jar"/>
408  <property name="notebook.files"
409    value="loci/ome/notebook/** loci/ome/viewer/**"/>
410  <property name="notebook.resources" value="loci/ome/notebook/Template.xml loci/ome/notebook/Icons/* loci/ome/notebook/TypeDefs/*"/>
411
412  <target name="jar-notebook"
413    depends="compile, copy-jars, jar-formats"
414    description="generate OME Metadata Notebook JAR file">
415    <copy todir="${classes.dir}" preservelastmodified="true">
416      <fileset dir="${src.dir}" includes="${notebook.resources}"/>
417    </copy>
418    <jar jarfile="${jar.dir}/ome-notebook.jar" basedir="${classes.dir}"
419      includes="${notebook.files}">
420      <manifest>
421        <attribute name="Main-Class"
422          value="loci.ome.notebook.MetadataNotebook"/>
423        <attribute name="Class-Path" value="${notebook.classpath}"/>
424      </manifest>
425    </jar>
426  </target>
427
428  <!-- Leica Converter -->
429
430  <property name="leica.classpath" value="bio-formats.jar ome-java.jar"/>
431  <property name="leica.files" value="loci/apps/leica/**"/>
432
433  <target name="jar-leica" depends="compile, copy-jars, jar-formats"
434    description="generate Leica Converter JAR file">
435    <jar jarfile="${jar.dir}/LeicaConverter.jar" basedir="${classes.dir}"
436      includes="${leica.files}">
437      <manifest>
438        <attribute name="Main-Class" value="loci.apps.leica.LeicaConverter"/>
439        <attribute name="Class-Path" value="${leica.classpath}"/>
440      </manifest>
441    </jar>
442  </target>
443
444  <!-- QT TIFF Converter -->
445
446  <property name="qt.files" value="loci/apps/qt/* loci/formats/BitBuffer* loci/formats/BitWriter* loci/formats/ByteVector* loci/formats/ComboFileFilter* loci/formats/Compression* loci/formats/DataTools* loci/formats/DummyMetadataStore* loci/formats/ExtensionFileFilter* loci/formats/FilePattern* loci/formats/FileStitcher* loci/formats/FormatException* loci/formats/FormatFileFilter* loci/formats/FormatHandler* loci/formats/FormatReader* loci/formats/FormatWriter* loci/formats/IFormatHandler* loci/formats/IFormatReader* loci/formats/ImageTools* loci/formats/LZWTreeNode* loci/formats/LegacyQTTools* loci/formats/MetadataStore* loci/formats/NumberFilter* loci/formats/OMEXMLMetadataStore* loci/formats/RandomAccessArray* loci/formats/RandomAccessStream* loci/formats/ReflectException* loci/formats/ReflectedUniverse* loci/formats/TiffRational* loci/formats/TiffTools* loci/formats/in/BaseTiffReader* loci/formats/in/LegacyQTReader* loci/formats/in/QTReader* loci/formats/in/TiffReader* loci/formats/out/TiffWriter*"/>
447
448  <target name="jar-qt" depends="compile"
449    description="generate QT TIFF Converter JAR file">
450    <mkdir dir="${jar.dir}"/>
451    <jar jarfile="${jar.dir}/QTConverter.jar" basedir="${classes.dir}"
452      includes="${qt.files}">
453      <manifest>
454        <attribute name="Main-Class" value="loci.apps.qt.QTConverter"/>
455      </manifest>
456    </jar>
457  </target>
458
459  <!-- Slim Plotter -->
460
461  <property name="slim.classpath" value="visad.jar"/>
462  <property name="slim.files" value="loci/apps/slim/* loci/formats/DataTools* loci/formats/ExtensionFileFilter* loci/formats/ComboFileFilter* loci/visbio/util/OutputConsole* loci/visbio/util/OutputEvent* loci/visbio/util/SwingUtil* loci/visbio/util/LAFUtil*"/>
463
464  <target name="jar-slim" depends="compile, copy-jars"
465    description="generate Slim Plotter JAR file">
466    <jar jarfile="${jar.dir}/SlimPlotter.jar" basedir="${classes.dir}"
467      includes="${slim.files}">
468      <manifest>
469        <attribute name="Main-Class" value="loci.apps.slim.SlimPlotter"/>
470        <attribute name="Class-Path" value="${slim.classpath}"/>
471      </manifest>
472    </jar>
473  </target>
474
475</project>
Note: See TracBrowser for help on using the repository browser.