forked from ome/openmicroscopy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
843 lines (738 loc) · 40.1 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
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
<?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,check-ice">
<mkdir dir="${blitz.comp}/generated"/>
<mkdir dir="${blitz.comp}/target/generated/src"/>
</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="blitzserver.buildpath" settingsRef="ivy.toplevel">
<fileset dir="${omero.home}/components/blitz/" includes="build.xml"/>
<fileset dir="${omero.home}/components/common/" includes="build.xml"/>
<fileset dir="${omero.home}/components/dsl/" includes="build.xml"/>
<fileset dir="${omero.home}/components/model/" includes="build.xml"/>
<fileset dir="${omero.home}/components/rendering/" includes="build.xml"/>
<fileset dir="${omero.home}/components/romio/" includes="build.xml"/>
<fileset dir="${omero.home}/components/server/" includes="build.xml"/>
</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"/>
<iterate buildpathref="tests.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>
<macrodef name="setup-py-install">
<attribute name="tarball"/>
<attribute name="dir"/>
<sequential>
<mkdir dir="${target.dir}"/>
<mkdir dir="${target.dir}/lib/python/site-packages"/>
<untar compression="gzip" src="${lib.dir}/repository/@{tarball}" dest="${target.dir}"/>
<exec executable="python" dir="${target.dir}/@{dir}" failonerror="true">
<env key="PYTHONPATH" value="${env.PYTHONPATH}:${target.dir}/lib/python/site-packages"/>
<arg value="setup.py"/>
<arg value="install"/>
<arg value="--prefix=${target.dir}"/>
</exec>
</sequential>
</macrodef>
<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="check-ice" description="Checks Ice versioning">
<!-- Checking the slice2* version before continuing. See #1185 -->
<exec outputproperty="executable.ice.version" executable="${ice.slice2java}">
<arg value="--version"/>
</exec>
<if>
<not>
<or>
<matches pattern="^${ice.compatibility}" string="${executable.ice.version}"/>
<matches pattern="^${ice.compatibility}" string="auto"/>
</or>
</not>
<then><fail>WRONG ICE VERSION!
slice2java (${ice.slice2java}) version = ${executable.ice.version}
Expected version = ${ice.compatibility}
If you would like to configure which Ice to use, set
ice.compatibility=ice_version in etc/local.properties
or on the command-line, e.g.:
./build.py -Dice.compatibility=3.5
</fail></then>
</if>
</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 blitz and copy to dist/blitz" depends="init">
<iterate buildpathref="blitzserver.buildpath" target="dist"/>
<!-- Must also build python since it provides our command lines -->
<iterate buildpathref="OmeroPy.buildpath" target="tools-dist"/>
<iterate buildpathref="OmeroFs.buildpath" target="tools-dist"/>
<!-- TODO: importer too?? -->
<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 bindings to the OMERO server" depends="init">
<iterate buildpathref="blitzserver.buildpath" target="dist"/>
<iterate buildpathref="OmeroJava.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
</target>
<target name="build-py" description="Build Python bindings to the OMERO server" depends="init">
<iterate buildpathref="blitzserver.buildpath" target="dist"/>
<iterate buildpathref="OmeroPy.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
</target>
<target name="build-importer" description="Build importer and copy to dist/lib and dist/bin. May require 'build-java'" depends="init">
<iterate buildpathref="tools.buildpath" target="dist"/>
<!-- Parts of build-dist -->
<antcall target="copy-client" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-etc" inheritRefs="true" inheritAll="true"/>
<antcall target="update-version" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-insight" description="Build insight and copy to dist/lib and dist/bin. May require 'build-java'" depends="init">
<iterate buildpathref="tools.buildpath" target="dist"/>
<iterate buildpathref="insight.buildpath" target="dist"/>
<!-- Parts of build-dist -->
<antcall target="copy-client" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-etc" inheritRefs="true" inheritAll="true"/>
<antcall target="update-version" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-web" description="Build OmeroWeb and copy to dist. May require 'build-py'" depends="init">
<iterate buildpathref="OmeroWeb.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
<!-- Parts of build-dist -->
<antcall target="copy-etc" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-web-requirements" inheritRefs="true" inheritAll="true"/>
<antcall target="update-version" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-schema" description="Build new DB schema and copy to sql/" depends="init">
<iterate buildpathref="dsl.buildpath" target="clean"/>
<iterate buildpathref="model.buildpath" target="clean"/>
<iterate buildpathref="dsl.buildpath" target="install"/>
<iterate buildpathref="model.buildpath" target="install"/>
<iterate buildpathref="model.buildpath" target="publish-schema"/>
<!-- Parts of build-dist -->
<antcall target="copy-sql" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-model" description="Generate model code for all language bindings" depends="init">
<ant antfile="${blitz.comp}/build.xml" dir="${blitz.comp}" target="icegen" inheritAll="false"/>
<!-- Parts of build-dist: updates both server and client -->
<antcall target="build-dist" inheritRefs="true" inheritAll="true"/>
</target>
<target name="build-matlab" description="Provides a matlab toolbox under target. May required 'build-java'" depends="init">
<iterate buildpathref="OmeroMatlab.buildpath" target="tools-dist"/>
<iterate buildpathref="tools.buildpath" target="dist"/>
<!-- Parts of build-dist -->
<antcall target="copy-etc" inheritRefs="true" inheritAll="true"/>
<antcall target="update-version" inheritRefs="true" inheritAll="true"/>
</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="insight.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="**/insight/*/**/*.xml,@{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">
<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="${blitz.comp}/build.xml" dir="${blitz.comp}" target="test-suite" inheritAll="false">
<property name="test.dir" value="${blitz.comp}/test"/>
<property name="unit.suite" value="fs.testng.xml"/>
</ant>
<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,release-docs">
</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}"
excludes="bin/omero"/>
<zipfileset dir="${dist.dir}" prefix="${product.name}-${omero.version}"
includes="bin/omero"
filemode="755"/>
</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="python" failonerror="true">
<arg value="${omero.home}/components/antlib/scripts/source-archive.py"/>
<arg value="openmicroscopy"/>
<arg value="${omero.shortversion}"/>
<arg value="${omero.plainversion}"/>
<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.plainversion}.zip"
depends="release-src-embed,release-src-git"/>
<target name="release-clients" description="Zip the Python, Java, and Matlab zips">
<zip destfile="${omero.home}/target/OMERO.py-${omero.version}.zip">
<zipfileset dir="${dist.dir}" prefix="OMERO.py-${omero.version}"
includes="bin/**,etc/**,lib/python/**,lib/fallback/**,sql/**,share/web/**" excludes="bin/omero"/>
<zipfileset dir="${dist.dir}" prefix="OMERO.py-${omero.version}"
includes="bin/omero" filemode="755"/>
</zip>
<zip destfile="${omero.home}/target/OMERO.java-${omero.version}.zip">
<zipfileset dir="${blitz.comp}/src" prefix="OMERO.java-${omero.version}/src" includes="**/*.java"/>
<zipfileset dir="${blitz.comp}/target" prefix="OMERO.java-${omero.version}/src" includes="**/*.java"/>
<zipfileset dir="${blitz.comp}/generated" prefix="OMERO.java-${omero.version}/src" includes="**/*.java"/>
<zipfileset dir="${insight.comp}/SRC" prefix="OMERO.java-${omero.version}/src" includes="**/*.java"/>
<zipfileset dir="${dist.dir}/lib/client" prefix="OMERO.java-${omero.version}/libs" includes="**/*.jar"/>
</zip>
<iterate buildpathref="OmeroMatlab.buildpath" target="release-zip"/>
<zip destfile="${omero.home}/target/OMERO.matlab-${omero.version}.zip">
<zipfileset dir="components/tools/OmeroM/target/matlab/" prefix="OMERO.matlab-${omero.version}" includes="**/*"/>
</zip>
<copy todir="target">
<fileset dir="components/tools/OmeroPy/dist" includes="*.egg"/>
<fileset dir="components/tools/OmeroFS/dist" includes="*.egg"/>
</copy>
<!-- These should eventually be removed in favor of an ivy-based approach -->
<!-- Moving zip targets out of main build for `./build.py` performance -->
<iterate buildpathref="insight.buildpath" target="zips"/>
<copy todir="target">
<fileset dir="components/insight/target" includes="insight*.zip" excludes="*-ij*.zip"/>
<mapper type="regexp" from="insight(.*).zip" to="OMERO.insight-${omero.version}\1.zip"/>
</copy>
<copy todir="target">
<fileset dir="components/insight/target" includes="importer*.zip"/>
<mapper type="regexp" from="importer(.*).zip" to="OMERO.importer-${omero.version}\1.zip"/>
</copy>
<copy file="components/insight/target/insight-ij.zip" tofile="target/OMERO.insight-ij-${omero.version}.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}"
excludes="bin/omero"/>
<zipfileset dir="${dist.dir}" prefix="${product.name}-${omero.version}"
includes="bin/omero"
filemode="755"/>
</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-docs" depends="release-javadoc,release-sphinx-api,release-slice2html" description="Generate Docs for all components under dist/docs/api">
<zip destfile="${omero.home}/target/OMERO.apidoc-${omero.version}.zip">
<zipfileset dir="${dist.dir}/docs" prefix="OMERO.apidoc-${omero.version}"/>
</zip>
</target>
<target name="release-slice2html" description="The Ice API Documentation">
<mkdir dir="${omero.home}/target/docs"/>
<copy file="${blitz.comp}/resources/header.txt" tofile="${omero.home}/target/docs/header.txt" overwrite="true"/>
<copy file="${blitz.comp}/resources/footer.txt" tofile="${omero.home}/target/docs/footer.txt" overwrite="true"/>
<replace file="${omero.home}/target/docs/header.txt" token="@VERSION@" value="${omero.version}"/>
<replace file="${omero.home}/target/docs/footer.txt" token="@VERSION@" value="${omero.version}"/>
<mkdir dir="${dist.dir}/docs/api/slice2html"/>
<apply executable="${ice.slice2html}" parallel="true" failonerror="true">
<arg value="--hdr"/>
<arg value="${omero.home}/target/docs/header.txt"/>
<!-- <arg value="-REMOVETHISTEXTBETWEENDASHES-ftr"/> Commented out as causing a crash in slice2html
<arg value="${omero.home}/target/docs/footer.txt"/> -->
<arg value="-I"/>
<arg value="${blitz.comp}/generated"/>
<arg value="-I"/>
<arg value="${blitz.comp}/resources"/>
<arg value="-I"/>
<arg value="${ice.slicepath}"/>
<arg value="--output-dir"/>
<arg value="${dist.dir}/docs/api/slice2html"/>
<!-- The order here is important. Later docs overwrite earlier ones -->
<fileset dir="${omero.home}/components/tools" includes="**/resources/**/*.ice"/>
<fileset dir="${omero.home}/components/server/src" includes="**/*.ice"/>
<fileset dir="${omero.home}/components/blitz/generated" includes="**/*.ice"/>
<fileset dir="${omero.home}/components/blitz/resources" includes="**/*.ice"/>
<fileset dir="${omero.home}/components/blitz/resources" includes="README.ice"/>
</apply>
</target>
<target name="release-sphinx-api" depends="build-py,build-web"
description="The OMERO.py Sphinx API Documentation">
<mkdir dir="${dist.dir}/docs/api/python"/>
<ant antfile="build.xml" dir="docs/sphinx-api" target="clean" inheritAll="false"/>
<ant antfile="build.xml" dir="docs/sphinx-api" target="html" inheritAll="false">
<property name="omero.shortversion" value="${omero.version}"/>
</ant>
<copy todir="${dist.dir}/docs/api/python">
<fileset dir="docs/sphinx-api/_build/html"/>
</copy>
</target>
<target name="release-javadoc" description="Generate Javadocs for all components under dist/docs/api">
<mkdir dir="${dist.dir}/docs/api"/>
<patternset id="all.java.files">
<!-- Includes prefixed with "**" in order to pick up
tools/ components -->
<include name="src/**/*.java"/>
<include name="target/generated/src/**/*.java"/>
<exclude name="xxx/**"/>
</patternset>
<mkdir dir="target/docs"/>
<copy file="docs/overview.html" tofile="target/docs/overview.html" overwrite="true"/>
<replace file="target/docs/overview.html" token="@VERSION@" value="${omero.version}"/>
<presetdef name="nomemoryjavadoc">
<javadoc
failonerror="true"
Verbose="false"
destdir="${dist.dir}/docs/api"
author="true"
version="true"
use="true"
breakiterator="true"
encoding="UTF-8"
docencoding="UTF-8"
windowtitle="OMERO API"
overview="target/docs/overview.html"
additionalparam="${javadoc.doclint}">
<classpath>
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="repository/org.springframework.*.jar"/>
<exclude name="repository/omero/**"/>
<exclude name="repository/omero-tools/**"/>
<exclude name="cache/omero/omero_client/jars/**"/>
</fileset>
</classpath>
<fileset dir="components/model/" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<fileset dir="components/common/" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<fileset dir="components/server/" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<fileset dir="components/romio/" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<fileset dir="components/rendering/" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<!-- Skipping generated files for blitz. Just too many -->
<fileset dir="components/blitz/src" defaultexcludes="yes" includes="**/*.java"/>
<fileset dir="components/tools/OmeroJava" defaultexcludes="yes">
<patternset refid="all.java.files"/>
</fileset>
<doctitle><![CDATA[<h1> OMERO API </h1>]]></doctitle>
<bottom><![CDATA[
<div id="ome-logo-for-top" style="display:none"><div id="ome-logo-inner"><img src="http://downloads.openmicroscopy.org/resources/ome_docs_trac_banner.png" alt="OME Docs"></div></div>
<div id="doc-name-right" style="position: absolute;top: 90px;right: 20px;"><b>OmeroJava API</b></div>
<p><i>Version: ${omero.version}</i></p>
<p><b><i>Copyright © @@YEAR@@ The University of Dundee & Open Microscopy Environment. All Rights Reserved.</i></b></p>
]]></bottom>
<group title="A. Core System"
packages="ome.api:ome.conditions*:ome.parameters*:ome.system*"/>
<group title="B. Model"
packages="ome.model*"/>
<group title="C. Client Packages"
packages="ome.client*:ome.adapters*:omero.gateway*"/>
<group title="D. Server Packages"
packages="ome.api.local*:ome.services*:ome.logic*:ome.tools*:ome.security*:ome.io*:ome.annotations*"/>
<group title="E. Blitz Server"
packages="ome.services.blitz*"/>
<group title="E. Blitz Client"
packages="omero*:omeroj*"/>
<group title="G. Rendering Engine"
packages="omeis*"/>
<group title="H. Utilities"
packages="ome.util*"/>
<group title="I. Deprecated"
packages="ome.dynamic*:ome.rules*"/>
<link href="http://docs.oracle.com/javase/8/docs/api/"/>
<link href="http://docs.spring.io/spring/docs/${versions.spring}/api/"/>
<link href="http://aopalliance.sourceforge.net/doc/"/>
<link href="http://downloads.openmicroscopy.org/bio-formats/${versions.bioformats}/api/"/>
</javadoc>
</presetdef>
<if>
<isset property="javadoc.maxmem"/>
<then>
<nomemoryjavadoc
maxmemory="${javadoc.maxmem}"/>
</then>
<else>
<nomemoryjavadoc/>
</else>
</if>
<replace dir="${dist.dir}/docs/api">
<replacetoken><![CDATA[<HEAD>]]></replacetoken>
<replacevalue><![CDATA[<HEAD profile="http://www.w3.org/2005/10/profile">
<link rel="icon"
type="image/vnd.microsoft.icon"
href="https://downloads.openmicroscopy.org/resources/favicon.ico">]]></replacevalue>
</replace>
<tstamp>
<format property="yearvalue" pattern="yyyy"/>
</tstamp>
<replace dir="${dist.dir}/docs/api" value="${yearvalue}">
<replacetoken><![CDATA[@@YEAR@@]]></replacetoken>
</replace>
</target>
<target name="release-hudson" depends="check-ivy"
description="Saves to the hudson repository for dependent builds">
<iterate buildpathref="all.buildpath" target="artifactory"/>
</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,copy-web-requirements,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.txt" 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-web-requirements" depends="init">
<mkdir dir="${dist.dir}/share/web"/>
<copy todir="${dist.dir}/share/web">
<fileset dir="components/tools/OmeroWeb">
<include name="requirements*.txt"/>
</fileset>
</copy>
</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 services.jar or extensions.jar which may be under lib -->
<ivy:resolve file="ivy.xml" type="jar,egg,bundle" 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"/>
<mkdir dir="${dist.dir}/share/client"/>
<ivy:report conf="client" todir="${dist.dir}/share/client"
outputpattern="dependencies.html" graph="false"
settingsRef="ivy.toplevel"/>
</target>
<target name="copy-server" depends="init">
<mkdir dir="${dist.dir}/lib/server"/>
<!-- sync="true" deletes any other files like services.jar or extensions.jar which may be under lib -->
<ivy:resolve file="ivy.xml" type="jar,egg,bundle" 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"/>
<mkdir dir="${dist.dir}/share/server"/>
<ivy:report conf="server" todir="${dist.dir}/share/server"
outputpattern="dependencies.html" graph="false"
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>
<!-- Must update the jars with the modified omero.properties file in order for the version to be updated -->
<jar_update_if destfile="${dist.dir}/lib/server/blitz.jar">
<fileset dir="${dist.dir}/etc" includes="omero.properties"/>
</jar_update_if>
<jar_update_if destfile="${dist.dir}/lib/client/omero_client.jar">
<fileset dir="${dist.dir}/etc" includes="omero.properties"/>
</jar_update_if>
<jar_update_if destfile="${dist.dir}/lib/insight/blitz.jar">
<fileset dir="${dist.dir}/etc" includes="omero.properties"/>
</jar_update_if>
</then>
</if>
</target>
<target name="hot-blitz" depends="init" description="Re-launch running server with new blitz.jar">
<property name="targets" value="install"/>
<hotdeploy component="${blitz.comp}" targets="${targets}"/>
</target>
<target name="hot-common" depends="init" description="Re-launch running server with new common.jar">
<property name="targets" value="install"/>
<hotdeploy component="${common.comp}" targets="${targets}"/>
</target>
<target name="hot-model" depends="init" description="Re-launch running server with new model.jar">
<ant antfile="${dsl.comp}/build.xml" dir="${dsl.comp}" target="install" inheritAll="false"/>
<ant antfile="${model.comp}/build.xml" dir="${model.comp}" target="clean" inheritAll="false"/>
<property name="targets" value="install"/>
<hotdeploy component="${model.comp}" targets="${targets}"/>
</target>
<target name="hot-romio" depends="init" description="Re-launch running server with new romio.jar">
<property name="targets" value="install"/>
<hotdeploy component="${romio.comp}" targets="${targets}"/>
</target>
<target name="hot-server" depends="init" description="Re-launch running server with new server.jar">
<property name="targets" value="install"/>
<hotdeploy component="${server.comp}" targets="${targets}"/>
</target>
<macrodef name="hotdeploy">
<attribute name="targets"/>
<attribute name="component"/>
<sequential>
<for list="@{targets}" param="target">
<sequential>
<ant antfile="@{component}/build.xml" dir="@{component}" target="@{target}" inheritAll="false"/>
</sequential>
</for>
<antcall target="copy-client" inheritRefs="true" inheritAll="true"/>
<antcall target="copy-server" inheritRefs="true" inheritAll="true"/>
<ice-admin>
<arg value="server"/>
<arg value="stop"/>
<arg value="Blitz-0"/>
</ice-admin>
<ice-admin>
<arg value="server"/>
<arg value="stop"/>
<arg value="Indexer-0"/>
</ice-admin>
<ice-admin>
<arg value="server"/>
<arg value="stop"/>
<arg value="PixelData-0"/>
</ice-admin>
</sequential>
</macrodef>
<macrodef name="ice-admin">
<element name="args" implicit="yes"/>
<sequential>
<exec executable="python" dir="${dist.dir}" failonerror="true">
<arg value="bin/omero"/>
<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>