forked from OpenGamma/OG-Platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
739 lines (661 loc) · 36.3 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
<project name="all" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Load the environment variables first -->
<property environment="env" />
<!-- also, try a property file because some JVMs don't support env properly -->
<property file="${user.home}/.OG-Build-common.properties" />
<property file="build.properties" />
<!-- Set where the OGDEV dir is. We do this outside build.properties so that
we can reference it in build.properties. -->
<property file="${common.dir}/ogdev.properties"/>
<condition property="ogdev.dir" value="${ogdev.dir.windows}" else="${ogdev.dir.posix}">
<os family="windows" />
</condition>
<property file="${common.dir}/build.properties" />
<condition property="env.IVY_SHARED_DEFAULT_ROOT_DEFAULT" value="${env.IVY_SHARED_DEFAULT_ROOT_WINDOWS}" else="${env.IVY_SHARED_DEFAULT_ROOT_NONWINDOWS}">
<os family="windows" />
</condition>
<condition property="env.IVY_SHARED_DEFAULT_ROOT" value="${env.IVY_SHARED_DEFAULT_ROOT_DEFAULT}">
<not>
<isset property="env.IVY_SHARED_DEFAULT_ROOT" />
</not>
</condition>
<property name="ivy.jar.dir" value="${user.home}/.ivy2/jars" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<property name="ivy.install.version" value="2.1.0" />
<property name="build.dir" value="build" />
<property name="src.dir" value="src" />
<property name="docs.dir" value="${build.dir}/docs" />
<import file="git-macros.xml" />
<available file="${ivy.jar.file}" property="skip.download"/>
<import file="${common.dir}/common-ivy.xml"/>
<target name="init" depends="get-build-projects-file-for-user"
description="initialises the system config (user/pw required)" />
<!-- get user-specific build-projects.xml file -->
<target name="get-build-projects-file-for-user" depends="init-credentials">
<get src="${opengamma.config.repository}/users/${opengamma.username}/${module.version.target}/ant/build-projects.xml" dest="${common.dir}/build-projects.xml" username="${opengamma.username}" password="${opengamma.password}"/>
<get src="${opengamma.config.repository}/users/${opengamma.username}/${module.version.target}/config/tests.properties" dest="${common.dir}/tests.properties" username="${opengamma.username}" password="${opengamma.password}"/>
<get src="${opengamma.config.repository}/users/${opengamma.username}/${module.version.target}/config/db.properties" dest="${common.dir}/db.properties" username="${opengamma.username}" password="${opengamma.password}"/>
<get src="${opengamma.config.repository}/users/${opengamma.username}/${module.version.target}/config/deploy.properties" dest="${common.dir}/deploy.properties" username="${opengamma.username}" password="${opengamma.password}"/>
</target>
<!-- dump the credentials established in dependant targets to a properties file for use by ivy -->
<target name="init-credentials" depends="init-prompt,init-env">
<echo file="${common.dir}/credentials.properties">opengamma.username=${opengamma.username}${line.separator}opengamma.password=${opengamma.password}</echo>
</target>
<!-- prompts the user for username and password if environemnt variables are not set -->
<target name="init-prompt" depends="check-user-env-and-password-present" unless="og.user.and.password.set">
<echo message="Please enter your credentials or use the defaults if you don't have an account"/>
<input message="${line.separator}Username" defaultvalue="opengamma-public" addproperty="opengamma.username"/>
<input message="Password" defaultvalue="opengamma" addproperty="opengamma.password"/>
<!-- would like to use secure password handling, but it's going in a file and that only works on Ant 1.8 -->
</target>
<!-- copies the username and password properties from environment vairables if they're set -->
<target name="init-env" depends="check-user-env-and-password-present" if="og.user.and.password.set">
<property name="opengamma.username" value="${env.OG_USER}"/>
<property name="opengamma.password" value="${env.OG_PASSWORD}"/>
</target>
<!-- this task sets the og.user.and.password.set property if the environment variables OG_USER and OG_PASSWORD are set -->
<!-- which overrides the manual prompt so we can do automated builds from within Bamboo -->
<target name="check-user-env-and-password-present">
<condition property="og.user.and.password.set">
<and>
<isset property="env.OG_USER"/>
<isset property="env.OG_PASSWORD"/>
</and>
</condition>
</target>
<target name="checkout-prompt" unless="git.branch">
<echo message="Please enter the branch you with to 'git checkout' in each project"/>
<input message="${line.separator}Branch name" defaultvalue="master" addproperty="git.branch"/>
</target>
<target name="buildlist" depends="load-ivy">
<mkdir dir="projects" />
<ivy:buildlist reference="build-path">
<fileset dir="projects">
<include name="*/build.xml" />
</fileset>
</ivy:buildlist>
</target>
<macrodef name="og-subant">
<attribute name="target" />
<attribute name="buildpathref" />
<sequential>
<echo message="Executing @{target} on sub-project @{buildpathref}"/>
<subant target="@{target}" buildpathref="@{buildpathref}">
<property name="og.build.invoked" value="true" />
</subant>
</sequential>
</macrodef>
<target name="publish-all" depends="buildlist">
<og-subant target="publish" buildpathref="build-path" />
</target>
<target name="publish-all-local" depends="buildlist">
<og-subant target="publish-local" buildpathref="build-path" />
</target>
<target name="publish-all-local-with-clover" depends="buildlist">
<og-subant target="publish-local-with-clover" buildpathref="build-path" />
</target>
<!--
===================================================================
Builds and publish all projects to local repo
===================================================================
-->
<target name="build" depends="check-build-projects-file-for-user" description="compile & publish all projects to the local repo">
<antcall target="publish-all-local">
</antcall>
</target>
<target name="resolve-all" depends="buildlist"
description="resolve all projects via ivy in the right order">
<og-subant target="resolve" buildpathref="build-path" />
</target>
<!-- compile all projects in the right order -->
<target name="compile" depends="buildlist">
<og-subant target="compile" buildpathref="build-path" />
</target>
<!-- ================================================================== -->
<target name="tarball" depends="buildlist">
<og-subant target="tarball" buildpathref="build-path" />
</target>
<target name="zipfile" depends="buildlist">
<og-subant target="src-zipfile" buildpathref="build-path" />
<og-subant target="zipfile" buildpathref="build-path" />
</target>
<property name="dist.dir" value="dist" />
<property name="dist.platform.name" value="platform" />
<target name="dist-name">
<property file="${common.dir}/credentials.properties" />
<property name="dist.file.prefix" value="${opengamma.username}-" />
<property name="dist.platform.prefix" value="${dist.file.prefix}${dist.platform.name}-" />
</target>
<target name="dist-targz">
<mkdir dir="${dist.dir}" />
<tar destfile="${dist.dir}/${dist.platform.prefix}${dist.target}-${module.version.target}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Analytics/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Core/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Engine/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Examples/dist" includes="*/**" excludes="${dist.src.exclude} * **/*.sh" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Examples/dist" includes="**/*.sh" filemode="755" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Financial/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-LiveData/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Master/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-MasterDB/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Security/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Util/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Web/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<tarfileset uid="0" gid="0" dir="${projects.dir}/OG-Examples" includes="lib/jar/**/*" excludes="${dist.lib.exclude}lib/jar/com.opengamma/og-**/*" />
<tarfileset uid="0" gid="0" dir="." includes="lib/.*" excludes="${dist.lib.exclude}${dist.src.exclude}" />
</tar>
</target>
<target name="dist-zip">
<mkdir dir="${dist.dir}" />
<zip destfile="${dist.dir}/${dist.platform.prefix}${dist.target}-${module.version.target}.zip">
<fileset dir="${projects.dir}/OG-Analytics/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Core/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Engine/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Examples/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Financial/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-LiveData/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Master/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-MasterDB/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Security/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Util/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Web/dist" includes="*/**" excludes="${dist.src.exclude} *" />
<fileset dir="${projects.dir}/OG-Examples" includes="lib/jar/**/*" excludes="${dist.lib.exclude}lib/jar/com.opengamma/og-**/*" />
<fileset dir="." includes="lib/.*" excludes="${dist.lib.exclude}${dist.src.exclude}" />
</zip>
</target>
<target name="dist-archive" depends="dist-targz,dist-zip" />
<target name="check-ivy-xml">
<available file="ivy.xml" property="ivy.xml.present" />
</target>
<target name="source-dist-dep" depends="check-ivy-xml" if="ivy.xml.present">
<ivy:resolve haltonfailure="false" />
<ivy:retrieve pattern="${wkspace.dir}/repository/[organization]/[module]/[revision]/[artifact]-[revision].[ext]"
ivypattern="${wkspace.dir}/repository/[organization]/[module]/[revision]/ivy.xml"
type="jar" />
</target>
<macrodef name="fetchJAR">
<attribute name="conf" default="*" />
<attribute name="org" />
<attribute name="module" />
<attribute name="revision" />
<sequential>
<ivy:resolve inline="true" keep="true" conf="@{conf}" organisation="@{org}" module="@{module}" revision="@{revision}" />
<ivy:retrieve pattern="${wkspace.dir}/repository/[organization]/[module]/[revision]/[artifact]-[revision].[ext]" ivypattern="${wkspace.dir}/repository/[organization]/[module]/[revision]/ivy.xml" type="jar" />
</sequential>
</macrodef>
<target name="source-dist-depivy">
<replaceregexp file="${repository.filename}" match="^[^<]*<artifact.*type\s*=\s*"([^j]|j[^a]|ja[^r]|jar[^"])[^>]*>" replace="<!-- \0 -->" flags="m" byline="true" />
<!-- Fix the unescaped ampersand in e.g. the mockito ivy.xml file -->
<replaceregexp file="${repository.filename}" match="& " replace="&amp; " />
</target>
<target name="eclipse-readme">
<property name="eclipse.readme.urlbase" value="http://docs.opengamma.com" />
<property name="eclipse.readme" value="Setting-up-an-Eclipse-workspace.html" />
<get src="${eclipse.readme.urlbase}/display/DOC/Setting+Up+An+Eclipse+Workspace" dest="${eclipse.readme}" />
<replaceregexp file="${eclipse.readme}" match="^.*<!-- wiki content -->" replace="<html><body>" flags="s" />
<replaceregexp file="${eclipse.readme}" match="<!--.*$" replace="<body><html>" flags="s" />
<replaceregexp file="${eclipse.readme}" match=""/(display|images)" replace=""${eclipse.readme.urlbase}/\1" flags="g" />
</target>
<target name="dist-source" depends="clean,dist-name,eclipse-readme"
description="builds a single source distribution zipfile">
<mkdir dir="${dist.dir}" />
<tar destfile="${dist.dir}/${dist.platform.prefix}src-nodep-${module.version.target}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset uid="0" gid="0" dir="." prefix="OG-Platform">
<include name="**/*" />
<exclude name="**/.git/" />
<exclude name="**/build/" />
<exclude name="**/dist/" />
<exclude name="repository/" />
<exclude name="**/*.sh" />
</tarfileset>
<tarfileset uid="0" gid="0" dir="." prefix="OG-Platform" filemode="755">
<include name="**/*.sh" />
</tarfileset>
</tar>
<zip destfile="${dist.dir}/${dist.platform.prefix}src-nodep-${module.version.target}.zip">
<zipfileset dir="." prefix="OG-Platform">
<include name="**/*" />
<exclude name="**/.git/" />
<exclude name="**/build/" />
<exclude name="**/dist/" />
<exclude name="repository/" />
</zipfileset>
</zip>
<subant genericantfile="${wkspace.dir}/build.xml" target="source-dist-dep" inheritall="true">
<dirset dir="projects" includes="*" />
</subant>
<!-- Some packages request older versions while others use later ones which are downloaded.
Need to manually fetch the older version into the cache so the resolve works correctly. -->
<!-- TODO: probably don't need the jar, just the ivy.xml file for these ! -->
<fetchJAR org="org.springframework" module="spring" revision="[2.5.3,3.0[" conf="core" />
<fetchJAR org="org.antlr" module="antlr" revision="2.7.7" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<foreach target="source-dist-depivy" param="repository.filename">
<fileset dir="repository" includes="**/*.xml" />
</foreach>
<replaceregexp file="common/build.properties" match="^env\.IVY_SHARED_DEFAULT_ROOT=.*$" replace="" flags="mg" />
<replaceregexp file="common/build.properties" match="^\n(env\.IVY_SHARED_DEFAULT_ROOT_.*)$" replace="env.IVY_SHARED_DEFAULT_ROOT=$${wkspace.dir}/repository${line.separator}\1" flags="mg" />
<tar destfile="${dist.dir}/${dist.platform.prefix}src-${module.version.target}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset uid="0" gid="0" dir="." prefix="OG-Platform">
<include name="**/*" />
<exclude name="**/.git/" />
<exclude name="**/dist/" />
<exclude name="projects/*/lib/" />
<exclude name="**/*.sh" />
</tarfileset>
<tarfileset uid="0" gid="0" dir="." prefix="OG-Platform" filemode="755">
<include name="**/*.sh" />
</tarfileset>
</tar>
<zip destfile="${dist.dir}/${dist.platform.prefix}src-${module.version.target}.zip">
<zipfileset dir="." prefix="OG-Platform">
<include name="**/*" />
<exclude name="**/.git/" />
<exclude name="**/dist/" />
<exclude name="projects/*/lib/" />
</zipfileset>
</zip>
</target>
<target name="dist-binary" depends="clean-projects,publish-all-local,binary-dist-impl"
description="builds a single binary distribution zipfile" />
<target name="binary-dist-impl" depends="buildlist,dist-name">
<og-subant target="dist-nodep" buildpathref="build-path" />
<antcall target="dist-archive">
<param name="dist.target" value="binary-nodep" />
<param name="dist.lib.exclude" value="**/* " />
<param name="dist.src.exclude" value="*/.project */.classpath" />
</antcall>
<antcall target="dist-archive">
<param name="dist.target" value="binary" />
<param name="dist.lib.exclude" value="" />
<param name="dist.src.exclude" value="*/.project */.classpath" />
</antcall>
</target>
<!-- og-examples-dist is probably more useful than binary-dist -->
<target name="dist-og-examples" depends="clean-projects,publish-all-local,og-examples-dist-impl"/>
<target name="og-examples-dist-impl" depends="buildlist,dist-name">
<subant target="zipfile" buildpath="${projects.dir}/OG-Examples">
<property name="og.build.invoked" value="true" />
<property name="ivy.new.revision" value="${module.version.target}" />
</subant>
<subant target="tarball" buildpath="${projects.dir}/OG-Examples">
<property name="og.build.invoked" value="true" />
<property name="ivy.new.revision" value="${module.version.target}" />
</subant>
<copy todir="${dist.dir}">
<fileset dir="${projects.dir}/OG-Examples/dist">
<include name="og-examples-*.zip" />
<include name="og-examples-*.tar.gz" />
</fileset>
<globmapper from="og-*" to="${dist.file.prefix}*" />
</copy>
</target>
<target name="dist-install" depends="dist-name,install">
<mkdir dir="${dist.dir}" />
<tar destfile="${dist.dir}/${dist.platform.prefix}binary-${module.version.target}.tar.gz" compression="gzip" longfile="gnu">
<tarfileset uid="0" gid="0" dir="${install.dir}" includes="${install.name}/**" excludes="${install.name}/**/*.sh" />
<tarfileset uid="0" gid="0" dir="${install.dir}" includes="${install.name}/**/*.sh" filemode="755" />
</tar>
<zip destfile="${dist.dir}/${dist.platform.prefix}binary-${module.version.target}.zip">
<fileset dir="${install.dir}" includes="${install.name}/**" />
</zip>
</target>
<!-- ================================================================== -->
<target name="tests-individual-reports" depends="buildlist"
description="run tests for all projects with separate reports">
<og-subant target="tests" buildpathref="build-path" />
</target>
<target name="tests" depends="test-batch,junit-report"
description="run tests for all projects with combined report"/>
<target name="test-batch" depends="buildlist,test-batch-clean">
<subant target="test-batch" buildpathref="build-path">
<property name="tests.junit.dir" value="${basedir}/tests/output"/>
<!--property name="tests.dir" value="${basedir}/tests"/-->
</subant>
</target>
<target name="test-batch-clean">
<delete dir="${tests.junit.dir}/junitreports" includeemptydirs="true" failonerror="false" />
<delete dir="${tests.junit.dir}/xml" includeemptydirs="true" failonerror="false" />
<delete dir="${tests.junit.dir}/html" includeemptydirs="true" failonerror="false" />
</target>
<target name="junit-report" depends="test-batch">
<mkdir dir="${tests.junit.dir}/html" />
<junitreport todir="${tests.junit.dir}/xml">
<fileset dir="${tests.junit.dir}/xml" includes="TEST-*.xml" />
<!-- this defaults to noframes because frames uses TONS more memory due to console logging, if you -->
<!-- really want frames output you'll need to change ANT_OPTS to include something like -Xmx4096m -->
<!-- you might also need to up the stack frame size with -Xms -->
<report todir="${tests.junit.dir}/html" format="noframes" />
</junitreport>
</target>
<!-- ================================================================== -->
<target name="clean-ivy-cache" depends="load-ivy">
<ivy:cleancache />
</target>
<target name="clean-projects" depends="buildlist">
<og-subant target="clean" buildpathref="build-path" />
</target>
<target name="clean-lib">
<delete includeemptydirs="true" dir="${lib.dir}" />
</target>
<target name="clean-lib-all" depends="buildlist">
<og-subant target="clean-lib" buildpathref="build-path" />
</target>
<target name="clean-install">
<property name="install.dir.full" value="${install.dir}/${install.name}" />
<delete dir="${install.dir}/${install.name}" failonerror="false" />
<subant target="clean" buildpath="Installer" />
</target>
<!--
=====================================================================================
Clean all projects, delete repository, reload ivy and clean the ivy cache
=====================================================================================
-->
<target name="clean-all" depends="clean, clean-ivy-cache" description="clean all projects, delete repository, reload ivy & clean the ivy cache" />
<target name="clean" depends="clean-install, clean-projects, clean-lib, load-ivy"
description="clean all projects, delete repository & reload ivy">
<delete dir="${repository.dir}" />
<delete dir="${docs.dir}" quiet="true" failonerror="false"/>
</target>
<!-- ================================================================== -->
<target name="fudge-proto">
<og-subant target="fudge-proto" buildpathref="build-path" />
</target>
<!-- builds the Joda-Bean files -->
<target name="joda-bean" depends="buildlist">
<og-subant target="joda-bean" buildpathref="build-path" />
</target>
<!-- ================================================================== -->
<!-- this searches for @PublicAPI and @PublicSPI annotations and uses them -->
<!-- to filter the output -->
<target name="javadoc-public" depends="load-ivy, resolve">
<mkdir dir="${docs.dir}" />
<mkdir dir="${docs.dir}/javadoc-public" />
<mkdir dir="${docs.dir}/temp-src" />
<copy toDir="${docs.dir}/temp-src">
<fileset dir="${projects.dir}/OG-Engine/src" includes="**/*.java **/package.html">
<contains text="@PublicAPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Engine/src" includes="**/*.java **/package.html">
<contains text="@PublicSPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Util/src" includes="**/*.java **/package.html">
<contains text="@PublicAPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Util/src" includes="**/*.java **/package.html">
<contains text="@PublicSPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Core/src" includes="**/*.java **/package.html">
<contains text="@PublicAPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Core/src" includes="**/*.java **/package.html">
<contains text="@PublicSPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Master/src" includes="**/*.java **/package.html">
<contains text="@PublicAPI" casesensitive="yes"/>
</fileset>
<fileset dir="${projects.dir}/OG-Master/src" includes="**/*.java **/package.html">
<contains text="@PublicSPI" casesensitive="yes"/>
</fileset>
</copy>
<javadoc sourcepath="${docs.dir}/temp-src" destdir="${docs.dir}/javadoc-public"
classpathref="lib.path.id" author="false" windowtitle="${javadocs.windowtitle}"
doctitle="${javadocs.doctitle}" bottom="${javadocs.footer}">
<link href="http://download.oracle.com/javase/6/docs/api/" />
<link href="http://dist.fudgemsg.org/java/javadoc/0.2/" />
<link href="http://threeten.sourceforge.net/apidocs/" />
<link href="http://joda-beans.sourceforge.net/apidocs/" />
</javadoc>
<delete dir="${docs.dir}/temp-src"/>
</target>
<target name="test-docs-dir">
<mkdir dir="${docs.dir}" />
<mkdir dir="${docs.dir}/javadoc-all" />
</target>
<!--
===================================================================
Creates javadocs documentation for whole system
===================================================================
-->
<target name="docs" depends="javadoc-all, javadoc-public-jar" description="javadoc & archive for the whole system (requires > 2GB RAM)" />
<target name="javadoc-single">
<delete dir="${docs.dir}/javadoc-single" includeemptydirs="true" failonerror="false" />
<mkdir dir="${docs.dir}" />
<mkdir dir="${docs.dir}/javadoc-single" />
<javadoc
bottom="${javadoc-all.bottom}"
classpathref="lib.path.id"
destdir="${docs.dir}/javadoc-single"
header="${javadoc-all.header}"
linksource="Yes"
sourcefiles="${fn}"
/>
</target>
<target name="javadoc-one">
<delete dir="${docs.dir}/javadoc-one" includeemptydirs="true" failonerror="false" />
<mkdir dir="${docs.dir}" />
<mkdir dir="${docs.dir}/javadoc-one" />
<javadoc
sourcefiles="${fn}"
sourcepath="${fn}"
destdir="${docs.dir}/javadoc-one"
classpathref="lib.path.id"
failonerror="Yes"
doclet="it.dexy.doclet.MathJaxDoclet"
docletpathref="lib.path.id"
/>
</target>
<target name="javadoc-all" depends="load-ivy, resolve">
<mkdir dir="${docs.dir}" />
<mkdir dir="${docs.dir}/javadoc-all" />
<mkdir dir="${docs.dir}/temp-src" />
<copy toDir="${docs.dir}/temp-src">
<fileset dir="${projects.dir}/OG-Analytics/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Bloomberg/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-BloombergExample/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Component/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Core/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Engine/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Examples/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Financial/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Integration/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Language/Client/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-LiveData/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Master/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-MasterDB/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Maths/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Security/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Util/src" includes="**/*.java **/package.html"/>
<fileset dir="${projects.dir}/OG-Web/src" includes="**/*.java **/package.html"/>
</copy>
<javadoc sourcepath="${docs.dir}/temp-src" destdir="${docs.dir}/javadoc-all"
classpathref="lib.path.id" author="false" windowtitle="${javadoc-all.windowtitle}"
doctitle="${javadoc-all.doctitle}" bottom="${javadoc-all.bottom}"
header="${javadoc-all.header}" failonerror="Yes"
maxmemory="2G">
<link href="http://download.oracle.com/javase/6/docs/api/" />
<link href="http://dist.fudgemsg.org/java/javadoc/0.2/" />
<link href="http://threeten.sourceforge.net/apidocs/" />
<link href="http://joda-beans.sourceforge.net/apidocs/" />
</javadoc>
<!-- process javadocs to a sqlite file for Dexy -->
<delete file="docs/shared/docs.sqlite3" />
<javadoc
sourcepath="${docs.dir}/temp-src"
destdir="docs/shared/docs.sqlite3"
classpathref="lib.path.id"
failonerror="Yes"
doclet="it.dexy.doclet.DexyDoclet"
docletpathref="lib.path.id"
>
</javadoc>
<delete dir="${docs.dir}/temp-src"/>
</target>
<target
name="dexy"
depends="javadoc-all,dexy-only,copy-javadocs-to-dexy"
description="Runs dexy for OG-Platform docs. Requires dexy and LaTeX."
/>
<target name="dexy-only" description="Runs dexy without processing OpenGamma source changes (faster).">
<exec executable="dexy" dir="docs">
<arg value="setup" />
</exec>
<property name="oglibpathid" refid="lib.path.id"/>
<property name="oglibs" value="${projects.dir}/OG-Analytics/lib/classpath.jar:${projects.dir}/OG-Analytics/build/og-analytics.jar:${projects.dir}/OG-Financial/build/og-financial.jar" />
<exec executable="dexy" dir="docs" failonerror="true">
<env key="CLASSPATH" value="${oglibpathid}:${oglibs}" />
</exec>
</target>
<!-- Idea here is that these get copied into a directory which can then be
uploaded to docs-static, along with dexy-generated docs, and also to
make it easier to preview all docs using a local web server. -->
<target name="copy-javadocs-to-dexy">
<property name="javadocs.destdir" value="docs/output/javadocs" />
<copy todir="${javadocs.destdir}" preservelastmodified="true">
<fileset dir="${docs.dir}/javadoc-all" />
</copy>
<echo message="Copied javadocs to ${javadocs.destdir}" />
</target>
<!-- we might need to do something with versioning here (like depends on 'version' from common.xml) -->
<!-- javadoc (public) built into a jar file -->
<target name="javadoc-public-jar" depends="javadoc-public">
<jar destfile="${javadocs.jar.file}" basedir="${docs.dir}/javadoc-public"
compress="${jar.compress}" />
</target>
<!-- ================================================================== -->
<!-- publishes common directory for Bamboo -->
<target name="publish-common-dir" if="publish-common-dir" depends="init">
<echo message="Syncing common files to ${publish-common-dir}" />
<sync todir="${publish-common-dir}/">
<fileset dir=".">
<include name="common/**"/>
<include name="LICENSE.txt"/>
<include name="git-macros.xml"/>
<include name="git-tasks.xml"/>
</fileset>
</sync>
</target>
<!--
===================================================================
Generate ivy dependency report
===================================================================
-->
<target name="ivy-report" description="generate ivy dependency report" depends="load-ivy">
<ivy:report organisation="com.opengamma" module="og-integration" conf="*" />
</target>
<import file="${common.dir}/clover-common.xml"/>
<import file="${common.dir}/build-projects.xml" optional="true"/>
<available property="build.projects.ok" file="${common.dir}/build-projects.xml" />
<target name="clover-noload" if="build.projects.ok">
<antcall target="projects.clover" />
</target>
<target name="clover-load" unless="build.projects.ok">
<echo>Reloading build system ...</echo>
<subant target="projects.clover" buildpath="${basedir}" antfile="build.xml" />
</target>
<target name="clover" depends="clover-noload,clover-load" />
<target name="clone-or-pull-noload" if="build.projects.ok">
<antcall target="projects.clone-or-pull" />
</target>
<target name="clone-or-pull-load" unless="build.projects.ok">
<echo>Reloading build system ...</echo>
<subant target="projects.clone-or-pull" buildpath="${basedir}" antfile="build.xml" />
</target>
<!--
===================================================================
Git sync all projects using clone/pull
===================================================================
-->
<target name="clone-or-pull" depends="check-build-projects-file-for-user,clone-or-pull-noload,clone-or-pull-load" description="git sync all projects using clone/pull" />
<target name="pull-noload" if="build.projects.ok">
<antcall target="projects.pull" />
</target>
<target name="pull-load" unless="build.projects.ok">
<echo>Reloading build system ...</echo>
<subant target="projects.pull" buildpath="${basedir}" antfile="build.xml" />
</target>
<target name="fetch-noload" if="build.projects.ok">
<antcall target="projects.fetch" />
</target>
<target name="fetch-load" unless="build.projects.ok">
<echo>Reloading build system ...</echo>
<subant target="projects.fetch" buildpath="${basedir}" antfile="build.xml" />
</target>
<!--
===================================================================
Git sync all projects using pull
===================================================================
-->
<target name="pull" depends="pull-noload,pull-load" description="git sync all projects using pull" />
<target name="fetch" depends="fetch-noload,fetch-load" description="git sync all projects using fetch" />
<target name="status-noload" if="build.projects.ok">
<antcall target="projects.status" />
</target>
<target name="status-load" unless="build.projects.ok">
<echo>Reloading build system ...</echo>
<subant target="projects.status" buildpath="${basedir}" antfile="build.xml" />
</target>
<target name="status" depends="status-noload,status-load" description="git status check" />
<!--
===================================================================
Set the properties related to credential.properties
===================================================================
-->
<property name="credentials.file" value="${common.dir}/credentials.properties" />
<!--
- - - - - - - - - - - - - - - - -
target: check-build-projects-file-for-user
- - - - - - - - - - - - - - - - -
-->
<target name="check-build-projects-file-for-user">
<available property="credential.file.ok" file="${credentials.file}" />
<antcall target="fetch-default-config" />
</target>
<macrodef name="get-build-projects-file">
<attribute name="repository" />
<attribute name="module" />
<attribute name="user" />
<attribute name="pass" />
<sequential>
<get src="@{repository}/users/@{user}/@{module}/ant/build-projects.xml" dest="${common.dir}/build-projects.xml" username="@{user}" password="@{pass}" />
<get src="@{repository}/users/@{user}/@{module}/config/tests.properties" dest="${common.dir}/tests.properties" username="@{user}" password="@{pass}" />
<get src="@{repository}/users/@{user}/@{module}/config/db.properties" dest="${common.dir}/db.properties" username="@{user}" password="@{pass}" />
<get src="@{repository}/users/@{user}/@{module}/config/deploy.properties" dest="${common.dir}/deploy.properties" username="@{user}" password="@{pass}" />
</sequential>
</macrodef>
<!--
- - - - - - - - - - - - - - - - -
target: fetch-default-config
- - - - - - - - - - - - - - - - -
-->
<target name="fetch-default-config" unless="credential.file.ok">
<property name="username" value="opengamma-public" />
<property name="password" value="opengamma" />
<echo file="${credentials.file}">opengamma.username=${username}${line.separator}opengamma.password=${password}</echo>
<get-build-projects-file repository="${opengamma.config.repository}" module="${module.version.target}" user="${username}" pass="${password}" />
</target>
<!--
===================================================================
Installs Opengamma Engine
===================================================================
-->
<target name="install" depends="check-build-projects-file-for-user" description="install artifacts to directory specified by property (install.dir)">
<fail message="You must set the property install.dir=/where/to/install" unless="install.dir"/>
<antcall inheritAll="false" target="install-impl">
<param name="install.dir.full" value="${install.dir}/${install.name}" />
</antcall>
</target>
<target name="install-impl" depends="clean-install, clean-projects, publish-all-local">
<mkdir dir="${install.dir.full}" />
<property file="${common.dir}/deploy.properties"/>
<subant target="install" antfile="build.xml">
<path>
<pathelement path="${project.deploy}" />
</path>
<property name="og.build.invoked" value="true" />
<property name="ivy.new.revision" value="${module.version.target}" />
<property name="install.dir" value="${install.dir.full}" />
</subant>
</target>
<target name="clean-src"/>
</project>