-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.xml
executable file
·849 lines (701 loc) · 37.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
844
845
846
847
848
849
<?xml version="1.0" encoding="UTF-8"?>
<project name="Pulse" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:jsl="antlib:com.googlecode.jslint4java" xmlns:zutubi="antlib:com.zutubi.ant">
<!-- Import general purpose macros. -->
<import file="macros.xml"/>
<property file="local.properties"/>
<property file="build.properties"/>
<property environment="env"/>
<condition property="on.windows">
<os family="windows"/>
</condition>
<!-- check if the nsis executable is available for packaging. -->
<condition property="nsis.found">
<or>
<available file="makensis" filepath="${env.PATH}"/>
<available file="makensis.exe" filepath="${env.PATH}"/>
<available file="makensis.exe" filepath="${env.Path}"/>
</or>
</condition>
<!-- indicate whether or not we can run the nsis phase of the packaging -->
<condition property="run.nsis">
<and>
<isset property="on.windows"/>
<isset property="nsis.found"/>
</and>
</condition>
<presetdef name="javac">
<javac includeantruntime="false" />
</presetdef>
<target name="init">
<dirname property="project.root.dir" file="./build.xml"/>
<property name="project.repository" value="${project.root.dir}/build/repository"/>
<path id="custom.task.path">
<fileset dir="${project.root.dir}/etc">
<include name="**/*.jar"/>
<exclude name="shrinksafe*.jar"/>
<exclude name="js.jar"/>
</fileset>
</path>
<taskdef name="copyright" classname="com.zutubi.pulse.CopyrightTask" classpathref="custom.task.path"/>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpathref="custom.task.path"/>
<taskdef uri="antlib:com.zutubi.ant" resource="com/zutubi/ant/antlib.xml" classpathref="custom.task.path"/>
<taskdef name="jsconcat" classname="com.zutubi.ant.javascript.concatenate.ConcatenateJavascriptTask" classpathref="custom.task.path"/>
<taskdef uri="antlib:com.googlecode.jslint4java" resource="com/googlecode/jslint4java/antlib.xml" classpathref="custom.task.path" />
<!-- create the local.properties file if it does not yet exist. -->
<copy file="etc/local.properties.template" tofile="local.properties" overwrite="false"/>
<load-ivy-taskdef/>
<ivy:settings file="ivysettings.xml"/>
</target>
<target name="clean" depends="clean.all, clean.dev"/>
<target name="buildlist" depends="init">
<ivy:buildlist reference="build.path" onMissingDescriptor="skip">
<fileset dir="${project.root.dir}" includes="*/build.xml"/>
<fileset dir="${project.root.dir}/bundles" includes="*/build.xml"/>
</ivy:buildlist>
</target>
<target name="show.all" depends="buildlist">
<subant inheritall="false" target="show" buildpathref="build.path"/>
</target>
<target name="clean.all" depends="buildlist">
<subant inheritall="false" target="clean" buildpathref="build.path"/>
<delete dir="build"/>
</target>
<target name="check.js" depends="init">
<jsl:jslint options="browser,confusion,evil,forin,plusplus,regexp,sloppy,white,nomen">
<predef>jQuery,kendo,Ext,Zutubi,showStatus,hideStatus,confirm,detailPanel,refresh,unescape,handleActionResponse,agentAction,handleSuccessfulConfigurationResponse,treesInitialised,each,toHtmlName,getBuildMenuItems,getBuildMenuLinks,getCommentsTooltip,takeResponsibility,clearResponsibility,showPromptDialog,cancelBuild,cancelQueuedBuild,encodeURIPath,configTree,navigateToOwner,actionPath,confirmUrl,handleDialogResponse,runAjaxRequest,triggerBuild</predef>
<formatter type="plain" />
<fileset dir="com.zutubi.pulse.master/src/www/js" includes="**/*.js" excludes="ext/**,kendo/**,widget/treegrid/**"/>
</jsl:jslint>
</target>
<target name="build.all" depends="buildlist">
<subant inheritall="false" target="build.module" buildpathref="build.path">
<property name="skip.dependencies" value="true"/>
</subant>
<!-- Generate one mega report -->
<property name="report.dir" value="build/reports/junit"/>
<mkdir dir="${report.dir}/html"/>
<junitreport todir="${report.dir}">
<fileset dir=".">
<include name="*/${report.dir}/xml/*.xml"/>
<include name="bundles/*/${report.dir}/xml/*.xml"/>
</fileset>
<report format="frames" todir="${report.dir}/html"/>
</junitreport>
</target>
<target name="deps.all" depends="init"
description="Reports all dependencies.">
<set-package-deps module="master"/>
<subant inheritall="false" target="deps" buildpathref="build.path.master"/>
</target>
<target name="dist.all" depends="init"
description="Publishes built artifacts to the Subversion repository, assuming they are already built.">
<set-package-deps module="master"/>
<subant inheritall="false" target="dist" buildpathref="build.path.master"/>
</target>
<target name="clean.dev" description="Cleans up data created during development.">
<delete dir="data"/>
<!-- clean up this annoying log file. -->
<delete file="velocity.log"/>
<!-- clean out the master -->
<delete dir="com.zutubi.pulse.master/system"/>
<delete file="com.zutubi.pulse.master/etc/admin.token"/>
<delete file="com.zutubi.pulse.master/etc/service.token"/>
<delete file="com.zutubi.pulse.master/etc/runtime.properties"/>
<!-- clean out the slave -->
<delete dir="com.zutubi.pulse.slave/system"/>
<delete file="com.zutubi.pulse.slave/etc/admin.token"/>
<delete file="com.zutubi.pulse.slave/etc/service.token"/>
<delete file="com.zutubi.pulse.slave/etc/runtime.properties"/>
<!-- clean out the script/test playground. -->
<delete dir="working"/>
<!-- clean out the user.home/.pulse2?/* directory -->
<delete dir="${user.home}/.pulse2"/>
<delete dir="${user.home}/.pulse2-agent"/>
<!-- goodbye plugin registry -->
<delete file="plugins/plugin-registry.xml"/>
<!-- can the testing plugins -->
<delete quiet="true">
<fileset dir="plugins/prepackaged" includes="com.zutubi.pulse.core.postprocessors.test.*.jar"/>
</delete>
<!-- the following should be cleaned out by calls to the respective module/clean targets. -->
<delete dir="package/core/build"/>
<delete dir="package/dev/build"/>
<delete dir="package/servercore/build"/>
<delete dir="package/slave/build"/>
<delete dir="package/master/build"/>
</target>
<target name="package.dev" depends="init">
<build-package-deps module="dev"/>
<antcall target="assemble.package.dev"/>
</target>
<target name="assemble.package.dev" depends="init">
<property name="package.name.dev" value="pulse-dev-${pulse.version}"/>
<property name="package.root.dev" value="build/package/${package.name.dev}"/>
<property name="version.root.dev" value="${package.root.dev}/versions/${pulse.build}"/>
<delete dir="${package.root.dev}"/>
<mkdir dir="${package.root.dev}"/>
<copy file="etc/active-version.txt" todir="${package.root.dev}"/>
<replace file="${package.root.dev}/active-version.txt">
<replacefilter token="__BUILD_NUMBER__" value="${pulse.build}"/>
</replace>
<copy todir="${package.root.dev}/bin">
<fileset dir="com.zutubi.pulse.core/src/bin" includes="**/*"/>
</copy>
<fixcrlf srcdir="${package.root.dev}/bin" eol="lf" eof="remove" includes="**/*.sh"/>
<chmod perm="755" dir="${package.root.dev}/bin" includes="**/*.sh"/>
<retrieve-package-deps module="dev" dest="${version.root.dev}"/>
<copy todir="${version.root.dev}/lib">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.dll"/>
<fileset dir="com.zutubi.pulse.dev/etc" includes="*.xml"/>
</copy>
<copy todir="${version.root.dev}/boot">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.dev/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.dev/etc" includes="classpath.txt"/>
</copy>
<native-zip dir="${package.root.dev}/.." file="../${package.name.dev}.zip" path="${package.name.dev}"/>
<tar destfile="build/${package.name.dev}.tar.gz" compression="gzip">
<tarfileset dir="${package.root.dev}/.." mode="755" username="root" group="root">
<include name="${package.name.dev}/bin/*"/>
</tarfileset>
<tarfileset dir="${package.root.dev}/.." username="root" group="root">
<include name="${package.name.dev}/**/*"/>
<exclude name="${package.name.dev}/bin/*"/>
</tarfileset>
</tar>
<antcall target="nsis.dev"/>
</target>
<target name="nsis.dev" if="run.nsis">
<property name="package.name.dev" value="pulse-dev-${pulse.version}"/>
<property name="package.root.dev" value="build/package/${package.name.dev}"/>
<copy file="installer/env.nsh" todir="${package.root.dev}"/>
<copy file="installer/pulse.ico" todir="${package.root.dev}"/>
<copy file="installer/dev.nsi.in" tofile="${package.root.dev}/dev.nsi"/>
<copy file="installer/findjava.exe" todir="${package.root.dev}/bin"/>
<replace file="${package.root.dev}/dev.nsi">
<replacefilter token="__PACKAGE_NAME__" value="${package.name.dev}"/>
<replacefilter token="__VERSION__" value="${pulse.version}"/>
</replace>
<exec executable="makensis" dir="${package.root.dev}">
<arg line="dev.nsi"/>
</exec>
</target>
<target name="package.slave" depends="init">
<build-package-deps module="slave"/>
<antcall target="assemble.package.slave"/>
</target>
<target name="assemble.package.slave" depends="init">
<property name="package.name.slave" value="pulse-agent-${pulse.version}"/>
<property name="package.root.slave" value="build/package/${package.name.slave}"/>
<property name="version.root.slave" value="${package.root.slave}/versions/${pulse.build}"/>
<delete dir="${package.root.slave}"/>
<mkdir dir="${package.root.slave}"/>
<copy file="etc/active-version.txt" todir="${package.root.slave}"/>
<replace file="${package.root.slave}/active-version.txt">
<replacefilter token="__BUILD_NUMBER__" value="${pulse.build}"/>
</replace>
<copy todir="${package.root.slave}/bin">
<fileset dir="com.zutubi.pulse.core/src/bin" includes="**/*"/>
<fileset dir="com.zutubi.pulse.servercore/src/bin" includes="**/*"/>
</copy>
<copy todir="${package.root.slave}/lib">
<fileset dir="com.zutubi.pulse.servercore/src/lib" includes="**/*"/>
</copy>
<fixcrlf srcdir="${package.root.slave}/bin" eol="lf" eof="remove" includes="**/*.sh"/>
<chmod perm="755" dir="${package.root.slave}/bin" includes="**/*.sh" verbose="true"/>
<retrieve-package-deps module="slave" dest="${version.root.slave}"/>
<copy todir="${package.root.slave}/logs">
<fileset dir="etc" includes="delete-me.txt"/>
</copy>
<replace dir="${package.root.slave}" token="@VERSION@" value="${pulse.version}">
<include name="README.txt"/>
</replace>
<copy todir="${version.root.slave}/system/config">
<fileset dir="com.zutubi.pulse.slave/etc" includes="pulse-agent.properties,logging.properties"/>
<fileset dir="com.zutubi.pulse.slave/etc" includes="logging/*.properties"/>
</copy>
<copy todir="${version.root.slave}/system/www">
<fileset dir="com.zutubi.pulse.slave/src/www" includes="**/*"/>
</copy>
<copy todir="${version.root.slave}/lib">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.dll"/>
<fileset dir="com.zutubi.pulse.slave/etc" includes="*.xml"/>
</copy>
<copy todir="${version.root.slave}/boot">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.dev/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.servercore/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.slave/etc" includes="classpath.txt"/>
</copy>
<replace dir="${package.root.slave}/bin" replacefilterfile="com.zutubi.pulse.slave/subst.properties">
<include name="**/*.in"/>
</replace>
<move todir="${package.root.slave}/bin">
<fileset dir="${package.root.slave}/bin"/>
<mapper type="glob" from="*.in" to="*"/>
</move>
<move todir="${package.root.slave}/bin">
<fileset dir="${package.root.slave}/bin">
<include name="**/PulseService*"/>
</fileset>
<filtermapper>
<replacestring from="PulseService" to="PulseAgent"/>
</filtermapper>
</move>
<!-- the ant zip command doesn't preserve permissions, so we call out to zip -->
<exec executable="zip" dir="${package.root.slave}/..">
<arg line="-r ../${package.name.slave}.zip ${package.name.slave}"/>
</exec>
<tar destfile="build/${package.name.slave}.tar.gz" compression="gzip">
<tarfileset dir="${package.root.slave}/.." mode="755" username="root" group="root">
<include name="${package.name.slave}/bin/*"/>
</tarfileset>
<tarfileset dir="${package.root.slave}/.." username="root" group="root">
<include name="${package.name.slave}/**/*"/>
<exclude name="${package.name.slave}/bin/*"/>
</tarfileset>
</tar>
<antcall target="nsis.slave"/>
</target>
<target name="nsis.slave" if="run.nsis">
<property name="package.name.slave" value="pulse-agent-${pulse.version}"/>
<property name="package.root.slave" value="build/package/${package.name.slave}"/>
<copy file="installer/env.nsh" todir="${package.root.slave}"/>
<copy file="installer/pulse.ico" todir="${package.root.slave}"/>
<copy file="installer/pulse.nsi.in" tofile="${package.root.slave}/pulse.nsi"/>
<copy file="installer/findjava.exe" todir="${package.root.slave}/bin"/>
<replace file="${package.root.slave}/pulse.nsi" replacefilterfile="com.zutubi.pulse.slave/subst.properties">
<replacefilter token="__PACKAGE_NAME__" value="${package.name.slave}"/>
<replacefilter token="__VERSION__" value="${pulse.version}"/>
</replace>
<exec executable="makensis" dir="${package.root.slave}">
<arg line="pulse.nsi"/>
</exec>
</target>
<target name="package.master" depends="init, check.js">
<!-- Check that all plugins will be included in some package -->
<exec executable="python" failonerror="true">
<arg line="scripts/check-plugins.py"/>
</exec>
<build-package-deps module="master"/>
<antcall target="assemble.package.dev"/>
<antcall target="assemble.package.slave"/>
<property name="package.name.master" value="pulse-${pulse.version}"/>
<property name="package.root.master" value="build/package/${package.name.master}"/>
<property name="version.root.master" value="${package.root.master}/versions/${pulse.build}"/>
<delete dir="${package.root.master}"/>
<mkdir dir="${package.root.master}"/>
<copy file="etc/active-version.txt" todir="${package.root.master}"/>
<replace file="${package.root.master}/active-version.txt">
<replacefilter token="__BUILD_NUMBER__" value="${pulse.build}"/>
</replace>
<copy todir="${package.root.master}/bin">
<fileset dir="com.zutubi.pulse.core/src/bin" includes="**/*"/>
<fileset dir="com.zutubi.pulse.servercore/src/bin" includes="**/*"/>
</copy>
<copy todir="${package.root.master}/lib">
<fileset dir="com.zutubi.pulse.servercore/src/lib" includes="**/*"/>
</copy>
<fixcrlf srcdir="${package.root.master}/bin" eol="lf" eof="remove" includes="**/*.sh"/>
<chmod perm="755" dir="${package.root.master}/bin" includes="**/*.sh" verbose="true"/>
<retrieve-package-deps module="master" dest="${version.root.master}"/>
<copy todir="${version.root.master}/system/templates">
<fileset dir="com.zutubi.pulse.master/src/templates" includes="**/*.vm **/*.ftl **/*.properties **/*.example"/>
</copy>
<copy todir="${package.root.master}/logs">
<fileset dir="etc" includes="delete-me.txt"/>
</copy>
<copy todir="${version.root.master}/system/www">
<fileset dir="com.zutubi.pulse.master/src/www" includes="**/*" excludes="js/**"/>
</copy>
<jsconcat outputFile="build/pulse.js" sourceDir="com.zutubi.pulse.master/src/www/js">
<include name="**/*.js"/>
</jsconcat>
<mkdir dir="${version.root.master}/system/www/js/"/>
<java jar="etc/yuicompressor-2.4.2.jar" fork="true">
<arg value="--nomunge"/>
<arg value="-o"/>
<arg value="${version.root.master}/system/www/js/pulse.js"/>
<arg value="build/pulse.js"/>
<classpath>
<pathelement location="etc/jargs-1.0.jar"/>
<pathelement location="etc/rhino-1.6R7.jar"/>
</classpath>
</java>
<!-- copy the readme file. -->
<copy todir="${package.root.master}">
<fileset dir="etc" includes="README.txt"/>
</copy>
<replace dir="${package.root.master}" token="@VERSION@" value="${pulse.version}">
<include name="README.txt"/>
</replace>
<!-- /config is for user configuration properties -->
<copy todir="${version.root.master}/system/config">
<fileset dir="com.zutubi.pulse.master/etc" includes="pulse-defaults.properties,logging.properties"/>
<fileset dir="com.zutubi.pulse.master/etc" includes="logging/*.properties"/>
<fileset dir="com.zutubi.pulse.master/etc" includes="*.properties.template"/>
</copy>
<copy todir="${version.root.master}/lib">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.dll"/>
<fileset dir="com.zutubi.pulse.master/etc" includes="*.xml"/>
</copy>
<copy todir="${version.root.master}/boot">
<fileset dir="com.zutubi.pulse.core/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.dev/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.servercore/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.master/etc" includes="*.commands.properties"/>
<fileset dir="com.zutubi.pulse.master/etc" includes="classpath.txt"/>
</copy>
<replace dir="${package.root.master}/bin" replacefilterfile="com.zutubi.pulse.master/subst.properties">
<include name="**/*.in"/>
</replace>
<move todir="${package.root.master}/bin">
<fileset dir="${package.root.master}/bin"/>
<mapper type="glob" from="*.in" to="*"/>
</move>
<move todir="${package.root.master}/bin">
<fileset dir="${package.root.master}/bin">
<include name="**/PulseService*"/>
</fileset>
<filtermapper>
<replacestring from="PulseService" to="PulseServer"/>
</filtermapper>
</move>
<copy todir="${version.root.master}/system/packages">
<fileset dir="build">
<include name="pulse-agent-*"/>
<include name="pulse-dev-*"/>
<exclude name="*-src*"/>
</fileset>
</copy>
<!-- the ant zip command doesn't preserve permissions, so we call out to zip -->
<exec executable="zip" dir="${package.root.master}/..">
<arg line="-r ../${package.name.master}.zip ${package.name.master}"/>
</exec>
<tar destfile="build/${package.name.master}.tar.gz" compression="gzip">
<tarfileset dir="${package.root.master}/.." mode="755" username="root" group="root">
<include name="${package.name.master}/bin/*"/>
</tarfileset>
<tarfileset dir="${package.root.master}/.." username="root" group="root">
<include name="${package.name.master}/**/*"/>
<exclude name="${package.name.master}/bin/*"/>
</tarfileset>
</tar>
<antcall target="nsis.master"/>
</target>
<target name="test.jscomp" depends="init">
<mkdir dir="build"/>
<jsconcat outputFile="build/out.js" sourceDir="com.zutubi.pulse.master/src/www/js">
<include name="**/*.js"/>
</jsconcat>
<!--java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js-->
<java jar="etc/yuicompressor-2.4.2.jar" fork="true">
<arg value="--nomunge"/>
<arg value="-o"/>
<arg value="build/out-shrunk.js"/>
<arg value="build/out.js"/>
<classpath>
<pathelement location="etc/jargs-1.0.jar"/>
<pathelement location="etc/rhino-1.6R7.jar"/>
<pathelement location="etc/rhino-1.6R7.jar"/>
</classpath>
</java>
</target>
<target name="nsis.master" if="run.nsis">
<property name="package.name.master" value="pulse-${pulse.version}"/>
<property name="package.root.master" value="build/package/${package.name.master}"/>
<copy file="installer/env.nsh" todir="${package.root.master}"/>
<copy file="installer/pulse.ico" todir="${package.root.master}"/>
<copy file="installer/pulse.nsi.in" tofile="${package.root.master}/pulse.nsi"/>
<copy file="installer/findjava.exe" todir="${package.root.master}/bin"/>
<replace file="${package.root.master}/pulse.nsi" replacefilterfile="com.zutubi.pulse.master/subst.properties">
<replacefilter token="__PACKAGE_NAME__" value="${package.name.master}"/>
<replacefilter token="__VERSION__" value="${pulse.version}"/>
</replace>
<exec executable="makensis" dir="${package.root.master}">
<arg line="pulse.nsi"/>
</exec>
</target>
<target name="accept.master" depends="package.master, run.accept.master"/>
<target name="build.acceptance">
<subant inheritall="false" target="build.module">
<property name="skip.dependencies" value="true"/>
<fileset dir="com.zutubi.pulse.acceptance" includes="build.xml"/>
</subant>
</target>
<target name="run.accept.master" depends="build.acceptance, init">
<property name="build.dir" value="com.zutubi.pulse.acceptance/build"/>
<property name="report.dir" value="build/reports/junit"/>
<mkdir dir="${report.dir}/xml"/>
<mkdir dir="${report.dir}/html"/>
<javac source="7" target="7" srcdir="com.zutubi.pulse.master/src/java" destdir="${build.dir}/classes" includes="**/LicenseEncoder*" debug="true">
<classpath>
<fileset dir="${build.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
<condition property="extension" value="tar.gz" else="zip">
<os family="unix"/>
</condition>
<echo message="Startup services."/>
<exec executable="bash" spawn="true">
<arg line="scripts/setup-services.sh"/>
</exec>
<echo message="Start acceptance test suite."/>
<junit printsummary="yes" fork="on" forkmode="once" showoutput="true" outputtoformatters="false" maxmemory="512m"
failureProperty="test.failed" errorProperty="test.failed">
<sysproperty key="pulse.port" value="8889"/>
<sysproperty key="pulse.package" value="build/pulse-${pulse.version}.${extension}"/>
<sysproperty key="agent.package" value="build/pulse-agent-${pulse.version}.${extension}"/>
<sysproperty key="dev.package" value="build/pulse-dev-${pulse.version}.${extension}"/>
<sysproperty key="bootstrap" value="com/zutubi/pulse/bootstrap/bootstrapContext.xml"/>
<sysproperty key="work.dir" value="working"/>
<classpath>
<pathelement location="${build.dir}/classes"/>
<pathelement location="${build.dir}/test.classes"/>
<fileset dir="${build.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
<formatter type="xml"/>
<batchtest todir="${report.dir}/xml">
<fileset dir="com.zutubi.pulse.acceptance/src/test">
<include name="**/AcceptanceTestSuite.java"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${report.dir}">
<fileset dir=".">
<include name="*/${report.dir}/xml/*.xml"/>
<include name="${report.dir}/xml/*.xml"/>
</fileset>
<report format="frames" todir="${report.dir}/html"/>
</junitreport>
<echo message="Shutdown services."/>
<exec executable="bash">
<arg line="scripts/teardown-services.sh"/>
</exec>
<fail message="One or more acceptance tests failed. See the reports (${report.dir}) for details."
if="test.failed"/>
</target>
<target name="apidoc" depends="init">
<property name="apidir" value="build/docs/api"/>
<delete dir="${apidir}"/>
<javadoc destdir="${apidir}" useexternalfile="true">
<doclet path="etc/com.zutubi.xmlrpc.doclet-0.1.jar" name="com.zutubi.xmlrpc.doclet.XmlRpcDoclet"/>
<fileset dir="com.zutubi.pulse.master/src/java/com/zutubi/pulse/master/api">
<include name="*Api.java"/>
</fileset>
<!--<source file="com.zutubi.pulse.master/src/java/com/zutubi/pulse/master/api/RemoteApi.java"/>-->
<arg line="-quiet -s"/>
</javadoc>
</target>
<target name="javadoc" depends="init">
<property name="docdir" value="build/docs/javadoc"/>
<delete dir="${docdir}"/>
<javadoc destdir="${docdir}" useexternalfile="true">
<link href="http://java.sun.com/j2se/1.5/docs/api/"/>
<link href="http://java.sun.com/products/javamail/javadocs/"/>
<link href="http://www.cafeconleche.org/XOM/apidocs/"/>
<link href="http://www.jmock.org/javadoc/2.0.0/"/>
<!-- Just the top level i18n package to show Messages -->
<fileset dir="com.zutubi.i18n/src/java">
<include name="com/zutubi/i18n/*.java"/>
</fileset>
<!-- Top level plus the validators -->
<fileset dir="com.zutubi.validation/src/java">
<include name="com/zutubi/pulse/validation/*.java"/>
<include name="com/zutubi/pulse/validation/validators/*.java"/>
</fileset>
<fileset dir="com.zutubi.validation.annotations/src/java"/>
<!-- Tove has separate API packages -->
<fileset dir="com.zutubi.tove/src/java">
<include name="**/api/*.java"/>
</fileset>
<fileset dir="com.zutubi.tove.annotations/src/java"/>
<!-- Pick a handful of utils that are most useful and quite stable -->
<fileset dir="com.zutubi.util/src/java">
<include name="com/zutubi/util/Pair.java"/>
<include name="com/zutubi/util/StringUtils.java"/>
<include name="com/zutubi/util/WebUtils.java"/>
<include name="com/zutubi/util/io/*.java"/>
</fileset>
<!-- Pulse has API packages, but don't show some internal tests -->
<fileset dir="com.zutubi.pulse.core/src/java">
<include name="**/api/*.java"/>
</fileset>
<fileset dir="com.zutubi.pulse.core/src/test">
<include name="**/api/*.java"/>
<exclude name="**/scm/api/*.java"/>
<exclude name="**/util/api/*.java"/>
</fileset>
<!-- Pulse master APIs, but exclude remote api -->
<fileset dir="com.zutubi.pulse.master/src/java">
<include name="**/api/*.java"/>
<exclude name="**/master/api/*.java"/>
</fileset>
<fileset dir="com.zutubi.pulse.master/src/test">
<include name="com/zutubi/**/api/*.java"/>
<exclude name="**/master/api/*.java"/>
</fileset>
<classpath>
<fileset dir="com.zutubi.pulse.master/build/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javadoc>
</target>
<target name="idea" description="Runs build.idea.modules with -Dskip.tests=true">
<antcall target="build.idea.modules">
<param name="skip.tests" value="true"/>
</antcall>
</target>
<target name="build.idea.modules" depends="buildlist"
description="Adds modules to an IDEA project file (pulse.ipr) for all Pulse modules and plugins.">
<!-- copy the template idea project files into the project directory if they dont already exist. -->
<available file="pulse.ipr" property="pulse.ipr.available"/>
<if>
<not><isset property="pulse.ipr.available"/></not>
<then>
<copy todir="${project.root.dir}" overwrite="true">
<fileset dir="etc">
<include name="pulse.ipr"/>
</fileset>
</copy>
</then>
</if>
<available file="pulse.iws" property="pulse.iws.available"/>
<if>
<not><isset property="pulse.iws.available"/></not>
<then>
<copy todir="${project.root.dir}" overwrite="true">
<fileset dir="etc">
<include name="pulse.iws"/>
</fileset>
</copy>
</then>
</if>
<zutubi:ivytoidea conf="build, src" testConf="test" projectFile="pulse.ipr" propertiesFile="build.properties">
<fileset dir="${project.root.dir}/">
<include name="*/ivy.xml"/>
<include name="bundles/*/ivy.xml"/>
</fileset>
</zutubi:ivytoidea>
</target>
<target name="clean.plugins" depends="init"
description="Removes all traces of plugins from your dev environment.">
<delete dir="plugins"/>
</target>
<target name="clean.agent.plugins" depends="init"
description="Removes all agent plugins, and cached plugins for agent syncing.">
<delete dir="plugins/agent"/>
<delete dir="com.zutubi.pulse.master/system/tmp" includes="*.jar"/>
</target>
<target name="refresh.plugins" description="Removes current plugins, reloads the jars for internal plugins and explodes third party dependencies of plugins.">
<antcall target="build.refresh.plugins">
<param name="skip.tests" value="true"/>
</antcall>
</target>
<target name="build.refresh.plugins" depends="clean.plugins,buildlist">
<property file="ivy.properties"/>
<ivy:settings/>
<retrieve-dependencies ivyfile="package/core/ivy.xml" conf="equinox-bundles" dest="plugins/internal"/>
<subant inheritall="false" target="extract.prepackaged" buildpathref="build.path"/>
<echo message=""/>
<echo message="IMPORTANT: The plugin modules must now be compiled in your IDE before the plugins can be used."/>
<echo message=""/>
</target>
<target name="setup.dev" depends="idea,refresh.plugins"
description="Sets up a dev environment from a clean checkout."/>
<target name="source.package" depends="init, clean">
<property name="package.name" value="pulse-${pulse.version}-src"/>
<mkdir dir="build/${package.name}"/>
<copy todir="build/${package.name}">
<fileset dir="${project.root.dir}">
<include name="**/*"/>
<exclude name="build/**"/>
<exclude name="classes/**"/>
<exclude name="etc/*.src"/>
<exclude name="plugins/**"/>
<exclude name="**/LicenseEncoder.java"/>
<exclude name="**/LicenseEncodeDecodeTest.java"/>
<exclude name="**/LicenseKeyValidatorTest.java"/>
<exclude name="**/.svn"/>
<!-- exclude intellij project files -->
<exclude name="**/*.ipr"/>
<exclude name="**/*.iws"/>
<exclude name="**/*.iml"/>
<!-- other excludes that are useful when generating source package from an existing workspace. -->
<exclude name="**/*.*~"/>
<exclude name="velocity.log"/>
<exclude name="local.properties"/>
</fileset>
<fileset dir="${project.root.dir}">
<include name="etc/pulse.ipr"/>
<include name="etc/pulse.iws"/>
</fileset>
</copy>
<copy todir="build/${package.name}">
<mapper type="glob" from="*.src" to="*"/>
<fileset dir="${project.root.dir}/etc" includes="*.src"/>
</copy>
<copyright src="build/${package.name}" value="${copyright.statement}">
<include name="**/*.java"/>
</copyright>
<native-zip dir="${project.root.dir}/build" file="${package.name}.zip" path="${package.name}"/>
</target>
<macrodef name="set-package-deps">
<attribute name="module"/>
<sequential>
<ivy:buildlist reference="build.path.@{module}" root="com.zutubi.pulse.@{module}-package" ivyfilepath="ivy.xml" excluderoot="true" onMissingDescriptor="skip">
<fileset dir="${project.root.dir}/">
<include name="*/build.xml"/>
<include name="bundles/*/build.xml"/>
<include name="package/*/build.xml"/>
</fileset>
</ivy:buildlist>
</sequential>
</macrodef>
<macrodef name="build-package-deps">
<attribute name="module"/>
<sequential>
<set-package-deps module="@{module}"/>
<subant inheritAll="false" target="build.module" buildpathref="build.path.@{module}">
<property name="skip.dependencies" value="true"/>
</subant>
</sequential>
</macrodef>
<macrodef name="retrieve-package-deps">
<attribute name="module"/>
<attribute name="dest"/>
<sequential>
<retrieve-dependencies ivyfile="package/@{module}/ivy.xml" conf="release" dest="@{dest}/lib"/>
<retrieve-dependencies ivyfile="package/@{module}/ivy.xml" conf="internal-bundles" dest="@{dest}/system/plugins/internal"/>
<retrieve-dependencies ivyfile="package/@{module}/ivy.xml" conf="prepackaged-bundles" dest="@{dest}/system/plugins/prepackaged"/>
<copy todir="@{dest}/system/plugins/config">
<fileset dir="com.zutubi.pulse.master/etc/osgi" includes="config.ini"/>
</copy>
<move tofile="@{dest}/../../lib/boot.jar">
<fileset dir="@{dest}/lib" includes="boot-*.jar"/>
</move>
</sequential>
</macrodef>
<macrodef name="retrieve-package-src-deps">
<attribute name="module"/>
<attribute name="dest"/>
<sequential>
<retrieve-dependencies ivyfile="package/@{module}/ivy.xml" conf="src" dest="@{dest}"/>
</sequential>
</macrodef>
<macrodef name="native-zip">
<attribute name="dir"/>
<attribute name="file"/>
<attribute name="path"/>
<sequential>
<exec executable="zip" dir="@{dir}">
<arg line="-r @{file} @{path}"/>
</exec>
</sequential>
</macrodef>
</project>