-
Notifications
You must be signed in to change notification settings - Fork 278
Expand file tree
/
Copy pathbuild.xml
More file actions
1030 lines (920 loc) · 41.8 KB
/
build.xml
File metadata and controls
1030 lines (920 loc) · 41.8 KB
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
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0"?>
<!-- ============================================================
Restlet Framework build script - Copyright 2005-2014 Restlet
============================================================ -->
<project name="Restlet Framework - @edition@" default="rebuild">
<!-- ============================ -->
<!-- === Properties setting === -->
<!-- ============================ -->
<!-- Load system specific properties -->
<property file="custom.properties" />
<!-- Load default properties -->
<property file="build.properties" />
<!-- Library properties -->
<property file="libraries.properties" />
<!-- Module properties -->
<property file="modules.properties" />
<!-- Edition properties -->
<property file="edition.properties" />
<!-- General properties -->
<property name="author" value="Jerome Louvel" />
<property name="vendor" value="Restlet" />
<property name="excludes" value="**/.emptyDir **/package.html **/overview.html" />
<!-- Location properties -->
<property name="tools" location="../../tools" />
<property name="bin" location="../../bin" />
<property name="tmpl" location="../../tmpl" />
<property name="build-dir" location="../../../build" />
<property name="libs" location="../../../libraries" />
<property name="mods" location="../../../modules" />
<property name="temp" location="${basedir}/temp" />
<property name="temp-base" location="../../temp" />
<property name="dist-base" location="dist" />
<property name="final-dist-base" location="../../dist" />
<property name="images" location="../../images" />
<property name="pom-mods" location="modules" />
<property name="mod" location="modules" />
<property name="lib" location="libraries" />
<property name="poms" location="poms" />
<!-- Version properties -->
<loadproperties srcFile="${tmpl}/config/version.${meta.release-type}.properties">
<filterchain>
<expandproperties/>
</filterchain>
</loadproperties>
<!-- Miscellaneous Maven properties -->
<property name="mod-maven-groupId" value="org.restlet.${edition}" />
<property name="parent-maven-groupId" value="org.restlet.${edition}" />
<property name="parent-maven-artifactId" value="org.restlet.parent" />
<property name="parent-maven-version" value="${version-maven}" />
<property name="dist-path" value="restlet-${edition}-${version-compact}" />
<property name="final-dist-path" value="restlet-${version-compact}" />
<property name="jdk1.4-home" value="jdk1.4-home" />
<property name="dist-classic" location="${dist-base}/classic/${dist-path}" />
<property name="dist-eclipse" location="${dist-base}/eclipse/${dist-path}" />
<property name="dist-maven2" location="${dist-base}/maven2/${dist-path}" />
<property name="dist-p2" location="${dist-base}/p2/${dist-path}" />
<property name="classes" location="${temp}/classes" />
<property name="docs" location="${temp}/docs" />
<property name="docs-api" location="${docs}/api" />
<property name="docs-engine" location="${docs}/engine" />
<property name="docs-ext" location="${docs}/ext" />
<property name="uml-reports" location="${temp}/uml-reports" />
<property name="uml-reports-api" location="${uml-reports}/api" />
<property name="icons" location="${images}/ico" />
<property name="final-dist-classic" location="${final-dist-base}/classic/${final-dist-path}/${edition}" />
<property name="final-dist-eclipse" location="${final-dist-base}/eclipse/${final-dist-path}/${edition}" />
<property name="final-dist-maven2" location="${final-dist-base}/maven2/${final-dist-path}" />
<property name="final-dist-p2" location="${final-dist-base}/p2/${final-dist-path}" />
<!-- Create the time stamp -->
<tstamp>
<format property="release-date" pattern="MM/dd/yyyy" />
</tstamp>
<!-- Current year -->
<tstamp>
<format property="current-year" pattern="yyyy" />
</tstamp>
<!-- Used for all string replacement operations -->
<echo file="filterset.properties">
version-full: ${version-full}
version-compact: ${version-compact}
version-minor: ${version-minor}
release-date: ${release-date}
icons-dir: ${icons}
images-dir: ${images}
license-dir: ${dist-classic}
dist: ${dist-classic}
dist-base: ${dist-base}
edition: ${edition}
edition-full-label: ${edition-full-label}
edition-medium-label: ${edition-medium-label}
edition-short-label: ${edition-short-label}
parent-group-id: ${parent-maven-groupId}
parent-artifact-id: ${parent-maven-artifactId}
parent-version: ${parent-maven-version}
group-id: ${mod-maven-groupId}
</echo>
<condition property="ant-old">
<not>
<or>
<contains string="${ant.version}" substring="version 1.8" />
<contains string="${ant.version}" substring="version 1.9" />
</or>
</not>
</condition>
<!-- Set the property that will enable the Javadoc target -->
<condition property="do-javadoc">
<istrue value="${javadoc}" />
</condition>
<!-- Set the property that will enable the FindBugs target -->
<condition property="do-findbugs">
<and>
<istrue value="${findbugs}" />
<istrue value="${verify}" />
</and>
</condition>
<!-- Set the property that will enable the CheckStyle target -->
<condition property="do-checkstyle">
<and>
<istrue value="${checkstyle}" />
<istrue value="${verify}" />
</and>
</condition>
<!-- Set the property that will enable the Nsis target -->
<condition property="do-nsis">
<and>
<istrue value="${nsis}" />
<istrue value="${package}" />
</and>
</condition>
<!-- Set the property that will enable the stage-maven target -->
<condition property="do-maven">
<istrue value="${maven}" />
</condition>
<!-- Set the property that will enable the verify target -->
<condition property="do-verify">
<and>
<istrue value="${verify}" />
<isset property="mod-core-test-id" />
</and>
</condition>
<!-- Set the property that will enable the package target -->
<condition property="do-package">
<istrue value="${package}" />
</condition>
<!-- Set the property that indicates that the edition uses bundles for OSGi and PDE eclipse plugin -->
<condition property="do-eclipse-pde">
<and>
<istrue value="${eclipse-pde}" />
<isset property="modules-p2" />
<isset property="libraries-p2" />
</and>
</condition>
<!-- Set the property that will enable the stage-p2 target -->
<condition property="do-p2">
<and>
<istrue value="${p2}" />
<istrue value="${do-eclipse-pde}" />
</and>
</condition>
<!-- Set the property that will enable the package target -->
<condition property="do-package-p2">
<and>
<istrue value="${do-p2}" />
<istrue value="${package}" />
</and>
</condition>
<!-- Set the property that will enable the package target -->
<condition property="do-package-maven">
<and>
<istrue value="${do-maven}" />
<istrue value="${package}" />
</and>
</condition>
<!-- Set the property that will enable the generation of the Javadoc of implementation classes -->
<condition property="exclude-packages" value="">
<isfalse value="${javadoc-hide}" />
</condition>
<condition property="exclude-packages" value="**.internal.*">
<istrue value="${javadoc-hide}" />
</condition>
<!-- Set the debug level property -->
<condition property="debuglevel" value="source,lines,vars">
<and>
<istrue value="${debug-source}" />
<istrue value="${debug-lines}" />
<istrue value="${debug-vars}" />
</and>
</condition>
<condition property="debuglevel" value="source,lines">
<and>
<istrue value="${debug-source}" />
<istrue value="${debug-lines}" />
<isfalse value="${debug-vars}" />
</and>
</condition>
<condition property="debuglevel" value="source,vars">
<and>
<istrue value="${debug-source}" />
<isfalse value="${debug-lines}" />
<istrue value="${debug-vars}" />
</and>
</condition>
<condition property="debuglevel" value="lines,vars">
<and>
<isfalse value="${debug-source}" />
<istrue value="${debug-lines}" />
<istrue value="${debug-vars}" />
</and>
</condition>
<condition property="debuglevel" value="lines">
<and>
<isfalse value="${debug-source}" />
<istrue value="${debug-lines}" />
<isfalse value="${debug-vars}" />
</and>
</condition>
<condition property="debuglevel" value="vars">
<and>
<isfalse value="${debug-source}" />
<isfalse value="${debug-lines}" />
<istrue value="${debug-vars}" />
</and>
</condition>
<condition property="bundle.libraries.optional.dependencies" value="true">
<and>
<istrue value="${do-eclipse-pde}" />
<istrue value="${eclipse-pde-optional-dependencies}" />
</and>
</condition>
<!-- ======================= -->
<!-- === Paths setting === -->
<!-- ======================= -->
<!-- Include the definition of paths regarding edition modules -->
<!-- @paths@ -->
<path id="path-none" />
<path id="forge-path">
<fileset dir="${tools}/forge" includes="**/*.jar" />
</path>
<path id="bnd-path">
<fileset dir="${tools}/bnd" includes="**/*.jar" />
</path>
<!-- =================== -->
<!-- === Ant Tasks === -->
<!-- =================== -->
<!-- Findbugs -->
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
<classpath>
<pathelement location="${tools}/findbugs/lib/findbugs-ant.jar" />
</classpath>
</taskdef>
<!-- Checkstyle -->
<taskdef resource="checkstyletask.properties">
<classpath>
<pathelement location="${tools}/checkstyle/checkstyle-all-4.2.jar" />
</classpath>
</taskdef>
<!-- NSIS 1.3 -->
<taskdef name="nsis" classname="net.sf.nsisant.Task">
<classpath>
<pathelement location="${tools}/nsis/nsisant-1.3.custom.jar" />
</classpath>
</taskdef>
<!-- Ant Contrib -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<fileset dir="${tools}/ant-contrib" includes="**/*.jar" />
</classpath>
</taskdef>
<!-- FMPP (FreeMarker-based text file PreProcessor) -->
<taskdef name="fmpp" classname="fmpp.tools.AntTask">
<classpath>
<fileset dir="${tools}/fmpp" includes="**/*.jar" />
<fileset dir="${tools}/forge" includes="**/*.jar" />
</classpath>
</taskdef>
<!-- Gae Code checker -->
<taskdef name="gaeCodeChecker" classname="checker.GaeCodeChecker">
<classpath>
<fileset dir="${tools}/forge" includes="**/*.jar" />
</classpath>
</taskdef>
<!-- BND (handling of OSGI bundles) -->
<taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="bnd-path" />
<!-- ==================== -->
<!-- === Ant Macros === -->
<!-- ==================== -->
<!-- Compile using preferences -->
<macrodef name="compile">
<attribute name="source" default="${jdk.compilation.version}" />
<attribute name="target" default="${jdk.compilation.version}" />
<attribute name="debug" default="${debug}" />
<attribute name="debuglevel" default="${debuglevel}" />
<attribute name="optimize" default="${optimize}" />
<attribute name="srcdir" />
<attribute name="destdir" />
<attribute name="classpathref" default="path-none" />
<attribute name="includes" default="*/**" />
<attribute name="excludes" default="" />
<attribute name="verbose" default="${verbose}" />
<sequential>
<mkdir dir="@{destdir}" />
<javac target="@{target}" source="@{source}" debug="@{debug}" deprecation="false" encoding="UTF-8" debuglevel="@{debuglevel}" optimize="@{optimize}" verbose="@{verbose}" srcdir="@{srcdir}" destdir="@{destdir}" includes="@{includes}" excludes="@{excludes}" bootclasspath="${custombootclasspath}" includeantruntime="false">
<classpath refid="@{classpathref}" />
</javac>
</sequential>
</macrodef>
<macrodef name="gwtCompileModule">
<attribute name="name" />
<attribute name="module" />
<sequential>
<java classname="com.google.gwt.dev.Compiler" fork="true" failonerror="true">
<classpath>
<path refid="mod-@{name}-path">
</path>
<pathelement path="${mod}/${mod-@{name}-id}/src" />
</classpath>
<arg value="-validateOnly" />
<arg value="-strict" />
<arg value="@{module}" />
</java>
</sequential>
</macrodef>
<!-- Compile a module -->
<macrodef name="compileModule">
<attribute name="name" />
<sequential>
<compile srcdir="${mod}/${mod-@{name}-id}/src" destdir="${classes}/${mod-@{name}-id}" classpathref="mod-@{name}-path" excludes="${mod-@{name}-compile-excludes}" />
</sequential>
</macrodef>
<!-- Find bugs in a module -->
<macrodef name="findbugsModule">
<attribute name="name" />
<sequential>
<findbugs debug="false" home="${tools}/findbugs" output="html" outputFile="${temp}/findbugs/${mod-@{name}-id}-fb.html">
<auxClasspath refid="mod-@{name}-path" />
<sourcePath path="${mod}/${mod-@{name}-id}/src" />
<class location="${classes}/${mod-@{name}-id}" />
</findbugs>
</sequential>
</macrodef>
<!-- Check style of a module -->
<macrodef name="checkstyleModule">
<attribute name="name" />
<sequential>
<checkstyle config="checks.xml" failOnViolation="false">
<fileset dir="${mod}/${mod-@{name}-id}/src" includes="**/*.java" />
<!-- Location of cache-file. Something that is project specific -->
<property key="checkstyle.cache.file" file="${temp}/checkstyle/cachefile" />
<formatter type="xml" tofile="${temp}/checkstyle/${mod-@{name}-id}-cs.xml" />
</checkstyle>
<xslt in="${temp}/checkstyle/${mod-@{name}-id}-cs.xml" out="${temp}/checkstyle/${mod-@{name}-id}-cs.html" style="checks.xsl" />
</sequential>
</macrodef>
<!-- Package a library -->
<macrodef name="stageLibrary">
<!-- Package a library -->
<attribute name="name" />
<sequential>
<!-- Create a destination directory -->
<mkdir dir="${dist-classic}/lib/${lib-@{name}-root}" />
<!-- Copy all library content into the destination folder -->
<copy todir="${dist-classic}/lib/${lib-@{name}-root}">
<fileset dir="${libs}/${lib-@{name}-root}" excludes="bin, .classpath, .project, build.properties" />
</copy>
</sequential>
</macrodef>
<!-- Generate a manifest.mf file for a module -->
<macrodef name="generateModuleManifest">
<attribute name="name" description="name of the module" />
<attribute name="dir" description="The path of the directory where to generate the META-INF/MANIFEST.MF file" />
<attribute name="source" default="false" description="'true' to just declare the list of required bundles in the manifest file using the 'Require-Bundle' attribute - fine for development. 'false' to generate a manifest file without the 'Require-Bundle' attribute " />
<sequential>
<!-- Create the Manifest -->
<mkdir dir="@{dir}/META-INF" />
<delete failonerror="false" file="@{dir}/META-INF/MANIFEST.MF" />
<manifest file="@{dir}/META-INF/MANIFEST.MF">
<attribute id="Bundle-SymbolicName" name="Bundle-SymbolicName" value="${mod-@{name}-id}" />
<attribute id="Bundle-Version" name="Bundle-Version" value="${eclipse-version-full}" />
<attribute id="Bundle-Vendor" name="Bundle-Vendor" value="${vendor}" />
<attribute id="Bundle-RequiredExecutionEnvironment" name="Bundle-RequiredExecutionEnvironment" value="${bundle.required-execution-environment}" />
<section name="${mod-@{name}-id}">
<attribute name="Implementation-Title" value="${mod-@{name}-id}" />
<attribute name="Implementation-Version" value="${version-full} (build ${build.number})" />
<attribute name="Implementation-Vendor" value="${vendor}" />
</section>
</manifest>
<if>
<isset property="mod-@{name}-activator" />
<then>
<manifest file="@{dir}/META-INF/MANIFEST.MF" mode="update">
<attribute id="Bundle-Activator" name="Bundle-Activator" value="${mod-@{name}-activator}" />
</manifest>
</then>
</if>
<if>
<isset property="mod-@{name}-ds" />
<then>
<manifest file="@{dir}/META-INF/MANIFEST.MF" mode="update">
<attribute id="Service-Component" name="Service-Component" value="${mod-@{name}-ds}" />
</manifest>
</then>
</if>
<condition property="include-@{name}-pattern" value="org/restlet/test/**">
<equals arg1="@{name}" arg2="core-test" />
</condition>
<condition property="include-@{name}-pattern" value="org/restlet/**">
<equals arg1="@{name}" arg2="core" />
</condition>
<property name="include-@{name}-pattern" value="org/restlet/ext/@{name}/**" />
<dirset id="mod-@{name}-exported-packages" dir="${mod}/${mod-@{name}-id}/src">
<include name="${include-@{name}-pattern}" />
<!-- <exclude name="**/internal/**" /> -->
</dirset>
<pathconvert pathsep="," dirsep="." property="mod-@{name}-export-package" refid="mod-@{name}-exported-packages">
<map from="${mod}/${mod-@{name}-id}/src/" to='' />
</pathconvert>
<manifest file="@{dir}/META-INF/MANIFEST.MF" mode="update">
<attribute id="Export-Package" name="Export-Package" value="${mod-@{name}-export-package}" />
</manifest>
<if>
<equals arg1="@{source}" arg2="true" />
<then>
<manifest file="@{dir}/META-INF/MANIFEST.MF" mode="update">
<attribute id="Require-Bundle" name="Require-Bundle" value="${mod-@{name}-require-bundle}" />
</manifest>
</then>
</if>
</sequential>
</macrodef>
<!-- Package a module -->
<macrodef name="stageModule">
<attribute name="name" />
<attribute name="includeSource" default="false" />
<sequential>
<mkdir dir="${temp}/jar-extras/@{name}" />
<if>
<istrue value="${do-p2}" />
<then>
<pathconvert property="mod-@{name}-ds" dirsep="/" pathsep="," setonempty="false">
<map from="${mod}/${mod-@{name}-id}/" to=""/>
<fileset dir="${mod}/${mod-@{name}-id}/" includes="OSGI-INF/**" />
</pathconvert>
<generateModuleManifest name="@{name}" dir="${temp}/jar-extras/@{name}"/>
</then>
</if>
<copy todir="${temp}/jar-extras/@{name}" failonerror="false">
<fileset dir="${mod}/${mod-@{name}-id}/" includes="OSGI-INF/**" />
</copy>
<!-- Create plugin jar -->
<mkdir dir="${dist-classic}/lib" />
<condition property="source-exclude-patterns-@{name}" value="**/package.html, **/*.java">
<equals arg1="@{includeSource}" arg2="false" />
</condition>
<property name="source-exclude-patterns-@{name}" value="**/package.html" />
<delete failonerror="false" file="${dist-classic}/lib/${mod-@{name}-id}.jar" />
<jar destfile="${dist-classic}/lib/${mod-@{name}-id}.jar" filesetmanifest="merge">
<fileset dir="${classes}/${mod-@{name}-id}" />
<fileset dir="${temp}/jar-extras/@{name}" />
<fileset dir="${mod}/${mod-@{name}-id}/src" excludes="${source-exclude-patterns-@{name}}" />
</jar>
<!-- Update the manifest file -->
<if>
<istrue value="${do-p2}" />
<then>
<bndwrap jars="${dist-classic}/lib/${mod-@{name}-id}.jar" output="${dist-classic}/lib/${mod-@{name}-id}.jar" />
</then>
</if>
<!-- Create extension source jar file -->
<mkdir dir="${dist-classic}/src" />
<copy todir="${dist-classic}/src/${mod-@{name}-id}">
<fileset dir="${mod}/${mod-@{name}-id}/src" excludes="${excludes}" />
</copy>
</sequential>
</macrodef>
<!-- Generate the Maven 2.x files for a hosted library -->
<macrodef name="maven2Library">
<attribute name="name" />
<sequential>
<propertyregex property="lib-dir-@{name}-maven-groupId" input="${lib-@{name}-maven-groupId}" regexp="\." replace="/" global="true" casesensitive="false" />
<property name="lib-dir-@{name}-maven" value="${dist-maven2}/${lib-dir-@{name}-maven-groupId}/${lib-@{name}-maven-artifactId}/${lib-@{name}-maven-version}" />
<mkdir dir="${lib-dir-@{name}-maven}" />
<copy file="${libs}/${lib-@{name}-root}/${lib-@{name}-package}.jar" tofile="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.jar" overwrite="true" />
<copy file="${poms}/${lib-@{name}-package}.pom" tofile="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.pom" overwrite="true" />
<checksum file="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.jar" algorithm="MD5" fileext=".md5" />
<checksum file="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.jar" algorithm="SHA" fileext=".sha1" />
<checksum file="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.pom" algorithm="MD5" fileext=".md5" />
<checksum file="${lib-dir-@{name}-maven}/${lib-@{name}-maven-artifactId}-${lib-@{name}-maven-version}.pom" algorithm="SHA" fileext=".sha1" />
</sequential>
</macrodef>
<macrodef name="maven2Module">
<attribute name="name" />
<sequential>
<propertyregex property="mod-dir-maven-groupId" input="${mod-maven-groupId}" regexp="\." replace="/" global="true" casesensitive="false" />
<!-- All files generated from the modules are stamped with the current full version number -->
<property name="mod-dir-@{name}-maven" value="${dist-maven2}/${mod-dir-maven-groupId}/${mod-@{name}-id}/${version-maven}" />
<mkdir dir="${mod-dir-@{name}-maven}" />
<copy file="${dist-classic}/lib/${mod-@{name}-id}.jar" tofile="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.jar" overwrite="true" />
<jar destfile="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}-sources.jar" filesetmanifest="merge">
<fileset dir="${mod}/${mod-@{name}-id}/src" includes="**/*" />
</jar>
<!-- @generate-mavenjavadocs@ -->
<copy file="${poms}/${mod-@{name}-id}.pom" tofile="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.pom" overwrite="true" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.jar" algorithm="MD5" fileext=".md5" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.jar" algorithm="SHA" fileext=".sha1" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}-sources.jar" algorithm="MD5" fileext=".md5" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}-sources.jar" algorithm="SHA" fileext=".sha1" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.pom" algorithm="MD5" fileext=".md5" />
<checksum file="${mod-dir-@{name}-maven}/${mod-@{name}-id}-${version-maven}.pom" algorithm="SHA" fileext=".sha1" />
</sequential>
</macrodef>
<macrodef name="p22Module">
<attribute name="name" />
<sequential>
<!-- Generation of bundle and feature. -->
<copy file="${dist-classic}/lib/${mod-@{name}-id}.jar" tofile="${dist-p2}/plugins/${mod-@{name}-id}_${eclipse-version-full}.jar" />
<copy file="${temp}/p2/feature.@{name}.xml" tofile="${dist-p2}/features/feature.xml" />
<zip destfile="${dist-p2}/features/${mod-@{name}-id}_${eclipse-version-full}.jar" basedir="${dist-p2}/features" includes="feature.xml" update="false" />
<delete file="${dist-p2}/features/feature.xml" />
<!-- Generation of source bundle. -->
<delete dir="${temp}/@{name}" />
<mkdir dir="${temp}/@{name}" />
<copy todir="${temp}/@{name}" overwrite="true">
<fileset dir="${mod}/${mod-@{name}-id}/src" />
</copy>
<mkdir dir="${temp}/@{name}/META-INF" />
<manifest file="${temp}/@{name}/META-INF/MANIFEST.MF" mode="replace">
<attribute id="Eclipse-SourceBundle" name="Eclipse-SourceBundle" value="${mod-@{name}-id};version=${eclipse-version-full}" />
<attribute id="Bundle-SymbolicName" name="Bundle-SymbolicName" value="${mod-@{name}-id}.source" />
<attribute id="Bundle-Version" name="Bundle-Version" value="${eclipse-version-full}" />
</manifest>
<zip destfile="${dist-p2}/plugins/${mod-@{name}-id}.source_${eclipse-version-full}.jar" basedir="${temp}/@{name}" update="false" />
<delete dir="${temp}/@{name}" />
</sequential>
</macrodef>
<macrodef name="p22Library">
<attribute name="name" />
<sequential>
<copy todir="${dist-p2}/plugins" overwrite="true">
<fileset dir="${libs}/${lib-@{name}-root}" />
<mapper type="glob" from="*.jar" to="*_${eclipse-version-full}.jar" />
</copy>
</sequential>
</macrodef>
<!-- ===================== -->
<!-- === Ant Targets === -->
<!-- ===================== -->
<!-- GENERAL targets -->
<target name="build" depends="generate, verify, integrate, stage, package" description="Full build." />
<target name="rebuild" depends="clean, generate, verify, integrate, stage, package" description="Full build from scratch." />
<!-- CLEAN target -->
<target name="clean" description="Clean the staging area.">
<delete includeEmptyDirs="true" verbose="false" quiet="false" failonerror="false">
<fileset dir="${dist-base}">
<include name="*/${dist-path}/**/*" />
<include name="*/${dist-path}" />
</fileset>
</delete>
<!-- Delete the classes and Javadoc directories, etc -->
<delete includeEmptyDirs="true" verbose="false" quiet="false" failonerror="false">
<fileset dir="${temp}" />
</delete>
</target>
<!-- GENERATE target -->
<target name="generate" depends="generate-classes, generate-templates, generate-javadocs" description="Generate files." />
<target name="generate-sources" description="Generate the sources.">
<!-- @generate-sources@ -->
<!-- Generate libraries -->
<if>
<istrue value="${do-eclipse-pde}" />
<then>
<copy todir="${lib}" overwrite="true" includeEmptyDirs="false">
<fileset dir="${libs}" />
</copy>
<antcall target="generate-modules-eclipse-artifacts" inheritall="true" />
<antcall target="generate-libraries-eclipse-artifacts" inheritall="true" />
</then>
</if>
</target>
<target name="generate-templates" description="Generate template-based files.">
<!-- Generate the Changes file -->
<copy file="${tmpl}/text/changes.txt" todir="${docs}" overwrite="true">
<filterset begintoken="@" endtoken="@" filtersfile="filterset.properties" />
</copy>
<!-- Generate the NSIS files -->
<copy file="${tmpl}/nsis/common.nsh" todir="${temp}" overwrite="true" />
<copy file="${tmpl}/nsis/setup.nsi" todir="${temp}" overwrite="true">
<filterset begintoken="@" endtoken="@" filtersfile="filterset.properties" />
</copy>
</target>
<target name="generate-libraries-eclipse-artifacts" if="do-eclipse-pde" description="Generates the manifest.mf files for the libraries">
<!-- Generate eclipse .classpath, .project, .properties files -->
<echo message="Generate eclipse .classpath, .project, .properties files" />
<fmpp sourceroot="${tmpl}/eclipse" outputroot="${lib}" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
ant: antProperties()
</data>
<include name="library.classpath.tmpl" />
<include name="library.project.tmpl" />
<include name="library.build.properties.tmpl" />
</fmpp>
<delete file="${lib}/library.classpath.tmpl" />
<delete file="${lib}/library.project.tmpl" />
<delete file="${lib}/library.build.properties.tmpl" />
<!-- Generate bnd definition files -->
<echo message="Generate bnd definition files" />
<copy file="${tmpl}/bundles/bndbis.bnd" todir="${temp}/definitions/libs" />
<fmpp sourceroot="${tmpl}/bundles" outputroot="${temp}/definitions/libs" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
ant: antProperties()
</data>
<include name="bndLibrary.tmpl" />
</fmpp>
<delete file="${temp}/definitions/libs/bndLibrary.tmpl" />
<fmpp sourceroot="${tmpl}/bundles" outputroot="${temp}/definitions/libs" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
ant: antProperties()
</data>
<include name="bndGlobalLibrary.tmpl" />
</fmpp>
<delete file="${temp}/definitions/libs/bndGlobalLibrary.tmpl" />
<!-- Generate ant manifest generation script -->
<echo message="Generate ant manifest generation script" />
<fmpp sourcefile="${tmpl}/bundles/extractmanifestLibrary.tmpl" outputfile="${lib}/extractmanifestLibrary.xml" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
ant: antProperties()
</data>
</fmpp>
<ant antfile="${lib}/extractmanifestLibrary.xml" dir="${lib}" inheritAll="true" />
<delete file="${lib}/extractmanifestLibrary.tmpl" />
</target>
<target name="generate-modules-eclipse-artifacts" if="do-eclipse-pde" description="Generates the manifest.mf files for the unique source code">
<!-- Generate the P2 feature files. -->
<echo message="Generate the P2 feature files" />
<fmpp sourceroot="${tmpl}/eclipse" outputroot="${temp}/p2" dataroot="${build-dir}">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
editions: get(values, "editions")
editionKey: ${edition}
edition: get(editions, ${edition})
currentYear: ${current-year}
ant: antProperties()
</data>
<include name="feature.tmpl" />
</fmpp>
<!-- Generate eclipse .classpath, .project, .properties files -->
<echo message="Generate eclipse .classpath, .project, .properties files" />
<fmpp sourceroot="${tmpl}/eclipse" outputroot="${mod}" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
editions: get(values, "editions")
edition: get(editions, ${edition})
ant: antProperties()
</data>
<include name="module.classpath.tmpl" />
<include name="module.project.tmpl" />
<include name="module.build.properties.tmpl" />
</fmpp>
<delete file="${mod}/module.classpath.tmpl" />
<delete file="${temp}/module.project.tmpl" />
<delete file="${temp}/module.build.properties.tmpl" />
<!-- Generate bnd definition files -->
<echo message="Generate bnd definition files" />
<fmpp sourceroot="${tmpl}/bundles" outputroot="${temp}/definitions/modules" dataroot="${build-dir}" expert="true">
<data expandproperties="true">
values: dataLoader.ForgeLoader("project.xml", "../modules", "../libraries")
project: get(values, "project")
ant: antProperties()
</data>
<include name="bndModule.tmpl" />
</fmpp>
<delete file="${temp}/definitions/modules/bndModule.tmpl" />
</target>
<!-- COMPILE target -->
<target name="generate-classes" description="Compile the Java source files.">
<mkdir dir="${classes}" />
<for param="module" delimiter=" " list="${modules-sorted-by-dep}">
<sequential>
<compileModule name="@{module}" />
<!-- @generate-classes-extras@ -->
</sequential>
</for>
</target>
<target name="generate-javadocs" if="do-javadoc" depends="generate-classes" description="Generate the Javadocs.">
<!-- Generate the javadocs overview files -->
<copy todir="${temp}/javadocs-overviews" overwrite="true">
<fileset dir="${tmpl}/javadocs" includes="*.tmpl" />
<globmapper from="*.tmpl" to="*.html" />
<filterset begintoken="@" endtoken="@" filtersfile="filterset.properties" />
</copy>
<!-- @generate-javadocs@ -->
</target>
<!-- umlgraph target -->
<target name="umlgraph">
<!-- Generate UML graphics for the Restlet API -->
<javadoc packagenames="org.restlet.*" excludepackagenames="${exclude-packages}" destdir="${uml-reports-api}" classpathref="path-all" author="true" version="true" use="true" windowtitle="Restlet API ${version-full}" doctitle="Restlet API ${version-full}" overview="${temp}/javadocs/overview-api.html" stylesheetfile="${tmpl}/javadocs/stylesheet.css" verbose="${verbose}">
<sourcepath>
<pathelement path="${mod}/${mod-core-id}/src/" />
</sourcepath>
<bottom>Copyright 2005-2014 Restlet</bottom>
<group title="Restlet API">
<package name="org.restlet*" />
</group>
<link href="http://download.oracle.com/javase/1.5.0/docs/api/" />
<doclet name="org.umlgraph.doclet.UmlGraphDoc" path="${tools}/umlgraph/umlgraph.jar">
<param name="-attributes" />
<param name="-operations" />
<param name="-qualify" />
<param name="-types" />
<param name="-visibility" />
</doclet>
</javadoc>
<apply executable="dot" dest="${uml-reports-api}" parallel="false" failifexecutionfails="false" failonerror="false" verbose="false">
<arg value="-Tpng" />
<arg value="-o" />
<targetfile />
<srcfile />
<fileset dir="${uml-reports-api}" includes="*.dot" />
<mapper type="glob" from="*.dot" to="*.png" />
</apply>
<delete verbose="false" quiet="true">
<fileset dir="${uml-reports-api}" includes="**/*.dot, **/*.map" />
</delete>
</target>
<!-- VERIFY target -->
<target name="verify" if="do-verify" depends="verify-ant, verify-tests, verify-findbugs, verify-checkstyle" description="Verify build." />
<target name="verify-ant" if="ant-old" description="Check the Ant version for potential issues with JUnit.">
<echo message="For easier integration with JUnit, we recommand usage of Ant 1.8 or higher." />
<echo message="Otherwise, make sure that you have JUnit's JAR into you Ant's lib directory." />
<echo message="Current version: ${ant.version}" />
</target>
<target name="verify-tests" if="do-verify" depends="verify-ant" description="Execute the tests suites.">
<mkdir dir="${temp}/test" />
<echo>See the JUnit log file for more details: ${temp}/test/TEST-org.restlet.test.RestletTestSuite.txt.</echo>
<junit printsummary="true" fork="true" haltonfailure="true" haltonerror="true" filtertrace="true" showoutput="${verbose}" errorproperty="errorprop" failureproperty="failprop">
<classpath>
<path location="${mod}/${mod-core-test-id}/src" />
<path refid="mod-core-test-path" />
</classpath>
<formatter type="plain" />
<formatter type="xml" />
<test name="org.restlet.test.RestletTestSuite" todir="${temp}/test" />
</junit>
<mkdir dir="${temp}/test/report/html" />
<junitreport todir="${temp}/test/report">
<fileset dir="${temp}/test/">
<include name="TEST-*.xml" />
</fileset>
<report todir="${temp}/test/report/html" />
</junitreport>
<echo message="${line.separator}Tests browsable at:${line.separator}${temp}/test/report/html/index.html"/>
<fail if="failprop" message="At least one failure during junit tests." taskname="verify-tests" />
<fail if="errorprop" message="At least one error during junit tests." taskname="verify-tests" />
</target>
<target name="verify-findbugs" if="do-findbugs" description="Attempts to find bugs.">
<mkdir dir="${temp}/findbugs" />
<for param="module" delimiter=" " list="${modules}">
<sequential>
<findbugsModule name="${module" />
</sequential>
</for>
</target>
<target name="verify-checkstyle" if="do-checkstyle" description="Check the style of the code.">
<mkdir dir="${temp}/checkstyle" />
<for param="module" delimiter=" " list="${modules}">
<sequential>
<checkstyleModule name="${module" />
</sequential>
</for>
</target>
<!-- Integrate target -->
<target name="integrate" depends="" description="Integrate files from other projects." />
<!-- STAGE target -->
<target name="stage" description="Stage the packaging step.">
<antcall target="stage-classic" />
<antcall target="stage-maven" />
<antcall target="stage-p2" />
</target>
<!-- STAGE-CLASSIC target (Stage the packaging step) -->
<target name="stage-classic" description="Stage the packaging step of classic distribution.">
<!-- Prepare distribution directories -->
<delete dir="${dist-classic}" verbose="false" quiet="true" includeEmptyDirs="true" />
<mkdir dir="${dist-classic}/lib" />
<!-- <mkdir dir="${dist-classic}/lib/poms" /> -->
<mkdir dir="${dist-classic}/src" />
<!-- Copy the binaries -->
<if>
<equals arg1="${edition}" arg2="jse" />
<then>
<mkdir dir="${dist-classic}/bin" />
<copy todir="${dist-classic}/bin">
<fileset dir="${bin}" />
</copy>
</then>
</if>
<!-- Copy the Javadoc -->
<if>
<istrue value="${do-javadoc}" />
<then>
<copy todir="${dist-classic}/docs/api">
<fileset dir="${docs-api}" />
</copy>
<copy todir="${dist-classic}/docs/engine">
<fileset dir="${docs-engine}" />
</copy>
<mkdir dir="${docs-ext}" />
<copy todir="${dist-classic}/docs/ext">
<fileset dir="${docs-ext}" />
</copy>
</then>
</if>
<!-- Copy text notes -->
<copy file="${docs}/changes.txt" tofile="${dist-classic}/changes.txt" />
<copy file="${tmpl}/text/copyright.txt" tofile="${dist-classic}/copyright.txt" />
<copy file="dependencies.txt" tofile="${dist-classic}/lib/readme.txt">
<filterset begintoken="@" endtoken="@" filtersfile="filterset.properties" />
</copy>
<copy file="${tmpl}/text/docs.txt" tofile="${dist-classic}/docs/readme.txt" />
<copy file="${tmpl}/text/src.txt" tofile="${dist-classic}/src/readme.txt" />
<copy file="${tmpl}/text/license.txt" tofile="${dist-classic}/license.txt" />
<copy file="${tmpl}/text/readme.txt" tofile="${dist-classic}/readme.txt" />
<copy file="${tmpl}/text/trademarks.txt" tofile="${dist-classic}/trademarks.txt" />
<!-- Copy the build properties files.
<copy todir="${dist-classic}/src">
<fileset dir="${basedir}" includes="*.properties" />
</copy>
-->
<!-- Packages libraries -->
<for param="library" delimiter=" " list="${libraries-classic}">
<sequential>
<stageLibrary name="@{library}" />
</sequential>
</for>
<!-- Package modules -->
<!-- Complete the jar file with extra files -->
<!-- @stage-extras@ -->
<!-- @stage-modules@ -->
</target>
<target name="stage-maven" depends="stage-classic, stage-maven-2" if="do-maven" description="Generate the maven distributions." />
<!-- STAGE-MAVEN-2 target -->
<target name="stage-maven-2" if="do-maven" description="Generate the maven-2.x distributions.">
<delete dir="${dist-maven2}" verbose="false" quiet="true" includeEmptyDirs="true" />
<for param="module" delimiter=" " list="${modules}">
<sequential>
<maven2Module name="@{module}" />
</sequential>
</for>
<for param="package" delimiter=" " list="${packages-maven}">
<sequential>
<maven2Library name="@{package}" />
</sequential>
</for>
<!-- Add the parent pom -->
<property name="mod-restlet-parent-version-maven" value="${version-maven}" />
<propertyregex property="mod-restlet-parent-dir-maven-groupId" input="${parent-maven-groupId}" regexp="\." replace="/" global="true" casesensitive="false" />
<!-- All files generated from the modules are stampped with the current full version number -->
<property name="mod-dir-restlet-parent-maven2" value="${dist-maven2}/${mod-restlet-parent-dir-maven-groupId}/${parent-maven-artifactId}/${version-maven}" />
<mkdir dir="${mod-dir-restlet-parent-maven2}" />
<copy file="${poms}/${parent-maven-artifactId}.pom" tofile="${mod-dir-restlet-parent-maven2}/${parent-maven-artifactId}-${mod-restlet-parent-version-maven}.pom" overwrite="true" />
<checksum file="${mod-dir-restlet-parent-maven2}/${parent-maven-artifactId}-${mod-restlet-parent-version-maven}.pom" algorithm="MD5" fileext=".md5" />
<checksum file="${mod-dir-restlet-parent-maven2}/${parent-maven-artifactId}-${mod-restlet-parent-version-maven}.pom" algorithm="SHA" fileext=".sha1" />
</target>
<!-- STAGE-P2 target -->
<target name="stage-p2" if="do-p2" description="Generate the p2 distribution.">
<for param="module" delimiter=" " list="${modules-p2}">
<sequential>
<p22Module name="@{module}" />
</sequential>
</for>
<for param="library" delimiter=" " list="${libraries-p2}">
<sequential>
<p22Library name="@{library}" />
</sequential>
</for>
</target>
<!-- PACKAGE target -->
<target name="package" if="do-package" depends="package-classic, package-maven, package-p2" description="Generate the distribution.">
<!-- copy final artifacts to the final distribution directory -->
<move todir="${final-dist-base}">
<fileset dir="${dist-base}">
<include name="restlet-${edition}-${version-compact}.*"/>
</fileset>
</move>
</target>
<target name="package-classic" if="do-package" depends="package-classic-zip, package-classic-nsis" description="Generate the classic distributions.">
<move todir="${final-dist-classic}">