-
Notifications
You must be signed in to change notification settings - Fork 102
/
build.xml
434 lines (369 loc) · 19.5 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
<?xml version="1.0" encoding="utf-8"?>
<project name="toplevel" default="build-default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!--
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (C) 2005 - 2013 Open Microscopy Environment:
# - Glencoe Software, Inc.
# - University of Dundee
# Use is subject to license terms supplied in LICENSE.txt
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Written by: Josh Moore, josh at glencoesoftware.com
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rewrite of the OMERO build system to allow for building
individual components. Use "ant -p" to see the individual
build-* targets.
-->
<description>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Top-level OMERO build.
Eclipse
-------
To get started using Eclipse, execute "ant build-dev" and import the top-level
.project file. Eclipse projects also exist for each individual java component.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</description>
<property name="import.dir" value="${basedir}/components/antlib/resources"/>
<import file="${import.dir}/global.xml"/>
<target name="init" depends="check-ivy,check-scons">
</target>
<target name="check-git">
<available file=".git" type="dir" property="git.exists"/>
</target>
<target name="check-ivy" unless="ivy.done">
<!-- Prevent future invocations and PermGen errors-->
<property name="ivy.done" value="done"/>
<!-- Touch the local configuration file which is no longer mandatory -->
<if><not><available file="${basedir}/etc/local.properties"/></not>
<then>
<touch file="${basedir}/etc/local.properties"/>
</then></if>
<installIvy/>
<ivy:buildlist reference="all.buildpath" settingsRef="ivy.toplevel">
<fileset dir="${omero.home}/components" includes="*/build.xml" excludes="**/tools/**, **/tests/**"/>
</ivy:buildlist>
<ivy:buildlist reference="all-tools.buildpath" settingsRef="ivy.toplevel">
<fileset dir="${omero.home}/components/tools" includes="*/build.xml"/>
</ivy:buildlist>
<ivy:buildlist reference="all-tests.buildpath" settingsRef="ivy.toplevel">
<fileset dir="${omero.home}/components/tests" includes="*/build.xml"/>
</ivy:buildlist>
<!-- Single file paths defined in antlib/resources/directories.xml -->
</target>
<target name="clean" description="Calls 'clean' on all components" depends="check-ivy">
<!-- Calling check-scons here rather than above, so that dependency graph later will re-install
if a user does "ant clean some-target" -->
<antcall target="check-scons" inheritRefs="true" inheritAll="true"/>
<iterate buildpathref="all.buildpath" target="clean"/>
<iterate buildpathref="tools.buildpath" target="clean"/>
<delete dir="${dist.dir}"/>
<delete dir="${lib.dir}/cache"/>
<delete includeemptydirs="true">
<fileset dir="${lib.dir}/repository" includes="omero/**,omero-tools/**"/>
</delete>
<delete dir="${target.dir}" quiet="true"/>
<delete dir="${omero.home}/test-output" quiet="true"/>
<delete includeemptydirs="true" quiet="true">
<fileset dir="${omero.home}/examples" includes="config.log,**/*.o,**/*.class,**/*.exe"/>
</delete>
<ant antfile="build.xml" dir="docs/sphinx-api" target="clean" inheritAll="false"/>
</target>
<target name="clean-ivy-cache" description="Cleans the Ivy cache"
depends="check-ivy">
<ivy:cleancache settingsRef="ivy.${ant.project.name}"/>
</target>
<target name="check-scons" description="Checks for scons and sets executable or installs">
<available property="scons.py" value="${target.dir}/scons/scons.py" filepath="${target.dir}/scons" file="scons.py" />
<antcall target="build-scons" inheritAll="true" inheritRefs="true"/>
</target>
<target name="build-scons" description="Installs the scons build tool" unless="scons.py">
<unzip src="${lib.dir}/repository/scons-local-2.1.0.zip" dest="target/scons"/>
</target>
<target name="build-default" description="Default build calls build" depends="build"/>
<target name="build" description="Build all components" depends="init">
<iterate buildpathref="all.buildpath" target="dist"/>
<iterate buildpathref="all-tools.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
<iterate buildpathref="tests.buildpath" target="dist"/>
<iterate buildpathref="all-tests.buildpath" target="tests-dist"/>
<antcall target="build-dist" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-all" description="Build all components" depends="build">
</target>
<target name="build-dev" description="build-default, then test-compile and build-eclipse"
depends="clean,init,build-default,test-compile,build-eclipse"/>
<target name="build-all-dev" description="build, then test-compile and build-eclipse"
depends="clean,init,build,test-compile,build-eclipse"/>
<target name="build-blitz" description="Alias for 'build-server'" depends="build-server"/>
<target name="build-server" description="Build the server distribution" depends="init">
<!-- Must also build python since it provides our command lines -->
<iterate buildpathref="OmeroPy.buildpath" target="tools-dist"/>
<iterate buildpathref="OmeroFs.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
<!-- Parts of build-dist -->
<antcall target="copy-licenses" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-history" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-etc" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-sql" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-server" inheritRefs="true" inheritAll="true"/>
<antcall target="update-version" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-java" description="Build Java tests for the OMERO server" depends="init">
<iterate buildpathref="OmeroJava.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
</target>
<target name="build-py" description="Prepare Python tests for the OMERO server" depends="init">
<iterate buildpathref="OmeroPy.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
</target>
<target name="build-web" description="Prepare OmeroWeb tests" depends="init">
<iterate buildpathref="OmeroWeb.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
</target>
<target name="eclipse" depends="init">
<tryEclipse settingsRef="ivy.toplevel" filter="true"/>
</target>
<target name="build-eclipse" description="Creates all source directories needed by eclipse in case default build is failing." depends="init">
<iterate buildpathref="all.buildpath" target="eclipse"/>
<iterate buildpathref="OmeroJava.buildpath" target="eclipse"/>
<tryEclipse settingsRef="ivy.toplevel" filter="true"/>
</target>
<macrodef name="launchSuite">
<attribute name="suite"/>
<attribute name="excludes" default="**/tools/build.xml,**/tests/build.xml"/>
<sequential>
<ivy:settings id="ivy.@{suite}" file="${etc.dir}/ivysettings.xml"/>
<ivy:buildlist reference="@{suite}.buildpath" settingsRef="ivy.@{suite}" ivyfilepath="test.xml">
<fileset dir="${omero.home}/components" includes="*/build.xml" excludes="@{excludes}"/>
<fileset dir="${omero.home}/components/tools" includes="*/build.xml"/>
<fileset dir="${omero.home}/components/tests" includes="*/build.xml"/>
</ivy:buildlist>
<iterate buildpathref="@{suite}.buildpath" target="@{suite}"/>
</sequential>
</macrodef>
<target name="test-compile" description="Compile all tests" depends="init">
<launchSuite suite="test-compile"/>
</target>
<target name="test-compile-all" description="Compile all tests" depends="test-compile">
</target>
<target name="test-unit" description="Run all unit tests" depends="init">
<echo message="This task is deprecated"/>
<launchSuite suite="test"/>
</target>
<target name="test-unit-all" description="Run all unit tests" depends="test-unit">
</target>
<target name="test-integration" description="Run all integration tests" depends="init">
<launchSuite suite="integration"/>
</target>
<target name="test-integration-all" description="Run all integration tests" depends="test-integration">
</target>
<target name="test-server" description="Run all non-tools/ tests" depends="init">
<launchSuite suite="integration" excludes="**/tools/build.xml,**/tools/**/build.xml"/>
</target>
<target name="test-fs" description="Run all FS related unit and integration tests" depends="init">
<ant antfile="${tools.comp}/OmeroJava/build.xml" dir="${tools.comp}/OmeroJava" target="test-suite" inheritall="false">
<property name="test.dir" value="${tools.comp}/OmeroJava/test"/>
<property name="unit.suite" value="fs.testng.xml"/>
</ant>
<ant antfile="${tools.comp}/OmeroPy/build.xml" dir="${tools.comp}/OmeroPy" target="python-integration" inheritall="false">
<property name="suite_file" value="${tools.comp}/OmeroPy/test/integration/fs_suite.py"/>
</ant>
</target>
<target name="test-report" description="Joins test results into a single report">
<mkdir dir="${target.dir}/reports"/>
<junitreport todir="${target.dir}/reports">
<fileset dir="${basedir}/components">
<include name="*/target/reports/xml/*.xml"/>
</fileset>
<fileset dir="${basedir}/components/tools/">
<include name="*/target/reports/xml/*.xml"/>
</fileset>
<report format="frames" todir="${target.dir}/reports/html"/>
</junitreport>
</target>
<target name="test-dist" description="Copy test files into dist for further testing" depends="test-compile">
<ivy:resolve file="test.xml" type="jar,bundle" conf="test" settingsRef="ivy.toplevel" log="quiet"/>
<ivy:retrieve conf="test" pattern="${dist.dir}/lib/client/[artifact].[ext]" sync="false" log="quiet" settingsRef="ivy.toplevel"/>
</target>
<target name="examples-java" description="Build and run OmeroJava examples">
<scons_py dir="${basedir}/examples">
<arg value="run_java=1"/>
</scons_py>
</target>
<target name="examples-py" description="Build and run OmeroPy examples">
<scons_py dir="${basedir}/examples" pythonpath="${env.PYTHONPATH}"><!-- omit OmeroPy/src -->
<arg value="run_py=1"/>
<arg value="no_java=1"/>
</scons_py>
</target>
<target name="release-all" description="Produce all binary release artifacts (unsigned)"
depends="release-clients,release-zip">
</target>
<target name="release-zip" description="Zip the dist directory into ${product.name}-${omero.version}.zip">
<zip destfile="${omero.home}/target/${product.name}-${omero.version}.zip">
<zipfileset dir="${dist.dir}" prefix="${product.name}-${omero.version}"/>
</zip>
</target>
<target name="release-src-embed" description="Package the release source tree (non-git)"
depends="check-git" unless="git.exists">
<fail message="Releasing is only possible from a git repository"/>
</target>
<target name="release-src-git" description="Package the git source tree (git)"
depends="check-git" if="git.exists">
<mkdir dir="${target.dir}"/>
<exec executable="python3" failonerror="true">
<arg value="${omero.home}/components/antlib/scripts/source-archive.py"/>
<arg value="openmicroscopy"/>
<arg value="${omero.shortversion}"/>
<arg value="${omero.version}"/>
<arg value="${omero.vcs.shortrevision}"/>
<arg value="${omero.vcs.revision}"/>
<arg value="${omero.vcs.date}"/>
<arg value="${omero.vcs.date_unix}"/>
<arg value="${target.dir}"/>
</exec>
</target>
<target name="release-src" description="Package the git source tree into openmicroscopy-${omero.version}.zip"
depends="release-src-embed,release-src-git"/>
<target name="release-clients" description="Zip the Java zip">
<zip destfile="${omero.home}/target/OMERO.java-${omero.version}.zip">
<zipfileset dir="${dist.dir}/lib/client" prefix="OMERO.java-${omero.version}/libs" includes="**/*.jar"/>
<zipfileset dir="${dist.dir}/etc" prefix="OMERO.java-${omero.version}/libs" includes="logback-cli.xml"/>
</zip>
</target>
<target name="release-tar" description="Tar the dist directory into ${product-name}-${omero.version}.tar.bz2">
<tar destfile="${product.name}-${omero.version}.tar.bz2" compression="bzip2">
<zipfileset dir="${dist.dir}" prefix="${product.name}-${omero.version}"/>
</tar>
</target>
<target name="release-headers" description="Generates headers.xml for all components" depends="init">
<iterate buildpathref="all.buildpath" target="headers"/>
<iterate buildpathref="tools.buildpath" target="headers"/>
<iterate buildpathref="tests.buildpath" target="headers"/>
<taskdef resource="checkstyletask.properties" classpathref="omero.classpath"/>
<checkstyle config="${omero.home}/docs/styles/checkstyle-header.xml" failOnViolation="true">
<fileset dir="${basedir}" includes="*,docs/**/*,etc/**/*,sql/**/*"/>
<formatter type="xml" toFile="${target.dir}/headers.xml"/>
</checkstyle>
</target>
<target name="release-findbugs" description="Generates findbugs.xml and checkstyle.xml for all components" depends="init">
<iterate buildpathref="all.buildpath" target="findbugs"/>
<iterate buildpathref="tools.buildpath" target="findbugs"/>
</target>
<target name="release-training" description="Produces a zip with the examples/Training files">
<zip destfile="${omero.home}/target/OMERO.training-${omero.version}.zip">
<zipfileset dir="${omero.home}/examples/Training" prefix="OMERO.training-${omero.version}" includes="**" excludes="markup.py"/>
<zipfileset dir="${omero.home}" prefix="OMERO.training-${omero.version}" includes="LICENSE.txt"/>
</zip>
</target>
<!--
Top-level helpers (shared helpers are in components/antlib/resources)
=====================================================================
-->
<target name="build-dist" depends="init,copy-licenses,copy-history,copy-etc,copy-sql,copy-server,copy-client,update-version,create-workdirs,copy-luts"
description="Copy all components to dist/; called at the end of build-* targets"/>
<target name="copy-licenses" depends="init">
<copy file="${omero.home}/LICENSE.txt" todir="${dist.dir}/"/>
<mkdir dir="${dist.dir}/share"/>
<copy todir="${dist.dir}/share">
<fileset dir="${omero.home}/lib/" includes="licenses/**"/>
</copy>
</target>
<target name="copy-history" depends="init">
<copy file="${omero.home}/history.rst" todir="${dist.dir}/"/>
</target>
<target name="copy-etc" depends="init">
<copy todir="${dist.dir}/etc">
<fileset dir="${omero.home}/etc">
<exclude name="local.properties*"/>
<exclude name="ivysettings.xml"/>
</fileset>
</copy>
<copy file="${omero.home}/components/tests/ui/resources/robot.template" todir="${dist.dir}/etc/templates"/>
<replace dir="${dist.dir}/etc" token="@ICE_LIB_VERSION@" value="${versions.ice_lib}"/>
</target>
<target name="copy-sql" depends="init">
<copy todir="${dist.dir}">
<fileset dir="${omero.home}">
<include name="sql/**"/>
</fileset>
</copy>
</target>
<target name="copy-client" depends="init">
<mkdir dir="${dist.dir}/lib/client"/>
<!-- sync="true" deletes any other files like extensions.jar which may be under lib -->
<ivy:resolve file="ivy.xml" type="jar,egg,bundle,zip" conf="client" settingsRef="ivy.toplevel" log="quiet"/>
<ivy:retrieve conf="client" pattern="${dist.dir}/lib/client/[artifact].[ext]" sync="false" log="quiet" settingsRef="ivy.toplevel"/>
</target>
<target name="copy-server" depends="init">
<mkdir dir="${dist.dir}/lib/server"/>
<!-- sync="true" deletes any other files like extensions.jar which may be under lib -->
<ivy:resolve file="ivy.xml" type="jar,egg,bundle,zip" conf="server" settingsRef="ivy.toplevel" log="quiet"/>
<ivy:retrieve conf="server" pattern="${dist.dir}/lib/server/[artifact].[ext]" sync="false" log="quiet" settingsRef="ivy.toplevel"/>
</target>
<target name="create-workdirs" depends="init">
<mkdir dir="${dist.dir}/etc/grid"/>
<mkdir dir="${dist.dir}/var"/>
</target>
<target name="copy-luts" depends="init">
<mkdir dir="${dist.dir}/lib/scripts/luts"/>
<copy todir="${dist.dir}/lib/scripts/luts">
<fileset dir="luts"/>
</copy>
</target>
<macrodef name="jar_update_if">
<attribute name="destfile"/>
<element name="filesets" implicit="yes"/>
<sequential>
<if>
<available file="@{destfile}"/>
<then>
<jar update="true" destfile="@{destfile}">
<filesets/>
</jar>
</then>
</if>
</sequential>
</macrodef>
<target name="update-version">
<loadproperties srcFile="${dist.dir}/etc/omero.properties">
<filterchain>
<headfilter skip="20" lines="-1"/>
<prefixlines prefix="dist.check."/>
</filterchain>
</loadproperties>
<if><not><equals arg1="${dist.check.omero.version}" arg2="${omero.version}"/></not>
<then>
<!-- Setting version -->
<copy todir="${dist.dir}/etc" overwrite="true">
<fileset dir="${omero.home}/etc" includes="omero.properties"/>
</copy>
<echo file="${dist.dir}/etc/omero.properties" append="true">
omero.version=${omero.version}
</echo>
</then>
</if>
</target>
<macrodef name="ice-admin">
<element name="args" implicit="yes"/>
<sequential>
<exec executable="omero" dir="${dist.dir}" failonerror="true">
<arg value="admin"/>
<arg value="ice"/>
<args/>
</exec>
</sequential>
</macrodef>
<target name="print-mem">
<echo>
*.maxmem.* settings
-------------------
javac.maxmem=${javac.maxmem}
javadoc.maxmem=${javadoc.maxmem}
javac.maxmem.default=${javac.maxmem.default}
javadoc.maxmem.default=${javadoc.maxmem.default}
</echo>
</target>
</project>